cloudflare api dns

Alright lets auto renew those certs

Bash
sudo apt update
sudo apt install certbot python3-certbot-dns-cloudflare

or

Bash
sudo yum install epel-release
sudo yum install certbot python3-certbot-dns-cloudflare

Create a new API token with the following permissions:
Zone:Zone:Read
Zone:DNS:Edit
Save the API token securely.

Bash
sudo mkdir -p /etc/letsencrypt/secrets
sudo nano /etc/letsencrypt/secrets/cloudflare.ini

Add the following to the cloudflare.ini

Bash
dns_cloudflare_api_token = YOUR_CLOUDFLARE_API_TOKEN

Secure that shit

Bash
sudo chmod 600 /etc/letsencrypt/secrets/cloudflare.ini

Lets gooooo

Bash
sudo certbot certonly \
  --dns-cloudflare \
  --dns-cloudflare-credentials /etc/letsencrypt/secrets/cloudflare.ini \
  -d example.com \
  -d *.example.com

Scenario 2: Domains in Different Cloudflare Accounts

If you have 2 separate accounts, you can share access in the user panel. You will want to AT LEAST share the DNS so that the main user can certify your domain as well.

After you add the rights, you can use the main accounts API key to certify both domains! EZ.

Leave a Reply

Your email address will not be published. Required fields are marked *


©️ interdo.me