264 字
1 分钟
Configuring SSL Certificates with acme.sh on OpenWRT
Preface
OpenWRT’s built-in luci-app-acme is very hard to use, and official documentation is hard to find (many luci plugins are like this mess, e.g. tinyproxy is also unmaintained…). So I chose the official original acmesh instead.
Installing acme.sh
wget -O - https://get.acme.sh | sh -s email=my@example.comcd ~/.acme.sh./acme.sh --upgrade --auto-upgradeConfiguring DNS API Keys
Edit the ~/.acme.sh/account.conf file and add the following:
Since I use Cloudflare DNS, if you use something else, please refer to the official docs.
export CF_Zone_ID="aaaaaaaaaaa"export CF_Token="aaaaaaaa"Requesting a Certificate
Use the following command to request a certificate via Cloudflare’s DNS validation method:
./acme.sh --issue --dns dns_cf -d admin.tski.uk -d '*.example.com' # The DNS method supports requesting wildcard certificatesViewing the Certificate List
You can view the requested certificates with the following command:
./acme.sh --listInstalling the Certificate
Install the requested certificate to the target location and restart the uhttpd service:
./acme.sh --install-cert -d admin.tski.uk \--key-file /etc/uhttpd.key \--fullchain-file /etc/uhttpd.crt \--reloadcmd '/etc/init.d/uhttpd restart'Verifying the Installation Works
Use the following command to force-renew the certificate:
./acme.sh --renew -d admin.tski.uk --forceIf the installation succeeded, the output looks like this:
.......[Mon Feb 3 16:14:16 CST 2025] Your cert is in: /root/.acme.sh/admin.tski.uk_ecc/admin.tski.uk.cer[Mon Feb 3 16:14:16 CST 2025] Your cert key is in: /root/.acme.sh/admin.tski.uk_ecc/admin.tski.uk.key[Mon Feb 3 16:14:16 CST 2025] The intermediate CA cert is in: /root/.acme.sh/admin.tski.uk_ecc/ca.cer[Mon Feb 3 16:14:16 CST 2025] And the full-chain cert is in: /root/.acme.sh/admin.tski.uk_ecc/fullchain.cer[Mon Feb 3 16:14:17 CST 2025] Installing key to: /etc/uhttpd.key[Mon Feb 3 16:14:17 CST 2025] Installing full chain to: /etc/uhttpd.crt[Mon Feb 3 16:14:17 CST 2025] Running reload cmd: /etc/init.d/uhttpd restart[Mon Feb 3 16:14:17 CST 2025] Reload successful Configuring SSL Certificates with acme.sh on OpenWRT
https://tski.uk/blog/en/openwrt-acmesh/