Request a Let’s Encrypt Certificate Use DNS-01 Challenge Via acme.sh




If you don’t have access to port 80 or 443 on your server, which means you can’t do TLS challenge. This article may help.

Install acme.sh

Bash
curl https://get.acme.sh | sh -s [email protected]

or:

Bash
wget -O -  https://get.acme.sh | sh -s [email protected]

or:

Bash
git clone https://github.com/acmesh-official/acme.sh.git
cd ./acme.sh
./acme.sh --install -m [email protected]

root is recommended.

Get a Certificate

If you don’t have access to port 80, but not port 443. You can issue a TLS-ALPN-01 challenge:

Bash
acme.sh --issue --alpn --pre-hook 'systemctl stop apache2' --post-hook 'systemctl start apache2' -d example.com -d www.example.com

If you don’t have access to both port 80 and 443, and can create DNS records automatically. You can issue a DNS-01 challenge:

Using Cloudflare API

Bash
export CF_Token="sdfsdfsdfljlbjkljlkjsdfoiwje"
export CF_Account_ID="xxxxxxxxxxxxx"
export CF_Zone_ID="xxxxxxxxxxxxx"

Then, issue a cert now:

Bash
acme.sh --issue --dns dns_cf -d example.com -d www.example.com


Leave a Reply

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