News for hackers. Stuff that matters.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by losingom on Sunday August 21, 2022 @12:56PM (#32542043)
If you want to be super minimal, I prefer acme.sh[1] instead. It even comes preconfigured for various DNS providers[2], and you can even create your own hook if there isn't already one[3].

[1] https://github.com/acmesh-official/acme.sh

[2] https://github.com/acmesh-official/acme.sh/wiki/dnsapi

[3] https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Dev-...

Re:Uacme: ACMEv2 client written in plain C with minimal depe... by thayne on Sunday August 21, 2022 @01:56PM (#32542667)
If you have over a thousand lines of bash (or any other kind of shell code really), that is a pretty big red flag that you probably shouldn't be using bash IMO.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by delusional on Sunday August 21, 2022 @02:23PM (#32542931)
If you want to issue a certificate in an environment where you only have a shell, it's the only language you can use.

Sometimes you write in shell because it's the lowest common denominator.

Re:Uacme: ACMEv2 client written in plain C with minimal depe... by thayne on Sunday August 21, 2022 @04:40PM (#32544172)
Well, if you have to use shell that's one thing, but I would be hesitant to use such a large shell script for something as important as certificate issuance in an environment where I didn't have to.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by linsomniac on Sunday August 21, 2022 @08:53PM (#32546056)
Just as a counter point, I've been using acme.sh for ~3 years now and it's been rock solid.

I get your point, and was pretty shocked to find acme.sh, but after the certbot PPA made a giant mess of my system I gave it a try. On the other hand, why should I balk at running thousands of lines of bash, but be fine with thousands (or many more) lines of C, Python, PERL...? You can write crappy or beautiful code in any language...

[dead]
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by throw0101a on Sunday August 21, 2022 @04:23PM (#32544021)
> If you only have shell on your servers then it is time to start looking for a new job.

Perhaps you wish to have "real" certs on appliances like F5s and Isilons (FreeBSD-based) where you can't install extra stuff, but where curl and openssl (and bash/zsh) are present.

Or perhaps you want to run simple software that you can actually audit. While "over a thousand lines of bash" may take a little while to examine, good luck auditing Zope, which is what certbot pulls in as a dependency:

* https://packages.debian.org/bullseye/python3-certbot

* https://packages.ubuntu.com/jammy/python3-certbot

Re:Uacme: ACMEv2 client written in plain C with minimal depe... by encryptluks2 on Sunday August 21, 2022 @07:56PM (#32545731)
Here we are talking about a lightweight C executable though that doesn't have those dependencies. You are also not limited to provisioning certificates on appliances as well, and in those cases I don't think have a thousand line bash script offers anymore security (probably less) than a full-featured C program.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by throw0101a on Sunday August 21, 2022 @08:05PM (#32545787)
Except you have to be able to compile the C code into an executable, which may not be possible on an appliance.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by ClumsyPilot on Sunday August 21, 2022 @08:36PM (#32545952)
appliance as in a router or a washing machine? who, ever, would not pre-compile and distribute binaries in a situation like that?
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by throw0101a on Monday August 22, 2022 @07:51AM (#32550130)
At my last job I ran an Isilon: I could upload a cert for the HTTP server via the web UI, but there was no ACME client. I could SSH in, drop dehydrated and have it work because all I needed was a shell, curl, and openssl.

Similarly with F5: there is (was?) no native ACME client (at least a few years ago when I first looked at it). So I download dehydrated and used various CLI interfaces to schedule automated runs and importation of the certificates.

There was no pre-compiled binary, and no compilers, on either system, and so talking about a "lightweight C executable" is non-sensical. Further, even if we (managed to) compiled things off-host, when we did an OS upgrade on either system, a whole bunch of libraries would change and we'd have to (remember to) re-compile. There is no such worry with a shell script.

If you want to have ACME-fetched certs on a general computer system, then compiling a C program (large or small) is an option. But there are scenarios where compiled/compiling C programs is not an option, and you telling me otherwise when I have personal experience of these situations takes some chutzpah.

Re:Uacme: ACMEv2 client written in plain C with minimal depe... by encryptluks2 on Monday August 22, 2022 @04:00PM (#32556431)
I wouldn't be offended. Many people including me have personal and work experience in this area as well. No one is saying you're wrong, but even you acknowledge there are other ways to upload certificates.. usually involving an API as well. If you want to run unchecked third-party 1000+ line bash scripts on production appliances, by all means go right ahead.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by throw0101a on Tuesday August 23, 2022 @07:04AM (#32563031)
> If you want to run unchecked third-party 1000+ line bash scripts on production appliances, by all means go right ahead.

Again, I have a better chance at reading all the code of dehydrated (which I have, in fact, done), then reading all of the Python code that certbot pulls in via dependencies on Ubuntu/Debian.

Re:Uacme: ACMEv2 client written in plain C with minimal depe... by mr_toad on Monday August 22, 2022 @12:07AM (#32547232)
If you’re provisioning an immutable VM or a container you don’t want to add unnecessary cruft. The official LetsEncrypt client and its > 100 dependencies is a non-starter.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by delusional on Sunday August 21, 2022 @03:09PM (#32543374)
Not everything I do is a job.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by majou on Sunday August 21, 2022 @09:29PM (#32546293)
Stop bashing on bash.

It has limitations, and quoting takes a hot minute to grok, but those don't come into play for a surprising amount of medium-large projects when used properly.

I use POSIX sh only and get by with maintainability and handling failure modes just fine.

Re:Uacme: ACMEv2 client written in plain C with minimal depe... by thayne on Sunday August 21, 2022 @11:32PM (#32547010)
Bash is great for cases where you are gluing together a bunch of other commands. But it also has a lot of pitfalls, that something as large and complex as this will absolutely run into (to be fair, so does c).

As a specific example, the ACME protocol requires working with json. Doing this in bash is very difficult and error prone, especially if you want to avoid a dependency on something like jq, as this does.

Re:Uacme: ACMEv2 client written in plain C with minimal depe... by whateveracct on Sunday August 21, 2022 @10:26PM (#32546632)
ShellCheck and unofficial strict mode make bash a pretty nice language.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by superkuh on Sunday August 21, 2022 @05:00PM (#32544394)
On the otherhand, if you're a user and not a developer, you know something written in bash will be written to run on any machine out there. Doesn't matter if it's old or new. Whereas if it's written in C++xx or Rust or the like it'll only compile/run on rolling release distros (or for the 3 months after a normal distro is released that it's up to date).
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by nicoburns on Sunday August 21, 2022 @05:20PM (#32544564)
It might only compile on a machine with a recent compiler if it’s aggressive with using new language features, but why would need to compile a Rust/C++ version from source? A compiler binary will run jut fine on old distro versions.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by netheril96 on Sunday August 21, 2022 @07:55PM (#32545723)
On old distros you need to install the latest libc and libstdc++/libc++ to run them. I’ve tried many times in the past and never succeeded.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by nicoburns on Monday August 22, 2022 @06:46AM (#32549670)
Typically projects will compile the binaries on systems with a much older version of libc (but the latest compiler) specifically to avoid this problem.

If they’re not doing this then I believe they won’t work on older systems even if compiled with old compiler versions.

Re:Uacme: ACMEv2 client written in plain C with minimal depe... by steveklabnik on Sunday August 21, 2022 @05:31PM (#32544663)
Bash isn’t on non-UNIX machines by default. I could run a C or Rust produced binary just fine, but I couldn’t run that shell script.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by klysm on Sunday August 21, 2022 @11:28PM (#32546984)
Minimalism is much different than portability. I don’t consider heavy bash scripts to be minimal.
Re:Uacme: ACMEv2 client written in plain C with minimal depe... by zdw on Sunday August 21, 2022 @02:48PM (#32543206)
I use this and it's pretty great.

Also it can be highly locked down - run as it's own unprivileged user, with access only to directories served by another webserver for the ACME handshake, storing certs, and a tightly restricted sudoer to restart the webserver on cert cycle.

Re:Uacme: ACMEv2 client written in plain C with minimal depe... by throw0101a on Sunday August 21, 2022 @04:20PM (#32543998)
> It even comes preconfigured for various DNS providers[2]

Also, CLI utility that supports a bunch of APIs:

* https://github.com/AnalogJ/lexicon