652 points · by Jaruzel · 5y ago · 202 comments
Always nice to see some variety in clients along side the official Let's Encrypt one.
While we do use the official Python-based client at works at times, whenever I install it via apt, and it pulls in a whole bunch of dependencies, it's a bit disconcerting to me.
I'm a bit partial to dehydrated, which is a shell script (works under Bash and Zsh): I find it a lot easier to understand. It's handy to put on Linux/POSIX-based appliances like F5s, where the only prerequisites are Bash, cURL, and OpenSSL (and standard Unix tools like sed, grep, etc):
* https://devcentral.f5.com/s/articles/lets-encrypt-on-a-big-i...
* https://github.com/EquateTechnologies/dehydrated-bigip-ansib...
You have the option to create a virtualenv and install it with pip, or snap, or use a docker image. See [1]. This has a couple of advantages:
* you'll get the latest version from the maintainers - for instance right now only debian unstable has the latest 1.18.0 version - debian testing bundles 1.12.0-2 * you won't be adding system packages that might affect other parts of the system
[1] https://certbot.eff.org/docs/install.html#alternate-installa...
You could jump through all those silly hoops (most of which will be completely alien to people who are not Python devs) in order to use the "official" dependency-heavy Python client.
Or you could just use a single pre-compiled Go binary, LEGO [1].
I have been increasingly favouring Go recently because the functions delivered to the end-user are dependency free, you can just ship simple single binaries instead of having to say "oh you need Python X with this that and whatever other Python library under the kitchen sink installed on your system".
And that's before we start talking about conflicts that can occur between Python libraries....which, let's face it will happen in an "average Joe" environment where Joe is just randomly using apt to install any Python dependencies.
What kind of conflicts are you talking about? In both Debian and Ubuntu repos, all Python packages and their dependencies are nicely versioned and separated so there can't be any conflicts between Python versions. As for the handful of Python packages that are mutually exclusive (Pillow and PIL), either only one implementation is in the repos or you can install any one of them and have it work since they're drop-on replacements.
Now, if you start installing system-wide packages with sudo pip, you'll of course break things, but if you're installing things from the apt repos, there is no reason to ever do this (and pip will yell at you that you shouldn't do it).
Why would snaps or docker be completely alien to people who aren't python devs?
They only support snap. Which is fucking nuts.
I'll second the suggestion for dehydrated.
https://man.openbsd.org/acme-client.conf.5 http://cvsweb.openbsd.org/src/usr.sbin/acme-client/
Certbot is designed for interactive use: obtaining, changing and renewing certificates are all distinct commands, and if you tell it to obtain a cert you already have, it'll just obtain it anyway. Handling this from a script is a huge pain.
https://github.com/Tronde/acme-tiny
It's an acme client in a single, small, stand-alone Python file.
I reverse-engineered it and ported it to Common Lisp. I haven't published the result, but I'd be happy to do so if anyone is interested.
Be sure to use the latest version from https://github.com/diafygi/acme-tiny though :-)
That is the one pain point I have with Let's Encrypt.
PS: Yes, you can automate the DNS updates. That is the paintpoint I am talking about. It is one more moving part. One more dependency on a third party. One more thing to set up. One more thing that can break. One more thing that will rot (APIs always change at some point in time).
Many people seem to solve the "automate DNS" by putting their DNS credentials on the server which serves their website. This is the worst thing from a security perspective. Now someone who breaks into your application can take over your DNS, point your domain to wherever they like and get any certificate for it they like. This probably enables them to also overtake your email and then escalate further from there.
[1] https://cabforum.org/wp-content/uploads/CA-Browser-Forum-BR-...
In this mode you manually configure a CNAME record once like "_acme-challenge.important.example => _acme-challenge.lessimportant.example" and then setup your client with DNS API keys for the lessimportant.example domain. You still get valid certs for your important domain without exposing creds for it.
A leaked key would prevent attackers from changing your important DNS records, but they could still generate valid certs for your important domain.
We bought a cheap domain (~$14/y) for this purpose and hooked it up to a DNS provider with a better API than our main provider. It has worked great and gives some peace of mind.
[0]: https://cert-manager.io/docs/configuration/acme/dns01/#deleg...
It introduces a 4th party you depend on. Now you have:
1: The datacenter where your application runs
2: The DNS server
3: Let's Encrypt
4: The "DNS provider with a better API"
you are unavoidably dependent on 1-3 anyway
DNS validation has been a thorn in my side for a while. Not only do I use DNS hosts that don't have APIs (like Google Domains), I also don't really want to give every web server access to my entire zone. That seems like a huge attack surface.
But what you are suggesting should work just fine aswell - there should be no need for a persistent service. Of course the service would need to run on port 53, so you actually cannot have another nameserver on that machine already, and also require CAP_NET_BIND_SERVICE .
A quick search lead me to this python project that could be an inspiration: https://github.com/pawitp/acme-dns-server
Indeed. That's why I have a single machine that I use for running acme. (Maybe people don't realize that you don't have to run the acme client on the same machine where the certificate will ultimately be deployed?) It contains all my keys (ssh keys, acme account keys, API tokens) in an encrypted database and a set of scripts for getting updated certificates and installing them. This machine has no open incoming IP ports, only outgoing SSH and HTTPS connections. It also contains copies of all my source code and deployment scripts. I could in theory tear down my entire production infrastructure and rebuild it with a single command from this machine.
And the different value every three months thing is definitely a feature not a bug, because otherwise stale values could lead to mis-issuance.
What about marketing/static hosting sites like Netlify/Vercel/etc? I can point my domain there. That does not mean they should be authorized to have wildcard certs over the whole domain.
How could you validate wildcards
without changing DNS?
The same way you validate ownership of a subdomain: By putting stuff into the well-known path. Only that you
do it for the root domain. I don't know any case where
someone has control over the root domain but is not
eligible for a wildcard cert.> For Certificates issued on or after 2021‐12‐01, the CA MUST NOT issue Certificates for other FQDNs that end with all the labels of the validated FQDN unless the CA performs a separate validation for that FQDN using an authorized method. This method is NOT suitable for validating Wildcard Domain Names.
Let's Encrypt are just ahead of the curve here, this was always unsafe because it means if your corporate site https://big-corp.example/ is on some bulk host that bulk host can get (even though presumably they wouldn't) wildcard certificates that will also match mail.big-corp.example and db2.big-corp.example and auth.big-corp.example and vpn.big-corp.example ...
Companies very very often point their root domain at a hosting company for their marketing site; let's use Netlify as an example.
This does NOT mean that I would expect Netlify to be able to issue wildcard certs for my domain.
Basic "www-izer" (redirection) services are another example where the root domain is pointed somewhere that should not be able to issue wildcard certs.
The main reason being that revocation is a hard problem to solve. For example OCSP creates a single point of failure. And top of that most software doesn't even check it.
Currently methods 3.2.2.4.18 and 3.2.2.4.19 allow you to get a wildcard based on the web site changes, but that's clearly unsafe and is going away from December. Let's Encrypt never allowed it because it would be hypocritical to have people saying "This is unsafe" while also allowing it.
I use
1. Free Cloudflare DNS 2. Traefik's built-in ACME client
* https://en.wikipedia.org/wiki/DNS-based_Authentication_of_Na...
However, DNS records themselves are not protected by default: they can be fiddled with in transit. So you have to enable DNSSEC to prevent them from being altered.
So yes, there are standards in place to do what you are suggesting. You'll 'just' have to convince people to enable all of this infrastructure and then have TLS clients use it.
Since more than a year or two, all the free S/MIME certificates that you can get these days have issues:
- some of them a valid less than one year which is a huge hassle for S/MIME as opposed to HTTPS because you need to keep all your old certificates around
- some of them will not let you use your own private key (I wish i was kidding)
Rotating keys might be a good security practice, though. But not necessary.
The proper way to do it is to check with a compromised password database, and maybe with common rules like "your user name and password must be different". But I've almost never seen it used, I have used passwords that I know are compromised or even common, it always passed as long as it had the right characters.
It shouldn't be that hard. Storage is cheap now, save a few GB for the entire haveibeenpwned database and you know you have a good password. There are even online services that do it securely and, I think, for free.
The only real problem, I think, is a UX problem. Having to enter a password and being told repeatedly "haha, nope, try again" with no explicit way to correct it may be more annoying than clear rules but it doesn't strike me as an unsolvable problem.
My bank does this, setting an maximum of 15 characters. It is an incredibly frustrating experience when I have to change my password (which I have to do every 6 months, per their "security" policy): I'm reminded of this ludicrous requirement of < 16 chars because most certainly they store these passwords in plain text.
For context: this is the largest private bank in my country serving 50 million+ of customers.
I believe commercial CA are offering free certificates milted to 3 months for the same reasons, and for the up-selling opportunities.
I think also cloud providers offer free 1 year TLS certificates, but of course you are also using their other services.
This means every three months you need to re-authenticate with Apple Pay. But there is no Acme client for authenticating with Apple Pay. So instead, I was having to re-authenticate something manually every 3 months. It involved logging into an Apple Developer account, downloading a PEM file, uploading to my server and then clicking a button in the Developer Account to check the file.
After doing that dance, I happily paid for 2 year certificates from RapidSSL. Now you can only buy one year certificates. I really hope the CAB isn’t successful in making those non-conforming and requiring shorter certs.
There are plenty of other environments where certificate automation is not possible. And honestly, I haven’t seen arguments as to how on-machine automation is more secure than requiring someone be involved in the process.
While I’m dreaming about improvements to the CA ecosystem, having some way to actually prove your are the company you claim would be amazing. Instead we are actively removing support for anything that tried to provide that…
If you want to use the www auth you need to allow outbound connections to any IP (they specifically won't release the range they use), otherwise you have the DNS option which means giving the server access to modify the DNS records which is also unsafe should the box get compromised.
This is true, but the machine doing DNS modifications doesn't need to be accessible to any outside initiated connections at all. So if someone has the capacity to compromise such a computer, what would stop them from compromising your desktop computer or your laptop instead?
But either way it would indeed be nice to have further limits on what the box could do. But I think LetsEncrypt does not need to change anything to make this possible.
https://letsencrypt.org/docs/challenge-types/
The DNS verification works by creating a DNS TXT record named "_acme-challenge" with a TXT value on the domain you are verifying.
So really what you want is for your DNS provider to implement into their API access keys that can be restricted so that the absolutely only thing the key is allowed to do is to create, change and delete the DNS TXT record named "_acme-challenge". Perhaps some DNS providers already make this possible? But the one I am using is only able to limit it to a ZONE, but not to a specific record type and not to a specific label.
In fact I wish CloudFlare would allow such specific fine-grained permissions. But even if they did they'd probably make it part of the Enterprise plan and I am still not an Enterprise customer so.
Edit: Meanwhile that I was writing this someone else posted a sibling comment about ACME DNS alias mode, which I had not heard of. https://github.com/acmesh-official/acme.sh/wiki/DNS-alias-mo... That's very close to good enough. Though it would still be nice if DNS providers made it possible to issue API access tokens that are limited to specific record type and specific label.
I have a separate machine doing the DNS challenge and the cert is then distributed to the machine needing it.
Technically true for the regular web challenge, but easier with DNS I think.
Only for the time period when you're requesting the cert though: it does not have to be open to the entire Internet 24/7. While this may not satisfy your personal / particular level of security concern, but it is something worth keeping in mind. Using the dehydrated client as an example, the web server could be started and stopped (or the host's firewall rules altered) in the startup_hook() / exit_hook() functions, or the deploy_challenge() / clean_challenge() functions:
* https://github.com/dehydrated-io/dehydrated/blob/master/docs...
> otherwise you have the DNS option which means giving the server access to modify the DNS records which is also unsafe should the box get compromised.
Are you aware of LE/ACME's "DNS alias" mode?
* https://github.com/acmesh-official/acme.sh/wiki/DNS-alias-mo...
* https://www.eff.org/deeplinks/2018/02/technical-deep-dive-se...
Let us say you want to get a cert for foo.example.com. Letting an ACME client change the value of that could be a risk, as you state. So what you can do is (manually) create a CNAME _acme-challenge.foo.example.com, and point that elsewhere, like _acme-challenge.foo.dnsauth.example.com. You then allow the ACME client to alter (just) the TXT records of _acme-challenge.foo.dnsauth.
People have even written simple DNS server that allow for updating of records via a RESTful API, so you can server just the (e.g.) dnsauth sub-domain from it, leaving your main domain untouched (besides the initial CNAME addition):
* https://github.com/joohoi/acme-dns
There's also a CLI utility that can handle access the APIs of several dozen DNS companies so you don't have to roll your own if you want to server the sub-domain from your current provider:
* https://github.com/AnalogJ/lexicon
And you don't have to use a sub-domain, but something else entirely too: instead of dnsauth.example.com you can point the CNAME to example-dnsauth.com or example.org. So if your primary DNS provider doesn't have an API, you can use another one that does. The destination CNAME does not matter as long as you control and can update it.
Yeah, if this is free and you have automated the process then, really, the validity period no longer matters. 1 year, 3 months, 1 month, it's all the same for the majority of purposes.
Relevant link: https://letsencrypt.org/2015/11/09/why-90-days.html
I'm not aware of a dedicated service that offers free 1-year certs in the style of LetsEncrypt, but they'll often be available from e.g. hosting providers as part of a package. Hard to imagine a use-case where 90-day renewals aren't a better option, anyway.
"6.3.2
Certificate operational periods and key pair usage periods Subscriber Certificates issued on or after 1 September 2020 SHOULD NOT have a Validity Period greater than 397 days and MUST NOT have a Validity Period greater than 398 days. Subscriber Certificates issued after 1 March 2018, but prior to 1 September 2020, MUST NOT have a Validity Period greater than 825 days. Subscriber Certificates issued after 1 July 2016 but prior to 1 March 2018 MUST NOT have a Validity Period greater than 39 months.
For the purpose of calculations, a day is measured as 86,400 seconds. Any amount of time greater than this, including fractional seconds and/or leap seconds, shall represent an additional day. For this reason, Subscriber Certificates SHOULD NOT be issued for the maximum permissible time by default, in order to account for such adjustments."
- CA-Browser-Forum BR 1.7.9, p67
What me would interest, if it would be possible cross-sign the certificates by all of those 4 and automate this?
Currently privilege separation on a server or a TLS terminator doesn't do much for ACME privileges because an exploit anywhere on the request path can use an arbitrary account to obtain new certs.
Binding to a single ACME account in DNS (accounturi=…) would significantly reduce the attack surface, as would requiring non-http validation methods.
https://community.letsencrypt.org/t/rfc-8657-caa-extension-i...
For a generic Let's Encrypt site if you have Elliptic curve keys, the existing R3 issuing intermediate will cheerfully sign you a certificate. The certificate will be for your EC public key, but signed by the R3 intermediate using RSA.
If your reason for wanting EC is that it's less work on your server, this achieves the goal, no RSA signatures from your servers (unless you also need to serve customers that can only do RSA and need a separate setup for that).
If you want, you can enroll in a trial programme for Let's Encrypt EC issuing intermediates where E1 will sign your EC keys (if you enroll R3 still signs any RSA keys you ask for). This chains through ISRG Root X2 and then ISRG Root X1 because ISRG Root X2 is not trusted by most (any?) large trust stores today.
If you can't have RSA anywhere in the chain then yeah, Let's Encrypt can't do that for you in practice today, although it'd be nice if you explain why you'd want that.
[1] https://twitter.com/Scott_Helme/status/1392101598852222976
It would be great to have a tool somewhere that matches client handshakes & supported CAs vs server config & choice of CA chains
PS, do you think there is a chance for a similar service to be available in the future, but for EXE file signing ;)
It used to be prominent on the respective pages, but is now stated in the footer.
It was not super easy to set up. I think the whole config is 20 lines or so, but the docs, naming and functionality of how Caddy actually interfaces with LE was tricky to find out. Basically had to scrape together answers from various GitHub issues etc.
I should write a blog post…
Edit: now it runs fine btw
caddy is actually great! auto ssl
https://caddyserver.com/docs/automatic-https#issuer-fallback
Google actually wants to do this for their Cloud Platform, and owns the whole chain (i.e. has its own CA, https://pki.goog) but it's currently hard in the current state of CA/B baseline requirements.
This is what I would really be looking for in an alternative to Let's Encrypt.
To give you physical control over the intermediate basically means they're staking their entire reputation on you doing what you promised and never screwing up.
You could imagine this working with a constrained intermediate, except I can more or less guarantee that the day after you commit to such a thing you discover a client you care about can't handle the constraint, and so you ask for it to be relaxed, whereupon you are back in the exact same situation.
Mozilla requires CAs to tell them about every unconstrained intermediate, so there's actually a complete list you can go look at. It is not large.
My main use-case in mind is service which provides HTTPS to its clients, but clients should serve content from their own endpoints. Think about home devices. Proper way to do so is to generate private key on device, send public key to somewhere and receive proper certificate for device-0123.example.com. This could be automated with letsencrypt and DNS verification, but there's limit of 50 certificates per week which would require to register plenty of domains and rotate them. Using intermediate certificate would solve that issue.
The consequence of that second element is that clients which don't understand the constraint (and thus wouldn't know which are or are not trustworthy leafs under the constrained intermediate) mustn't trust the intermediate at all. This means if you need those clients you cannot use the constraints they don't understand, because they'll reject your entire intermediate.
Mozilla defines constrained as it pertains to the problems they care about, so for example they do not consider a CA constrained if it lacks a constraint they require.
For your use-case there are two practical options:
1. Most suitable for commercial projects e.g. you're a startup selling a new IoT device. Talk to a commercial CA and work out a deal where you get what you need. Outfits like Sectigo strike deals like this all the time. They understand that you don't want to pay high prices per certificate for this problem, but on the other hand you may be able to guarantee minimum volume and that means it makes commercial sense compared to piecemeal orders.
2. For a hobby project talk to Let's Encrypt about getting an exemption to the rate limit for your specific application, or, if it fact the devices are owned by third parties, whether this should be on the Public Suffix List and thus exempt from rate limits anyway. (the PSL also means these devices can't share HTTP cookies among each other, which might well be exactly what you wanted anyway).
yeah, pass