Automate non-ACME TLS cert renewals? (Tailscale cert)

A year in and I’m still thrilled with TrueNAS Scale!

… but need help sorting out one thing, please.

I use Tailscale to security access my TrueNAS Scale from anywhere, but the TLS (HTTPS) certificates which Tailscale generates keep expiring, and a script I wrote which renews the certs doesn’t work correctly.

My script to renew TLS certs is:

sudo docker exec -it ix-tailscale-tailscale-1 sh -c 'tailscale cert --cert-file /etc/certificates/tailscale.crt --key-file /etc/certificates/tailscale.key xxxxxx.ts.net'
sudo chmod 666 /etc/certificates/tailscale.*

… which effectively uses docker to ask the tailscale app to renew the TLS certificates and write them out to TrueNAS’s /etc/certificates folder.

Here’s the rub: The system doesn’t pick up that these files have been updated. It’s kinda like TrueNAS is secretly keeping private copies of the old certs elsewhere.

I’ve tried using the deprecated cli system certificates command, but not getting joy there either.

What is the correct way to automate certificate renewals when not using an ACME?

Not secretly at all; everything is stored in the config database.

Using the API. A couple of tools to do this include:

and

Both of these are intended for ACME certs, but they’ll work for any valid cert.

Dan, you’re a legend! Thank you!

I use certbot on my web server to renew my lets encrypt certificate. certbot provides a deploy hook feature. So I’ve installed a custom shell script in the certbot deployment hooks directory on my web server. Whenever my certificate renews, certbot calls the shell script which uses “tnascert-deploy” to automate the installation and UI restart of my two TrueNAS scale instances. tnascert-deploy supports TrueNAS scale versions 25 (fangtooth) and later. For earlier versions of TrueNAS, you’ll need to use the deploy_freenas.py script mentioned by @dan

A binary releases for Windows, MacOS, FreeBSD, and linux are available for download at:

tnascert-deploy version 1.2

The main Github repository with source and documentation is available at:

tnascert-deploy Git Repository