From b6ed710d8b0a5622fc44f13a662f3bedf3cbaf38 Mon Sep 17 00:00:00 2001 From: Rod Wright Date: Sun, 19 Jul 2026 10:52:46 -0400 Subject: [PATCH] Initial commit --- usr/local/bin/update-letsencrypt-certs | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 usr/local/bin/update-letsencrypt-certs diff --git a/usr/local/bin/update-letsencrypt-certs b/usr/local/bin/update-letsencrypt-certs new file mode 100644 index 0000000..30abad9 --- /dev/null +++ b/usr/local/bin/update-letsencrypt-certs @@ -0,0 +1,29 @@ +#!/bin/bash + +# update-letsencrypt-certs +# Pull SSL certificates form a certificate host and restart +# servers as necessary. +# 7/19/2026 Rod Wright + +# Set the host from which certificates will be pulled +cert_host="portal.thermionic.net" + +# Set which http server to restart +#http_server="nginx" +#http_server="apache2" +http_server="pveproxy" + +if rsync -aL --info=stats2 root@$cert_host:/etc/letsencrypt/live/thermionic.net/ /etc/ssl/thermionic.net/ |grep -q "Number of regular files transferred: 0"; then http_server_restart=false; else http_server_restart=true; fi + +if [ "$http_server" = "pveproxy" ] +then + cp -f /etc/ssl/thermionic.net/fullchain.pem /etc/pve/local/pveproxy-ssl.pem + cp -f /etc/ssl/thermionic.net/privkey.pem /etc/pve/local/pveproxy-ssl.key +fi + +if $http_server_restart; then + echo "New certs downloaded. Restarting $http_server." + systemctl restart $http_server +else + echo "Certs are up to date. $http_server restart not required." +fi