Certbot - Cloudflare DNS Plugin
In this tutorial we will get a wildcard certificate from letsencrypt using the cloudflare dns plugin. For the purpose of this tutorial we will be using example.com as the domain.
Install Cloudflare DNS Plugin
This tutorial assumes you have already installed certbot. If you have not, you can follow the instructions from certbot-eff.
API Credentials
Retrieve your api key from cloudflare.
- Login to the Cloudflare account.
- Go to My Profile.
- Scroll down to API Keys and locate Global API Key.
- Click API Key to see your API identifier.
Create the file below with your cloudflare information. We will save the file at /root/secrets/certbot/cloudflare.ini.
# Cloudflare API credentials used by Certbot
dns_cloudflare_email = cloudflare@example.com
dns_cloudflare_api_key = 0123456789abcdef0123456789abcdef01234567
Secure the folder and file.
Requesting for Certificate
The --dns-cloudflare-propagation-seconds option defines the number of seconds to wait before doing the validation checks, you can change it accordingly.
It is important that we specify the server to be the ACME v2 server as the v1 server does not support wildcard certificates.
We should now have our cert at /etc/letsencrypt/live/example.com/.