News for hackers. Stuff that matters.
Re:Running one’s own root Certificate Authority in 2023 by fiddlerwoaroof on Saturday September 16, 2023 @04:01PM (#37538141)
The one thing you can’t do with Let’s Encrypt is generate a certificate with a CN of localhost which, since browsers are getting really picky about mixed HTTP/HTTPS content, is a real issue with local development using certain web features.
Re:Running one’s own root Certificate Authority in 2023 by moondev on Saturday September 16, 2023 @04:25PM (#37538380)
You also can't generate a cert for a double wildcard, like mydomain . com . * . * Or an entire domain, although I'm unsure if that is possible with your own CA as well
Re:Running one’s own root Certificate Authority in 2023 by jeroenhd on Saturday September 16, 2023 @06:23PM (#37539379)
You can generate the certificate but browsers don't like multiple wildcards. Any application following the rules set out by RFC 6125 should reject multiple wildcards as far as I can tell.

Some browsers (notably Firefox) used to support multiple wildcards, but then again it also trusted domain certificates signed by other domain certificates for years, so that's not much to go by. These days, I don't think a single browser will accept ..foo.bar.

Re:Running one’s own root Certificate Authority in 2023 by punkybr3wster on Saturday September 16, 2023 @04:12PM (#37538254)
I’ve also struggled with this. Is there an elegant solution that you’re aware of? Everything I’ve tried feels really rickety.
Re:Running one’s own root Certificate Authority in 2023 by ceejayoz on Saturday September 16, 2023 @04:18PM (#37538311)
For localhost, there’s not much downside to a self-signed cert.
Re:Running one’s own root Certificate Authority in 2023 by unethical_ban on Saturday September 16, 2023 @04:36PM (#37538458)
Browsers won't offer to save passwords on self signed sites.
Re:Running one’s own root Certificate Authority in 2023 by lozenge on Saturday September 16, 2023 @04:57PM (#37538615)
You might be able to get around this using the Chrome "flags" page, search for unsafely-treat-insecure-origin-as-secure.
Re:Running one’s own root Certificate Authority in 2023 by fiddlerwoaroof on Saturday September 16, 2023 @05:11PM (#37538744)
Chrome flags are pretty annoying to use, especially if you use the same browser for regular browsing.
Re:Running one’s own root Certificate Authority in 2023 by fiddlerwoaroof on Saturday September 16, 2023 @04:45PM (#37538516)
I've been using cfssl[1] to generate a root certificate + a localhost certificate and then trusting the root.

[1]: https://github.com/cloudflare/cfssl

Re:Running one’s own root Certificate Authority in 2023 by xg15 on Saturday September 16, 2023 @05:17PM (#37538804)
> is a real issue with local development using certain web features.

Is it? I thought browsers treat localhost/127.0.0.* specifically as if it were served over https, even if it isn't - otherwise, you could basically forget developing anything locally.

Is there any feature which doesn't treat localhost as a secure origin?

I figure you can always buy a hostname, get a cert using the DNS-01 challenge, then resolve the domain to 127.0.0.1 though - or getting back to the OP and running a custom CA.

Re:Running one’s own root Certificate Authority in 2023 by fiddlerwoaroof on Saturday September 16, 2023 @05:21PM (#37538834)
I have a dashboard I run via nginx on localhost that makes a bunch of requests to various https endpoints. It definitely doesn’t just work unless you have a trusted SSL certificate and run localhost as HTTPS
Re:Running one’s own root Certificate Authority in 2023 by xg15 on Saturday September 16, 2023 @05:34PM (#37538921)
Huh, that's odd. Gonna test this as well then.
Re:Running one’s own root Certificate Authority in 2023 by cpach on Sunday September 17, 2023 @05:27AM (#37543133)
I think it’s the mixing of HTTP and HTTPS that most browsers doesn’t like.

If you develop locally and it’s only HTTP with no HTTPS, then I think it works.

Re:Running one’s own root Certificate Authority in 2023 by xg15 on Sunday September 17, 2023 @06:15AM (#37543426)
I always thought that "mixed content" was defined as mixing "secure" and "insecure" origins (where a "secure origin" could be either https://something or http://localhost) and not literally mixing http and https urls. But this would explain the problem.

To my knowledge, https on loopback doesn't give you any kind of added security: Everything with enough privileges to capture the encrypted packets on loopback also has enough privileges to just capture the unencrypted memory directly. And "localhost" is also a single "domain", so a cert wouldn't even give you the ability to distinguish between different origins (as other ports or hostnames that resolve to 127.0.0.1 would do)

So it's just some buerocratic hoops to jump through to satisfy browsers.

Edit: I remember reading about some objection that the "localhost" domain could be resolved to something other than 127.0.0.1, either through the hosts file or through a faulty DNS resolver.

To my knowledge, those objections were addressed in the "let localhost be localhost" proposal which mandated that the hostname "localhost" must be hardwired to 127.0.0.1 in the OS/browsers/resolvers etc and must never be permitted to point to anything else.

But maybe this proposal didn't gain traction and so browsers are defending against such rebound localhost domains.

In that case, I'd try and check if "http://127.0.0.1" works, as the IP address can't be rebound in the same way as the hostname.

Re:Running one’s own root Certificate Authority in 2023 by sneak on Saturday September 16, 2023 @06:05PM (#37539217)
Why not register a domain, get a cert for it, and point it at 127.0.0.1? Then nothing can complain.
Re:Running one’s own root Certificate Authority in 2023 by fiddlerwoaroof on Saturday September 16, 2023 @06:51PM (#37539599)
The other advantage of running your own PKI is you can intercept and decrypt arbitrary traffic on the network.
Re:Running one’s own root Certificate Authority in 2023 by sneak on Saturday September 16, 2023 @08:42PM (#37540354)
No. Knowledge of the CA private key does not allow for this. In all cases you have the webserver's private key, whether you issue the cert yourself or if someone else does.

If you have the web server's private key, you can decrypt the traffic, but only if PFS ciphers are not used.

It is a common misconception that knowledge of CA keys allows you to decrypt traffic. It does not. It allows you to issue valid certificates. It's only used for signing.

It's the webserver's key that protects the traffic. The webserver's operator has that key regardless of who the CA is. In the case of PFS cipher suites (eg EDH) an ephemeral key is used for confidentiality and the endpoint keys are just used for integrity and key authentication. Even with the webserver key you aren't decrypting those streams.

In no case does the CA private key help you decrypt traffic.

Re:Running one’s own root Certificate Authority in 2023 by ivlad on Saturday September 16, 2023 @10:26PM (#37540888)
> Knowledge of the CA private key does not allow for this

Of course it does. You just generate certificates for every TLS handshake you see and MitM them.

And yes, it works for PFS too. There is no difference for MitM.

> In the case of PFS cipher suites (eg EDH) an ephemeral key is used for confidentiality and the endpoint keys are just used for integrity and key authentication. Even with the webserver key you aren't decrypting those streams.

You never encrypt data with a key from certificate, even without PFS. That would be too slow. You generate a pre-master key and then use it to generate keys for symmetric algorithms, like AES or Chacha20, that are actually used for data stream encryption. The only difference between PFS and non-PFS is that in the former case pre-master is generated using some form of DH, with promise of keys being destroyed after some time, and in the later case, client just generates a random key, encrypts it with the public key and sends it to the server.

Re:Running one’s own root Certificate Authority in 2023 by sneak on Saturday September 16, 2023 @11:41PM (#37541296)
MitM is not "decrypt arbitrary traffic" which is what was asserted. m
Re:Running one’s own root Certificate Authority in 2023 by fiddlerwoaroof on Sunday September 17, 2023 @12:39AM (#37541577)
I wasn’t distinguishing the two sorts of attacks.
Re:Running one’s own root Certificate Authority in 2023 by diarrhea on Saturday September 16, 2023 @08:46PM (#37540374)
My router blocks it to protect against DNS rebind.
Re:Running one’s own root Certificate Authority in 2023 by xg15 on Sunday September 17, 2023 @10:06AM (#37545215)
If it's just for development, you could set it up in the hosts file.