I self-host a bunch of tools, like I believe many here do, and I issue a subdomain + Let's Encrypt certificate for the vast majority of them. I also use the DNS-01 challenge to avoid exposing an HTTP server to the outside world. Since DNS-01 requires OVH API credentials, I create a DNS zone for each subdomain, then delegate the NS, then issue a set of API keys for that zone to keep things isolated for security.
This is somewhat tedious, so I (and Claude) wrote a simple script that automates the process:
- orders the zone
- adds the NS delegation and waits until everything is live
- issues a set of API keys for the new subdomain
- prints ready-to-paste blocks for acme.sh (with renewal cron) or a Caddy container
Every consumer key is requested with the minimum access rules and has to be validated in the browser before it becomes active — the script picks the keys up over the API, so nothing is ever copy-pasted.
Single Python file, no dependencies beyond the standard library. Feedback welcome: