How do you securely configure Certbot with Cloudflare API credentials on macOS for DNS authentication?

Question

Grade: Education Subject: Support
How do you securely configure Certbot with Cloudflare API credentials on macOS for DNS authentication?
Asked by:
102 Viewed 102 Answers

Answer (102)

Best Answer
(586)
To configure Certbot with Cloudflare API credentials, you should create a file (e.g., `~/cloudflare.ini`) containing your Cloudflare API token. The file should look like this: `dns_cloudflare_api_token = YOUR_CLOUDFLARE_API_TOKEN`. Replace `YOUR_CLOUDFLARE_API_TOKEN` with a scoped API token generated in your Cloudflare dashboard (recommended scope: Zone -> DNS -> Edit). It's crucial to set strict permissions on this file to prevent unauthorized access by running `chmod 600 ~/cloudflare.ini` in your terminal. Certbot will then reference this file when performing DNS-01 challenges.