News for hackers. Stuff that matters.
Re:Does “www.” Mean Better Transport Layer Security? by Avamander on Monday August 19, 2019 @05:36AM (#20736264)
> Literally Apache, Nginx, Tomcat, Jetty all get it wrong out of the box.

Absolutely correct, it's surprisingly difficult to get a really good working configuration with no weird fallbacks or side effects and have working http2. I have five server blocks per domain name when using nginx, some are reusable though, here:

* Port 80 with wrong domain - close connection, nothing legit does this

* Port 80 with right (www. and .) domain - redirect to https://

* Port 443 with no SNI - close connection, nothing legit does this

* Port 443 with www. SNI (http2 enabled) - redirect

* Port 443 with . SNI (http2 enabled) - display proper page

Not surprisingly it tremendously cut down the amount of exploit scanners and bad bots from logs (they seem to rely on everyone not enforcing SNI) and managed to hide the server from Shodan :D. This is of course not to diss nginx, other servers e.g. caddy and apache were worse or even impossible to configure to the same point.

Re:Does “www.” Mean Better Transport Layer Security? by mholt on Monday August 19, 2019 @12:13PM (#20739043)
> other servers e.g. caddy and apache were worse or even impossible to configure to the same point.

Hm? What about TLS is difficult with Caddy?

Re:Does “www.” Mean Better Transport Layer Security? by Avamander on Tuesday August 20, 2019 @07:56AM (#20745857)
Nothing about TLS, a lot about getting the same setup as I can with nginx. E.g. getting rid of the behaviour of random TLS certificate from random block being served when no SNI matches (wtf?) and closing the connection instead.
Re:Does “www.” Mean Better Transport Layer Security? by mholt on Tuesday August 20, 2019 @09:14PM (#20753822)
Hmm, are you using the latest versions of Caddy? That definitely shouldn't be the case. If you are, please file a bug report! If you aren't, please upgrade. :)
Re:Does “www.” Mean Better Transport Layer Security? by zamadatix on Monday August 19, 2019 @08:26AM (#20737110)
If you're just going to redirect www to . why not make it a CNAME instead of a hop?
Re:Does “www.” Mean Better Transport Layer Security? by simcop2387 on Monday August 19, 2019 @08:52AM (#20737262)
CNAME in this case makes no difference vs an A/AAAA record. The HTTP side of things doesn't care what kind of DNS record it was, but will be affected by what the fqdn is, since it will affect cookie propagation and other security things in the browser.
Re:Does “www.” Mean Better Transport Layer Security? by Avamander on Monday August 19, 2019 @08:43AM (#20737196)
CNAME would just resolve `www.` as `.`. Browsers and search engines would still need to be instructed to use the non www. address.
Re:Does “www.” Mean Better Transport Layer Security? by toast0 on Monday August 19, 2019 @03:14PM (#20740837)
It's usually better not to have the same content at two urls. Whichever one you choose, the other should redirect to; or if you're picky like me, trying to go to the non-published one should send you to the home page on the other --- this reduces the tendency of others to link to the wrong form.
Re:Does “www.” Mean Better Transport Layer Security? by newman314 on Monday August 19, 2019 @08:07PM (#20742822)
What does the server block for 443 with no SNI look like?

I wasn't aware that one could test for the existence of SNI in the server block.

Re:Does “www.” Mean Better Transport Layer Security? by Avamander on Wednesday August 21, 2019 @07:41AM (#20756374)

  server {
      listen {replace_with_some_ip} ssl;
      listen {replace_with_some_ipv6} ssl;

      ssl_certificate /etc/ssl/snakeoil.pem;
      ssl_certificate_key /etc/ssl/snakeoil.key;

      server_name _ {replace_with_some_ip} {replace_with_some_ipv6};

      return 444;
  }

Should catch all TLS connections that have no SNI or try to connect straight with just IP and if snakeoil is generated right then it doesn't instantly reveal what's the real hostname.