6 ms·
Dehydrated: Letsencrypt/acme client implemented as a shell-script
- fanf2 3y agoDehydrated has been my ACME client of choice for many years now. Nice and simple and easy to use.
- ibbtown 3y agoUsing it for years in DNS mode, works like a charm
- H8crilA 3y agoWhy would you use this for anything else than a joke given that Certbot exists, and is even in most repositories? (asking seriously)
- lrvick 3y agoCertbot is a massive pile of dependencies that you need to care and feed and update. You should not need 100s of megs of nonsense for something that can be done with a shell script.
- BadBadJellyBean 3y agoPeople are always talking like shell scripts are without dependencies. Shell scripting ist mostly piping program outputs to different programs, that have dependencies on libraries themselves. Each of them have to be kept up to date to stay secure. Just because they are mostly preinstalled on the system doesn't make them not a dependency. This, together with the fact that most shell scripting is bash based which is, in my opinion, not a very good language, makes it less secure to me than a python tool.
- lrvick 3y agoIf it is just a few curl and openssl commands, why make a user install hundreds of megs of python deps just to ultimately call mostly openssl commands anyway One of the biggest risks today is supply chain attacks. The more dependencies you have, the more people you are giving the ability to tamper with your critical code paths.
- nullify88 3y agoWouldn't this bash script be just as susceptible to supply chain attacks? What dependencies does openssl, cURL, sed, grep, awk, mktemp pull in, and could it be vulnerable to attack like we saw with xz?
- semi-extrinsic 3y agoI think the point is to minimize the total attack surface on a system. If the bash script only depends on programs like those you list, which Linux distros package as default anyway, the shell script has not introduced any new dependencies on your system.
- lrvick 3y agoAbsolutely there is still supply chain risk there. But less risk in 3 dependencies than 300.
- BadBadJellyBean 3y ago3? You think you underestimate the number of libraries your software uses.
- lrvick 3y agoI actually full source bootstrapped a Linux distribution from zero recently. Most distros have a lot of dependencies you do not need. In this case you only actually need curl, openssl, and busybox. Those depend on at least a small libc implementation and a kernel but those are certainly already present. Coreutils or busybox is probably already installed too. Still, I will grant the requirement of musl and a linux kernel since we are being pedantic or maybe talking about an embedded linux use case, so 5 deps total to boot from metal and get a cert. To be fair I would never actually ship openssl or busybox in a real embedded project. Would probably write a simple standalone binary using the standard library of Go or something.
- rany_ 3y agoIt doesn't even work well in my experience. ACME.sh is a lot more hassle free, I've always had issues with Certbot's DNS verification. Basically I'm not avoiding Certbot to make a point, I just think it's inferior for my specific use cases. I don't know about Dehydrated but I also expect it to be BS free.
- radiowave 3y agoYup, I gave up on certbot after trying to understand why I couldn't get the Digital Ocean DNS plugin to work, which is maintained as part of the Certbot repo. (This was a few years ago, so details may have changed.) I discovered the issue was that the plugin does some pretty broad-brush guesswork about which domain in your DNS hosting it should actually populate with the response value. If you own a bunch of similar domain names (as many orgs do), the plugin may guess wrong. Much happier to be using dehydrated, and I don't regard it as a major impediment that I had to spend 10 minutes hand writing the necessary API call to the DNS provider.
- enkrs 3y agoExactly. I've been using dehydrated on two servers since it was named acme.sh (pre-2015) and updated it once. It just works and no dependecies.
- systemz 3y agoDehydrated and acme.sh seems different. Is one of them fork? https://github.com/acmesh-official/acme.sh https://github.com/acmesh-official/acme.sh https://github.com/dehydrated-io/dehydrated https://github.com/dehydrated-io/dehydrated
- enkrs 3y agoBrainfart from my side. When I first installed dehydrated.sh it was originally named letsencrypt.sh (not acme.sh) and later renamed to dehydrated. That was quite a while ago.
- nullify88 3y agoWith that rationale, why not use https://github.com/go-acme/lego https://github.com/go-acme/lego which is a self contained lets encrypt client in Go?
- lrvick 3y agoStatic binary, sure, but hardly a tiny supply chain attack surface: https://github.com/go-acme/lego/blob/master/go.sum https://github.com/go-acme/lego/blob/master/go.sum Also their official builds are built with Alpine which is a hobby distro that does not even do signed code or packages.
- chrisweekly 3y agoAre you saying that any use of Alpine is, by definition, a supply-chain security problem?
- lrvick 3y agoI am, yes. Alpine is not full-source-bootstrapped, often imports and trusts external binaries blindly, has no signed commits, no signed reviews, no signed packages, and is not reproducible. It is one phished git account away from a major supply chain attack any day now. Alpine chooses low security for low contribution friction. It is the Wikipedia of Linux distros, which granted it a huge package repository fantastic for experimental use and reference, but it is not something sane to blindly trust the latest packages of in production. It is one of the reasons why I made stagex, which in most cases is a near drop-in replacement. https://codeberg.org/stagex/stagex https://codeberg.org/stagex/stagex
- chrisweekly 3y agoThanks for the detailed response! EDIT: Also, stagex looks pretty compelling; I hope it catches on!
- 9dev 3y agoThe only joke here is Certbot, a tool intended for use on servers but distributed on a channel intended for consumer use - Snap. The only package manager that will update on its own, when it feels like it, without a killswitch, runs as a daemon intertwined with the system. Icing on the cake is that the Certbot team advertises alternative install methods, of which none work and all of the lengthy guides for them recommend to use Snap instead. It’s an insult for professionals.
- bakugo 3y ago> the Certbot team advertises alternative install methods, of which none work I've only been using it for a little while, but the pip + venv method seems to work decently well: https://certbot.eff.org/instructions?ws=other&os=pip https://certbot.eff.org/instructions?ws=other&os=pip
- 9dev 3y agoDid you see that bold disclaimer on top? > Partial support > The Certbot team supports this installation method on a best effort basis. If you are on a more obscure or heavily customized system, these instructions may not work and the Certbot team may be unable to help you resolve the problem. This is an instant no-go for any professional environment I ever worked in.
- crispyambulance 3y agoYep, this. So ridiculous to have to install yet another package manager, snapd, to get certbot installed "the easy way". The alternative to get around snapd works fine (IMHO, for my situation, a lightsail instance running amazon linux 2023 where installing snapd is a pain in the ass), but you still have to jump through some hoops.
- candiddevmike 3y agoI'm a simple man, I see a comment complaining about snap and I automatically upvote. It's 2024. If you're still distributing snaps as the preferred method of install, you're alienating your users. AppImage, Flatpak, and regular containers are all far better deployment options.
- mholt 3y agoThe EFF themselves recently explored the question whether Certbot should just be replaced with servers like Caddy. https://www.eff.org/es/deeplinks/2024/03/should-caddy-and-traefik-replace-certbot https://www.eff.org/es/deeplinks/2024/03/should-caddy-and-tr...
- sirn 3y agoOne of the biggest benefits of dehydrated is that it doesn't try to integrate with a DNS provider on its own. It just connects to ACME server and calls a hook, which can be implemented with a simple shell script[1]. The most popular third-party integration is lexicon[2], though you're not required to use Lexicon. (e.g. you're free to use awscli, gcloud, linode-cli, etc. to do the actual DNS record manipulation)[3] This means its dependencies footprint is much smaller, and allows you to do things that can be a nightmare to configure with Certbot or other alternatives. For example, at one of the scenarios I had to set up was that we had to query a credential via HashiCorp Vault, which is then used to cURL into an API endpoint. The shell script in total was pretty short (~200 LOC) and it worked extremely well. The fact the shell script is so simple that I could test adding/removing records without ever invoking ACME process is also a huge benefit. [1]: https://github.com/dehydrated-io/dehydrated/blob/master/docs/dns-verification.md https://github.com/dehydrated-io/dehydrated/blob/master/docs... [2]: https://github.com/AnalogJ/lexicon https://github.com/AnalogJ/lexicon [3]: https://github.com/dehydrated-io/dehydrated/wiki https://github.com/dehydrated-io/dehydrated/wiki
- groestl 3y agoUsing it with Hetzner DNS API that way.
- blackfawn 3y agoDoes DNS mode work to issue for internal servers that don't expose 80/443 to the internet?
- arisudesu 3y agoAs a bash script actually, not a (implied POSIX) shell script. Do not mix these two.
- bananskalhalk 3y agoSeems to work in zsh too. Both bash and zsh are shells like c-shell ksh etc. Nowhere is it implied that shell-scripts are written for Bourne shell.
- sambazi 3y agoboth bash and zsh are orders of magnitude more complex than sh or even ksh
- arisudesu 3y agoI am not familiar with zsh, but is it really interpreted by zsh? Because the script has #!/usr/bin/env bash in its shebang, isn't it executed by bash on your system, even if launched from zsh?
- bananskalhalk 3y agoIt seems to be very source-able in both bash and zsh. If you just executed it, it will run in bash. They seem to have gone through some effort for this to be true.
- keybored 3y agoBash is a shell script. Posix is not implied.
- arisudesu 3y agoThis script is explicitly a Bash script and it is not executable by every other shell present on modern unix-like systems. Examples are Korn shell, Almquist shell. Hence the distinction: if one states that the script is a shell-script, it implies that it can be interpreted by any modern shell, for which there is only one common denominator, POSIX. This script is explicitly only Bash shell compatible, not any-shell compatible.
- cmbernard333 3y agoWas my default way of updating my certs until I switched to using an Nginx proxy docker image that handled it for me automatically. Still highly recommend this tool.
- teddyh 3y agoWorks fine. My only complaint is that it’s a bit slow. Granted, my use case is a bit different than most. $ wc --lines /etc/dehydrated/domains.txt 5161 /etc/dehydrated/domains.txt
- sschueller 3y agoAt that size I would recommend to dynamiclay generate the domains.txt and only place domains in there that require renewal.
- eigenvalue 3y agoI don’t get why people are saying it’s hard to install Certbot. I just do: sudo apt install certbot python3-certbot-nginx And it “just works” on Ubuntu. The whole thing is super easy and takes around 1 minute to get a cert installed and configured with nginx.
- vbezhenar 3y agoNot everyone's happy to allow certbot to change nginx configs. I never tried it and I'll never try it. Also not everyone wants to install few dozens of packages just for this little thing.
- ExoticPearTree 3y agoAll you need is certbot and a post-hook to restart nginx. There’s this misconception that you need extra packages to get certificates working with different software.
- jraph 3y agoIt has a mode where it doesn't touch your nginx config. That's what I use because indeed, I don't want it to mess with my nginx config. For the rest, I'll indeed look into lighter alternatives some day. But the setup works on its own so I'm a bit lazy.
- throw0101c 3y ago> And it “just works” on Ubuntu. Sure. Now look at the dependencies that are installed compared to dependencies that are installed for dehydrated (or acme.sh, etc) which generally are: bash, OpenSSL, cURL. This is very handy for more appliance-like system (I ran dehydrated on (RH-based) F5s for years before ACME was put into the GUI; also ran it on (FreeBSD-based) Isilons.) Also, if you want to do an audit of the code, how many lines of Python need to be examined (including dependencies) compared to how many lines of Bash? (Both would have common dependencies like (Open)SSL and HTTP/cURL libraries.) As we saw with the recent XZ kerfuffle, 'software supply chains' are becoming important. Personally I find it much easier to understand / configure dehydrated: $ git clone https://github.com/dehydrated-io/dehydrated.git $ sudo cp dehydrated/dehydrated /usr/bin/ # cat > /etc/dehydrated/config WELLKNOWN="/var/www/htdocs/.well-known/acme-challenge" CONTACT_EMAIL="you@example.com" # cat > /etc/dehydrated/domains.txt example.com www.example.com # mkdir -p /var/www/htdocs/.well-known/acme-challenge $ sudo dehydrated -c (Ubuntu/Debian has packages for it as well.)
- gregmac 3y agoI used this years ago to implement SSL for a bunch of customer vanity domains, and as far as I know it's still operating. The best thing is it's declarative: you provide a text file with domains you want in each certificate, and it makes it happen. Certbot has discrete commands you have to run to add, remove, or modify certificates, so you have to keep track of state. We had a management UI to control these domains, so it didn't work well with something like terraform (which I think otherwise solves the state problem for certbot). Instead we just wrote out the domain file based on db config changing + daily, and ran dehydrated. If there were no certificate changes or renewals needed, nothing would happen. Also the hooks are great, iirc we had a pre-check in place for our own http-01 validation, so as not to cause failures on let's encrypt. (Mostly customers would cname domains to us, but lots could go wrong). We were also using s3 to store the validation files (again, super easy with bash hooks) to make it work across a pool of load balancers. This is a great example of a tool where a focus on simplicity (config, hooks, and the way it stores everything) creates an incredibly easy to use, flexible (and thus powerful) system.
- akshayshah 3y agoApparently the author recently sold the project to a company called apilayer: https://lukas.im/2020/01/30/selling-dehydrated/index.html https://lukas.im/2020/01/30/selling-dehydrated/index.html They plan to keep the project open source and employ Lukas to continue maintaining it.
- nickf 3y agoAPILayer = ZeroSSL
- vbezhenar 3y agoZeroSSL are the only ones providing certificates for IP addresses and free year-long certificates. Cudos to them for disrupting this market, almost monopolized by letsencrypt. Don't have high hopes, though, big players probably will kill them as they killed other free certificate issuers. For some reason letsencrypt status-quo as the only free certificate issuer benefits big players.
- omoikane 3y agoThe certificate for zerossl.com is also issued by Let's Encrypt. https://crt.sh/?q=zerossl.com https://crt.sh/?q=zerossl.com
- arccy 3y agoletsencrypt is hardly the only free cert issuer. even google offers them https://security.googleblog.com/2023/05/google-trust-services-acme-api_0503894189.html https://security.googleblog.com/2023/05/google-trust-service...
- nickf 3y agoWhich ‘big players’?
- IshKebab 3y agoJesus, not only do people seriously use this but somebody bought it? The world is insane.
- CAP_NET_ADMIN 3y agoI think the amount of alternative ACME clients is a testament to the absolute mess that certbot is. Constant breakage unless you're using snaps on the most popular distributions. The CLI is absolutely idiotic and convoluted and the plugins do a lot of guess work without informing you, which results in some fun debugging. It's also a large pile of dependencies that take up space.
- prpl 3y agoI created a k8s deployment which spins up nginx in a job to update TLS secrets with dehydrated because I couldn’t get an admin to install cert-manager. It works great, especially because I had scheduled rebuilds of the base container off of latest images. I left the job 3 years ago, and it’s still running fine and staying ahead of the vuln scanners. I had also used a pre-shared private key, which I put on a F5 BigIp, and just scheduled a job on the F5 to pull the updated certs daily.
- rini17 3y agoParsing json in shell? Easy! filter="$(printf 's/.\[%s\][[:space:]]\([^"]*\)/\\1/p' "$(json_path "${1:-}" "${2:-}")")" Please, no! How can you know this is safe? Why not just use Python? It is installed pretty much everywhere, supports json without such hacks.
- 8organicbits 3y agoA very relevant question. Acme.sh, a similar shell script ACME client, had a remote code execution problem last year. https://github.com/acmesh-official/acme.sh/issues/4668 https://github.com/acmesh-official/acme.sh/issues/4668
- deleted 3y ago[deleted]
- justsomehnguy 3y ago> It is installed pretty much everywhere Yes, but which version?
- IshKebab 3y ago3.6 is pretty much universally available at this point.
- jasongill 3y agoRHEL 7 (which still has 4 years of extended lifecycle support left) ships with Python 2.7.5 MacOS Sonoma (the latest version) doesn't include Python at all; older versions of MacOS which are still supported ship with Python 2.x
- rini17 3y agoEven python2 is muchly preferable to bash/awk, thanks.
- 3y ago
- dkatz23238 3y agoHow does dehydrated compare to nginx-proxy with acme-companion from an operational perspective? I've been looking at other options and the best so far seems to be Caddy.
- jacob019 3y agoAny reason to prefer it over acme.sh ? Seems pretty similar. I've been using acme.sh for years, usually in nginx mode, sometimes in DNS mode.
- omoikane 3y agoWhat's the motivation behind closing file descriptors 3 and 4? # Close weird external file descriptors exec 3>&- exec 4>&- From this commit: https://github.com/dehydrated-io/dehydrated/commit/b116e6bc2be28a1806c101d3ac0452bc0aca345c https://github.com/dehydrated-io/dehydrated/commit/b116e6bc2...
- heyoni 3y agoWhen are those ever used? Is it to customize output for when you’re sending to a file vs terminal?
- sirn 3y agosystemd socket activation opens extra fds starting from fd 3 (SD_LISTEN_FDS_START). Though I can't think of a scenario where this may be relevant for dehydrated. Maybe some weird systemd unit somewhere that invoke dehydrated does this?
- smartmic 3y agoI prefer this acme client written in pure C : https://github.com/ndilieto/uacme https://github.com/ndilieto/uacme