JA93
Occasional Visitor
I wanted SSL for both my DuckDNS domain and subdomains, but got stuck with a pesky LetsEncrypt error. Let 'sEncrypt gave me the "Can not find dns api hook for: dns_duckdns" error, and manual TXT records didn't fly with DuckDNS, I turned to ZeroSSL. However, ZeroSSL only hands out SSL for domains (unless you're up for a pricey $50/mo plan), but I found a cool trick.
Step 1: Install acme.sh
First, we need to install acme.sh, a handy ACME protocol client that supports Let's Encrypt and DuckDNS.
Step 2: Register for a DuckDNS account
If you haven't already, sign up for a DuckDNS account and create a domain. This will be your primary domain for which we'll obtain SSL using ZeroSSL.
Step 3: Obtain SSL for the primary domain using ZeroSSL
Next, we'll get SSL for your DuckDNS domain using ZeroSSL. Although ZeroSSL only provides SSL for the main domain without charge, we'll later use it to get SSL for subdomains via Let's Encrypt.
Step 4: Obtain SSL for subdomains using Let's Encrypt
Since Let's Encrypt allows SSL for subdomains for free, we'll use the TXT record issued by ZeroSSL to obtain SSL for your subdomains.
Step 5: Automatic Renewal (Optional)
You can set up a cron job to automatically renew your SSL certificates before they expire. Add the following command to your crontab:
You now have SSL certificates installed for both your DuckDNS domain and subdomains on your Router!
Keep in mind that I have an older armv7(386.3.2) router and maybe this is well-known in your community... I had trouble finding it out and I decided to share. I'm not an expert by any means, just a hobbyist!
How to Install SSL on DuckDNS + Subdomains with Asuswrt Merlin Routers
Step 1: Install acme.sh
First, we need to install acme.sh, a handy ACME protocol client that supports Let's Encrypt and DuckDNS.
# Download acme.sh
wget https://github.com/acmesh-official/acme.sh/archive/master.tar.gz
tar -zxvf master.tar.gz
# Install acme.sh
./acme.sh --install
./acme.sh --version # Make sure it's installed properly
Step 2: Register for a DuckDNS account
If you haven't already, sign up for a DuckDNS account and create a domain. This will be your primary domain for which we'll obtain SSL using ZeroSSL.
Step 3: Obtain SSL for the primary domain using ZeroSSL
Next, we'll get SSL for your DuckDNS domain using ZeroSSL. Although ZeroSSL only provides SSL for the main domain without charge, we'll later use it to get SSL for subdomains via Let's Encrypt.
# Register an account and set up DuckDNS API Token
export DuckDNS_Token=XXXXX
# Issue SSL certificate for your DuckDNS domain
./acme.sh --issue --dns dns_duckdns -d yourdomain.duckdns.org --ecc --home /path/to/acme.sh-master
Step 4: Obtain SSL for subdomains using Let's Encrypt
Since Let's Encrypt allows SSL for subdomains for free, we'll use the TXT record issued by ZeroSSL to obtain SSL for your subdomains.
# Issue SSL certificate for your DuckDNS domain
./acme.sh --issue --dns dns_duckdns -d 'yourdomain.duckdns.org' --dnssleep 120 --days 90 --ecc --server https://acme-v02.api.letsencrypt.org/directory
# Issue SSL certificate for your DuckDNS subdomain
./acme.sh --issue --dns dns_duckdns -d '*.yourdomain.duckdns.org' --dnssleep 120 --days 90 --ecc --server https://acme-v02.api.letsencrypt.org/directory
Step 5: Automatic Renewal (Optional)
You can set up a cron job to automatically renew your SSL certificates before they expire. Add the following command to your crontab:
0 0 * * * "/path/to/acme.sh-master"/acme.sh --cron --home "/path/to/acme.sh-master/"
You now have SSL certificates installed for both your DuckDNS domain and subdomains on your Router!
Keep in mind that I have an older armv7(386.3.2) router and maybe this is well-known in your community... I had trouble finding it out and I decided to share. I'm not an expert by any means, just a hobbyist!