Skip to content

Instantly share code, notes, and snippets.

@spangenberg
Created January 18, 2024 16:42
Show Gist options
  • Save spangenberg/cd08ccb29983468cd92bb3f2387e8651 to your computer and use it in GitHub Desktop.
Save spangenberg/cd08ccb29983468cd92bb3f2387e8651 to your computer and use it in GitHub Desktop.
Rotate QNAP TLS Certificate with Tailscale cert
#!/bin/sh
mkdir -p /etc/stunnel/backup
cp --backup=number /etc/stunnel/backup.cert /etc/stunnel/backup.key /etc/stunnel/stunnel.pem /etc/stunnel/backup
$(getcfg -f /etc/config/qpkg.conf Tailscale Install_path)/tailscale cert --cert-file backup.cert --key-file backup.key $(dig @100.100.100.100 +noall +answer +short -x $($(getcfg -f /etc/config/qpkg.conf Tailscale Install_path)/tailscale ip -1) | sed 's/\.$//')
cat /etc/stunnel/backup.key /etc/stunnel/backup.cert > /etc/stunnel/stunnel.pem
/etc/init.d/thttpd.sh restart
/etc/init.d/stunnel.sh restart
/etc/init.d/Qthttpd.sh restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment