Using Cloudflare’s proxy (orange cloud βοΈ) can block standard HTTP validation (port 80). This guide shows how to issue and renew SSL certificates using DNS-01 challenge via certbot-dns-cloudflare
, compatible with:
- LiteSpeed Enterprise
- CloudLinux 9
- cPanel
- Imunify360
β Requirements
- Domain DNS managed by Cloudflare
- cPanel server with CloudLinux 9 + LiteSpeed
- Root SSH access
- Cloudflare API Token
certbot
+certbot-dns-cloudflare
installed
π§© Step 1: Install Certbot and Cloudflare DNS Plugin
dnf install epel-release -y
dnf install certbot python3-certbot-dns-cloudflare -y
If you prefer
pip
:
pip install certbot certbot-dns-cloudflare
π Step 2: Create Cloudflare API Token
- Log in to Cloudflare Dashboard
- Navigate to My Profile > API Tokens > Create Token
- Use template: Edit zone DNS
- Restrict to your domain
- Copy the token β keep it safe
π Step 3: Store Cloudflare Credentials
Create a secure credentials file:
mkdir -p /root/.secrets/certbot
nano /root/.secrets/certbot/cloudflare.ini
Add:
dns_cloudflare_api_token = YOUR_CLOUDFLARE_API_TOKEN
Set secure permissions:
chmod 600 /root/.secrets/certbot/cloudflare.ini
π§ͺ Step 4: Issue or Renew Certificate
Replace example.com
with your domain:
certbot certonly \
--dns-cloudflare \
--dns-cloudflare-credentials /root/.secrets/certbot/cloudflare.ini \
-d example.com -d www.example.com
Certs will be stored at:
/etc/letsencrypt/live/example.com/
π Step 5: Automate SSL Renewal
Edit root’s crontab:
crontab -e
Add:
0 4 * * * certbot renew --dns-cloudflare --dns-cloudflare-credentials /root/.secrets/certbot/cloudflare.ini --quiet --deploy-hook "/usr/local/lsws/bin/lswsctrl restart"
This:
- Renews expiring certs
- Restarts LiteSpeed on successful renewal
π Step 6: Connect SSL in cPanel + LiteSpeed
Even though certs are issued via CLI, you must map them to cPanel and LiteSpeed.
Option 1: Link Files to cPanel User Path
Replace cpuser
with the cPanel username:
mkdir -p /var/cpanel/ssl/apache_tls/cpuser
ln -sf /etc/letsencrypt/live/example.com/privkey.pem /var/cpanel/ssl/apache_tls/cpuser/privkey.pem
ln -sf /etc/letsencrypt/live/example.com/fullchain.pem /var/cpanel/ssl/apache_tls/cpuser/cert.pem
Then run:
/scripts/restartsrv_httpd
/usr/local/lsws/bin/lswsctrl restart
Option 2: Import Cert via WHM
WHM β Install an SSL Certificate on a Domain
Paste in:
- Cert:
fullchain.pem
- Key:
privkey.pem
π Step 7: Confirm Cloudflare Mode
Go to Cloudflare Dashboard > SSL/TLS β Overview
- Set to Full (Strict) for proper validation end-to-end
π§Ή Imunify360 Compatibility
Imunify360 will not block DNS validation via Cloudflare. No extra exclusions required. Just ensure Imunify360 is not rate-limiting Letβs Encrypt IPs if you issue frequently.
To review logs:
tail -f /var/log/imunify360/console.log
π§ Summary
Component | Action |
---|---|
Certbot + Plugin | Install certbot-dns-cloudflare |
Cloudflare Token | Generate and store in secure file |
SSL Issuance | Use DNS-01 via certbot certonly |
Renewal Cron | Add certbot renew + restart LiteSpeed |
cPanel Integration | Link or import certs to user’s domain |
Cloudflare Mode | Use Full (Strict) for HTTPS end-to-end |