Out of the box, ACME in OpenWrt will not talk to your local ACME Server (i.e., StepCA). You can change it by amending the script under /usr/lib/acme/run-acme
. Find the subroutine called issue_cert(). In 19.07 it looked like below:
issue_cert()
{
local section="$1"
...
In that subroutine you need to add about 9 lines:
local server
local cabundle
local renewal_days
config_get server "$section" server
config_get cabundle "$section" cabundle
config_get renewal_days "$section" renewal_days
[ -n "$cabundle" ] && acme_args="$acme_args --ca-bundle $cabundle"
[ -n "$server" ] && acme_args="$acme_args --server $server"
[ -n "$renewal_days" ] && acme_args="$acme_args --days $renewal_days"
With these 9 lines you're extending the acme_args
with content from your etc/config/acme
config file. Make sure you add those 9 lines before the acme_args
are being used. I put mine right after this line:
[ "$DEBUG" -eq "1" ] && acme_args="$acme_args --debug"
Now, open the /etc/config/acme
config file and set enabled
to 1
. At the same time, set the 3 new options you parsed into acme_args
with your 9 lines above:
option enabled '1'
option server 'https://your.local.acme.server.url:8443/acme/weekly/directory'
option cabundle '/etc/ssl/certs/yourcabundle.pem'
option renewal_days '3'
The ACME package sets up a cron job (/etc/crontab/root) that runs every midnight. In case it did already run, please delete all contents underneath /etc/acme/ and re-run the script:
root@OpenWrt:~# rm -rf /etc/acme/*
root@OpenWrt:~# /usr/lib/acme/run-acme
Now, change the config at /etc/config/uhttpd so that redirection of all HTTP traffic to HTTPS is enabled and so that uhttpd listens to port 443:
option redirect_https '1'
option listen_https '0.0.0.0:443'
Finally, reload the uhttpd daemon:
root@OpenWrt:~# /etc/init.d/uhttpd reload