News for hackers. Stuff that matters.
Re:Running one’s own root Certificate Authority in 2023 by NegativeK on Saturday September 16, 2023 @03:54PM (#37538084)
I went with DNS based Let's Encrypt for internal certificates, since I'm okay leaking my internal DNS names.

> An obvious downside of this is having to guard a bunch of secrets and the need to rotate the host certificates yearly – because Apple says so.

The guarding secrets thing makes me too uncomfortable with managing my own CA. I'm sure it'd be fine, but since there are other equivalent and safer ways to do it.. Name constraints are a thing in the spec for restricting your CA to specific domains (which is amazing,) but browser/etc support was crappy when I looked at it and maybe getting better? I don't understand why name constraints aren't implemented everywhere. Unless an enterprise environment is doing TLS inspection, name constraints are a way saner implementation.

Re:Running one’s own root Certificate Authority in 2023 by woodruffw on Saturday September 16, 2023 @04:13PM (#37538266)
> I don't understand why name constraints aren't implemented everywhere.

They have weird semantics, especially in scenarios with multiple prospective validation paths: path `EE -> ICA' -> ICA'' -> TA` might result in different name constraints than `EE -> ICA' -> ICA''' -> TA`, resulting in hard-to-debug validation errors (or successes) depending on the user's trust store state.

(I don't believe that's why Chrome doesn't support them, however. Chrome's stated reason[1] is that they don't support them on user roots because RFC 5280 doesn't require them to, which is IMO a correct reading of the spec.)

[1]: https://bugs.chromium.org/p/chromium/issues/detail?id=107208...

Re:Running one’s own root Certificate Authority in 2023 by mirchiseth on Saturday September 16, 2023 @04:25PM (#37538378)
I used to have my own local root CA as well but now trying the Let's Encrypt with DNS-01. What is the easiest combination of software to try it? I have failed miserably trying Opnsense + ACME client plugin + Cloudflare DNS + HAProxy / NGinx. I would get 100% ssllabs certs but somehow the reverse proxy won't forward to internal services. Next I am gonna go caddyserver for reverse proxy as it has SSL with LE inbuilt. Let's see.
Re:Running one’s own root Certificate Authority in 2023 by wejn on Saturday September 16, 2023 @04:30PM (#37538417)
A friend of mine runs dns01 thusly: https://ipng.ch/s/articles/2023/03/24/lego-dns01.html
Re:Running one’s own root Certificate Authority in 2023 by taskforcegemini on Saturday September 16, 2023 @04:35PM (#37538450)
do you use https/have a cert in your webserver as well, or just on the proxy?
Re:Running one’s own root Certificate Authority in 2023 by petronio on Saturday September 16, 2023 @06:03PM (#37539192)
I've had a lot of success with https://github.com/dehydrated-io/dehydrated . It exposes the different parts of the process (deploy challenge to DNS, deploy cert to filesystem, etc) as hooks, so it's pretty easy to integrate with anything and however you want, if you don't mind writing a bit of bash. There's a few scripts out there that use Cloudflare that you can use as well.
Re:Running one’s own root Certificate Authority in 2023 by psd1 on Saturday September 16, 2023 @07:55PM (#37540052)
I found LE + CF DNS trouble-free.

Dockerfile:

``` FROM certbot/certbot RUN pip3 install certbot-dns-cloudflare cloudflare ```

docker-compose.yml:

``` volumes: - ${CREDENTIALS_DIRECTORY:-.}/cloudflare.ini:/cloudflare.ini - ${STATE_DIRECTORY:-./certbot}/:/etc/letsencrypt/ - ${LOGS_DIRECTORY:-/var/log/certbot}/:/var/log/letsencrypt/ command: " \ certonly \ --non-interactive \ --agree-tos \ --email [email protected] \ --preferred-challenges dns-01 \ --dns-cloudflare \ --dns-cloudflare-credentials /cloudflare.ini \ --dns-cloudflare-propagation-seconds 30 \ -d foo.bar,*.foo.bar" ```

Re:Running one’s own root Certificate Authority in 2023 by cpach on Sunday September 17, 2023 @05:23AM (#37543113)
This ACME client looks promising, but I haven’t tried it yet: https://github.com/go-acme/lego
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.
Re:Running one’s own root Certificate Authority in 2023 by aberoham on Saturday September 16, 2023 @03:57PM (#37538113)
Did you use elliptic curve instead of RSA?
Re:Running one’s own root Certificate Authority in 2023 by soraminazuki on Saturday September 16, 2023 @04:58PM (#37538628)
> Name constraints are a thing in the spec for restricting your CA to specific domains (which is amazing,) but browser/etc support was crappy

It's well supported now. I use it and it works for OpenSSL, Firefox, and Safari.

Personally, I don't think there's much to gain from using public PKI for internal infrastructure. I already manage secrets on my personal devices and this is no different. Also, being able to issue certs for .home.arpa domains is nice too.

Re:Running one’s own root Certificate Authority in 2023 by hnarn on Sunday September 17, 2023 @05:35AM (#37543169)
> I went with DNS based Let's Encrypt for internal certificates, since I'm okay leaking my internal DNS names.

Lets Encrypt offers wildcard certificates, there is no reason to have internal DNS records exposed.

Re:Running one’s own root Certificate Authority in 2023 by wejn on Sunday September 17, 2023 @05:52AM (#37543259)
Thanks, I've incorporated the name constraints into the article now. (it is indeed supported by Apple and FF just fine)
Re:Running one’s own root Certificate Authority in 2023 by NegativeK on Monday September 18, 2023 @09:38AM (#37555945)
Very nice!