My scenario is I have an erlang server that’s running which uses bash to call certbot to issue a certificate. This server also runs DNS, which has it’s own custom API (for adding DNS records).
I’m trying to issue wildcard certificates to my domain (ACMEv2). So my need is, I need to find a way to ask certbot to give me back the DNS records (in a non-interactive way) which prints them to STDOUT (ideally in JSON format), to parse the result and add them to my DNS server. This way I can make the final request to get my certificates with the required DNS records.
For what it's worth, it's dangerous to run that as root on a multi-user system. (And any system is "multi-user" if it gets compromised.) A regular user could, for example, do "ln -s /etc/passwd /tmp/challenge.txt" and trick Certbot into trashing /etc/passwd next time it runs. If they're clever, it could possibly be used for privilege escalation, rather than just causing damage.