Live data from Hacker News

Tell HN: Please update your DNS records when abandoning servers

news.ycombinator.com

11–20 of 69 posts

Re: Tell HN: Please update your DNS records when abandoning servers

#12
While domain registrants should certainly be careful that their DNS records point to trusted servers only and should definitely remove any stale DNS entries, we should also configure our web-servers to return successful response for specific hostnames only and error/no response for everything else. Here is roughly how the configuration for, say, https://example.com/, would look like:

  sudo mkdir /etc/nginx/ssl
  sudo openssl req -x509 -newkey rsa:4096 -nodes -keyout /etc/nginx/ssl/key.pem -out /etc/nginx/ssl/cert.pem -days 365 -subj "/CN=localhost"

  echo "server {
      listen 80 default_server;
      listen [::]:80 default_server;
      listen 443 ssl default_server;
      listen [::]:443 ssl default_server;
      ssl_certificate /etc/nginx/ssl/cert.pem;
      ssl_certificate_key /etc/nginx/ssl/key.pem;
      return 444;
  }" > /etc/nginx/sites-enabled/default

  echo "server {
      listen 443 ssl;
      listen [::]:443 ssl;
      server_name example.com;
      ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
      root /var/www/example.com;
  }
  server {
      listen 80;
      listen [::]:80;
      server_name example.com;
      return 301 https://example.com$request_uri;
  }" > /etc/nginx/sites-enabled/example.com
The self-signed certificate for the default_server is okay. The client will get a TLS certificate issue. That's fine because we don't anyone to be using the default_server anyway. If the client decides to proceed despite the TLS certificate issue, then the 'return 444' directive would close the connection without response.

Re: Tell HN: Please update your DNS records when abandoning servers

#14
post #12

While domain registrants should certainly be careful that their DNS records point to trusted servers only and should definitely remove any stale DNS entries, we should also configure our web-servers to return successful response for specific hostnames only and error/no response for everything else. Here is roughly how the configuration for, say, https://example.com/ , would look like: sudo mkdir /etc/nginx/ssl sudo o…

The reverse is the problem here: your domain, somebody elses server

Re: Tell HN: Please update your DNS records when abandoning servers

#15
post #12

While domain registrants should certainly be careful that their DNS records point to trusted servers only and should definitely remove any stale DNS entries, we should also configure our web-servers to return successful response for specific hostnames only and error/no response for everything else. Here is roughly how the configuration for, say, https://example.com/ , would look like: sudo mkdir /etc/nginx/ssl sudo o…

That fixes a web-server from serving HTTP responses to other hostnames but none of the other thousand problems

Re: Tell HN: Please update your DNS records when abandoning servers

#16
post #12

While domain registrants should certainly be careful that their DNS records point to trusted servers only and should definitely remove any stale DNS entries, we should also configure our web-servers to return successful response for specific hostnames only and error/no response for everything else. Here is roughly how the configuration for, say, https://example.com/ , would look like: sudo mkdir /etc/nginx/ssl sudo o…

You can't: the web server has to accept the connection to know the hostname. The best you can do is close the connection immediately without sending a response if it's an unknown hostname.

I believe that at least with Apache and nginx doing this requires using a non-default module.

Re: Tell HN: Please update your DNS records when abandoning servers

#17
post #6

I don't see why you should care. Don't allow the requests from non hosted domains on your server. You don't control the DNS' you can't rely on people to updated them.

I think the concern is for the domain owner who could get a visit from the government if “their” server is serving something illegal.

Re: Tell HN: Please update your DNS records when abandoning servers

#18
I agree, but there's something related which I feel is very weird and I wonder if I'm the rule or the exception: I have close to 100 domains to my name(for relatable reasons, i.e. "hey I have a wix site can you please add a domain to it, idk how") in addition to a dozen servers. Some of those domains are completely unused but could be pretty valuable to some people. No one has ever contacted me about either one of them.

Re: Tell HN: Please update your DNS records when abandoning servers

#19
post #12

While domain registrants should certainly be careful that their DNS records point to trusted servers only and should definitely remove any stale DNS entries, we should also configure our web-servers to return successful response for specific hostnames only and error/no response for everything else. Here is roughly how the configuration for, say, https://example.com/ , would look like: sudo mkdir /etc/nginx/ssl sudo o…

that doesn't prevent the "a domain you own points at someone elses server and they can do unsavory things with it". (Especially bad if it's a subdomain, or a domain linked to one of your others.) it's not for OPs sake, but for the domain owners sake.

Re: Tell HN: Please update your DNS records when abandoning servers

#20
post #6

I don't see why you should care. Don't allow the requests from non hosted domains on your server. You don't control the DNS' you can't rely on people to updated them.

The domain owner should care, because OP could misuse the domain.
Post reply on HN