This will configure an Asustor NAS to use a Let's Encrypt certificate without exposing it to the internet.
To achieve this, we use Certbot with the DNS-01 challenge via Cloudflare.
I'm placing my configuration in
/volume1/system. Feel free to change this to whatever location you prefer.
- Set up Cloudflare credentials.
mkdir /volume1/system/letsencrypt
touch /volume1/system/letsencrypt/cloudflare.ini
chown root:root /volume1/system/letsencrypt
chmod 700 /volume1/system/letsencrypt
chmod 600 /volume1/system/letsencrypt/cloudflare.iniAdd your Cloudflare API key to cloudflare.ini as described here:
https://certbot-dns-cloudflare.readthedocs.io/en/stable/#credentials
-
Place
install.shandadm-deploy.shin/volume1/system/letsencrypt -
Run
install.shto setup pip and certbot-dns-cloudflare. -
Link
adm-deploy.shto letsencrypt deploy hook.
ln -s /volume1/system/letsencrypt/adm-deploy.sh /volume0/usr/builtin/etc/letsencrypt/renewal-hooks/deploy/- Generate the certificate.
Make sure to changenas.mydomain.cominadm-deploy.shand in the below command to your FQDN
certbot certonly --config-dir=/volume0/usr/builtin/etc/letsencrypt \
--dns-cloudflare --dns-cloudflare-credentials /volume1/system/letsencrypt/cloudflare.ini \
--preferred-challenges dns-01 \
-d nas.mydomain.com- Add renew to crontab, run
crontab -eas root.
@reboot /volume1/system/letsencrypt/install.sh && /usr/bin/certbot --config-dir=/volume0/usr/builtin/etc/letsencrypt renew
0 6 * * * /usr/bin/certbot --config-dir=/volume0/usr/builtin/etc/letsencrypt renew
Working as expected thanks ! :)
To note; the path
/volume1/systemis not existing on my asustor.Dropped files to
/volume0/usr/builtin/etc/letsencryptfor the moment.