If you need a wildcard certificate, or your origin sits behind a CDN that answers /.well-known/acme-challenge/ before the request ever reaches cPanel, HTTP-01 cannot issue for you and no amount of AutoSSL retrying will change that. DNS-01 is the answer, but the honest version is narrower than most guides admit: cPanel’s AutoSSL can perform DNS-based domain control validation for names in zones the server itself is authoritative for, and it still will not issue a wildcard. For a wildcard, or for a zone that lives at Cloudflare or Route 53, you run a separate ACME client — acme.sh or certbot with a DNS plugin — and install the resulting certificate back into cPanel. This guide covers both paths, plus the CNAME delegation trick that keeps your production DNS credentials off the web server.
What you’ll accomplish
- A clear read on whether HTTP-01 is actually blocked for you, or only appears to be.
- AutoSSL configured to use DNS DCV where that is genuinely enough.
- A wildcard or CDN-fronted certificate issued with acme.sh over DNS-01, installed to a location cPanel updates will not touch.
- The
_acme-challengerecord delegated by CNAME to a throwaway zone, so no client on the web server ever holds credentials for production DNS. - Renewal running unattended, with the two things that silently break it — token expiry and AutoSSL overwrite — pinned down.
Prerequisites
Root SSH on the cPanel & WHM server. Everything below assumes cPanel & WHM 110 or later on AlmaLinux or CloudLinux; menu labels shifted around v102, so on older builds the screens exist under different names while the API calls still work.
You also need to know where the zone for the domain is authoritative. That single fact decides the whole approach, and it is not what the cPanel DNS Zone Editor shows you — cPanel will happily keep a local zone for a domain whose delegation points somewhere else. Check the delegation, not the local file.
Finally, decide who is allowed to hold a DNS API token. A token that can edit your production zone, sitting in a file on a shared web server, is a larger exposure than the certificate problem you are solving. The CNAME delegation in step 6 exists to avoid that.
How it works
ACME offers HTTP-01 and DNS-01 (and TLS-ALPN-01, which cPanel does not use). HTTP-01 asks the certificate authority to fetch a token from http://example.com/.well-known/acme-challenge/<token>; Sectigo, cPanel’s bundled provider, uses the same idea at /.well-known/pki-validation/. Either way the CA has to reach your origin over port 80. Put a proxying CDN in front and the edge answers first — sometimes with a 404, sometimes with a cached page, sometimes with a redirect to HTTPS that the CA will not follow the way you expect. The origin never sees the request, and AutoSSL logs a DCV failure for a server that is, from its own point of view, working perfectly.
Wildcards fail for a different reason. There is no hostname you can serve a file from that proves control of every name under *.example.com, so the CA/Browser Forum rules require DNS validation for wildcards. Let’s Encrypt has never issued a wildcard over HTTP-01 and never will.
DNS-01 sidesteps both. The client asks for an order, the CA hands back a token, the client derives a value from it and publishes that value as a TXT record at _acme-challenge.example.com. The CA then resolves that name from the authoritative nameservers and compares. Nothing in that path involves port 80, so the CDN is irrelevant to it.
The catch is that publishing a TXT record means something has to write into the zone. AutoSSL can do this when the cPanel server is itself the authoritative nameserver, because it edits the local zone directly. It has no mechanism for writing into a zone hosted at Cloudflare, Route 53, or a registrar — there is no field in WHM where you paste a third-party DNS API token, and any guide telling you to add a “Cloudflare provider” to AutoSSL is describing something that does not exist. And regardless of zone location, AutoSSL enumerates the account’s real domains and requests a SAN certificate covering them; it does not request wildcards.
So the decision reduces to four questions.
If you got here because AutoSSL is failing behind Cloudflare specifically, the DCV failure has its own diagnosis path — a large share of those cases are fixed by a page rule, not by DNS-01.
Step-by-step
-
Confirm HTTP-01 is really blocked before you replace it. Drop a probe file where the challenge would land and fetch it from outside.
mkdir -p ~/public_html/.well-known/acme-challenge echo dcv-probe > ~/public_html/.well-known/acme-challenge/probe curl -sS -D- -o- http://example.com/.well-known/acme-challenge/probeA 200 with the body
dcv-probemeans HTTP-01 works and you do not need any of this. A 404, a redirect chain, or a response carryingserver: cloudflareand a body you did not write means the edge is answering. Delete the probe file afterwards. -
Find out where the zone is authoritative. Ask the parent delegation rather than your local resolver.
dig +short NS example.com dig +noall +authority +trace example.com | tail -5The output is the set of nameservers the world actually queries. If they are your cPanel server’s hostnames, the local path in step 3 applies. If they are
*.ns.cloudflare.com,*.awsdns-*.net, or a registrar’s, skip to step 5. -
Use AutoSSL’s DNS DCV when the zone is local and no wildcard is needed. Install the Let’s Encrypt provider if you have not already, then let AutoSSL run.
/usr/local/cpanel/scripts/install_lets_encrypt_autossl_provider whmapi1 start_autossl_check_for_one_user username=cpuserThe install script exits reporting the provider is installed; select it afterwards in WHM » SSL/TLS » Manage AutoSSL » Providers and accept the terms. The
whmapi1call returnsmetadata: result: 1and queues the check rather than blocking. -
Read the AutoSSL log to see which DCV method was used. One file is written per run.
ls -t /var/cpanel/logs/autossl/ | head -3 grep -iE 'dcv|challenge|error' "/var/cpanel/logs/autossl/$(ls -t /var/cpanel/logs/autossl/ | head -1)"Lines mentioning DNS DCV for the domain mean the local-zone path worked. Lines reporting the HTTP DCV check failed with no DNS attempt mean the zone is not local to this server, and AutoSSL has nowhere to write. The Logs tab in WHM » Manage AutoSSL reads these same files if you prefer the UI.
-
Install acme.sh somewhere cPanel updates will not reach. Never put an ACME client under
/usr/local/cpanel/— that tree is replaced on every upgrade./optis not managed by cPanel and survives.git clone --depth 1 https://github.com/acmesh-official/acme.sh.git /usr/local/src/acme.sh cd /usr/local/src/acme.sh ./acme.sh --install --home /opt/acme.sh --config-home /opt/acme.sh/data --accountemail tls@example.comThe installer prints the paths it wrote and adds a daily cron entry. Confirm both with
ls /opt/acme.sh/acme.shandcrontab -l | grep acme. -
Delegate
_acme-challengeinstead of handing over production DNS. Create a zone you use for nothing else —acme-dcv.example.net, at a provider with an API — then add one CNAME to the real zone, using cPanel’s Zone Editor or your DNS host:_acme-challenge.example.com. 300 IN CNAME _acme-challenge.acme-dcv.example.net.Verify the delegation resolves before you issue anything:
dig +short CNAME _acme-challenge.example.comYou should get
_acme-challenge.acme-dcv.example.net.back. The certificate authority follows this CNAME during validation, so the ACME client only ever needs credentials for the throwaway zone. If that zone’s token leaks, the blast radius is a domain that serves nothing. -
Issue the certificate over DNS-01. Scope the API token to DNS edit on the delegation zone only. For Cloudflare, acme.sh reads
CF_TokenandCF_Account_ID:export CF_Token='REDACTED' export CF_Account_ID='REDACTED' /opt/acme.sh/acme.sh --issue --server letsencrypt \ --dns dns_cf --challenge-alias acme-dcv.example.net \ -d example.com -d '*.example.com'Drop
--challenge-aliasif you chose to give the client direct access to the real zone. acme.sh writes the TXT records, waits, then printsCert success.followed by the paths it stored. For another provider, list/opt/acme.sh/dnsapi/— the scripts are nameddns_<provider>and each one documents the environment variables it wants. The certbot equivalent iscertbot certonly --dns-cloudflare --dns-cloudflare-credentials /root/.secrets/cf.ini, which refuses to start unless that file ischmod 600. -
Copy the certificate to stable paths and install it into cPanel. Let acme.sh own the output locations so renewal writes to the same place.
mkdir -p /etc/ssl/acme/example.com /opt/acme.sh/acme.sh --install-cert -d example.com \ --cert-file /etc/ssl/acme/example.com/cert.pem \ --key-file /etc/ssl/acme/example.com/privkey.pem \ --ca-file /etc/ssl/acme/example.com/chain.pem \ --fullchain-file /etc/ssl/acme/example.com/fullchain.pemThen hand it to cPanel:
uapi --user=cpuser SSL install_ssl domain=example.com \ cert="$(cat /etc/ssl/acme/example.com/cert.pem)" \ key="$(cat /etc/ssl/acme/example.com/privkey.pem)" \ cabundle="$(cat /etc/ssl/acme/example.com/chain.pem)"Look for
status: 1in the reply. Astatus: 0with a message about the key not matching the certificate almost always means you passedfullchain.pemascertand the leaf ordering confused the parser — passcert.pem. -
Stop AutoSSL from overwriting what you just installed. In cPanel » SSL/TLS Status, select the domains covered by the manual certificate and use Exclude from AutoSSL. Then check WHM » SSL/TLS » Manage AutoSSL » Options for Allow AutoSSL to replace invalid or expiring non-AutoSSL certificates; if it is on and the domains are not excluded, AutoSSL will eventually decide your wildcard is replaceable and swap in a narrower certificate of its own.
Validate it works
Check the TXT record straight from an authoritative nameserver during an issuance, bypassing every cache between you and it:
NS=$(dig +short NS example.com | head -1)
dig @"$NS" +short TXT _acme-challenge.example.com
During validation you should see one quoted 43-character value — or two, if you ordered the apex and the wildcard together. After issuance the client removes them and the answer goes empty.
Then confirm what is actually being served, on a name only a wildcard can cover:
echo | openssl s_client -connect example.com:443 -servername anything.example.com 2>/dev/null \
| openssl x509 -noout -dates -ext subjectAltName
The SAN list should contain both example.com and *.example.com, with notAfter roughly 90 days out. If you are behind a proxying CDN, this shows the edge certificate rather than yours — query the origin IP directly with openssl s_client -connect <origin-ip>:443 -servername example.com instead.
Finally, rehearse renewal rather than waiting for it:
/opt/acme.sh/acme.sh --renew -d example.com --force --server letsencrypt
It should complete and re-run your --install-cert paths automatically.
Troubleshooting
The CA reports the TXT record was not found, but dig shows it. You are almost certainly querying a resolver that has the record while the CA is querying an authoritative server that does not. Query each nameserver from dig +short NS example.com in turn. Split-horizon setups and a stale secondary that is not transferring are the usual culprits.
Validation fails only when issuing apex and wildcard together. Both challenges use the same _acme-challenge.example.com name, so two TXT records must coexist. A DNS plugin that replaces the record set instead of appending to it will destroy the first value while writing the second. Increase the propagation wait (--dnssleep 120 for acme.sh) and confirm both values are present with the authoritative query above.
The old value keeps being served. The TTL on _acme-challenge is doing what you told it to. Set it to 60 seconds. Some providers also cache negative answers, so the first issuance after adding the CNAME can fail once and succeed on retry.
Renewals stopped silently months later. A rotated or expired DNS API token is the most common cause, and nothing surfaces it until the certificate is close to expiry. Check the client’s own log at /opt/acme.sh/data/acme.sh.log and monitor certificate expiry externally rather than trusting the cron job.
AutoSSL replaced the wildcard with its own certificate. The domains were not excluded from AutoSSL, or the exclusion was lost when the account was moved or restored from a backup. Re-apply the exclusion, then reinstall from /etc/ssl/acme/example.com/.
When this is the wrong approach
If HTTP-01 works, use it. It has no credentials to protect and no propagation to wait for. Behind Cloudflare, an origin rule that bypasses the cache and the proxy for /.well-known/acme-challenge/* often restores HTTP-01 in five minutes and leaves AutoSSL fully automatic.
If you only need TLS between the CDN and your origin, an origin certificate from the CDN is simpler than any ACME flow, since the CDN is the only client that will ever validate it — that path is worth comparing before you commit to wildcards.
And if your DNS provider has no API at all, do not build a manual-mode renewal ritual around it. Every 60 days someone will forget. Move the zone, or delegate _acme-challenge to a provider that does. The mechanics of DNS-01 are the same on any ACME client — the Caddy version of this problem shows the same pattern outside cPanel. The authoritative reference for what each challenge type can prove is Let’s Encrypt’s challenge types page, and acme.sh’s DNS API list lives in its repository.
If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.