enhance cert expiry process in run_node.sh

This commit is contained in:
Ivan Folgueira Bande 2026-01-09 15:17:38 +01:00
parent 953707988f
commit 08be7d0a44
No known key found for this signature in database
GPG Key ID: 3C117481F89E24A7

View File

@ -63,10 +63,12 @@ if [ -n "${DOMAIN}" ]; then
echo "[INFO] Waiting for a valid TLS certificate for ${DOMAIN}..."
while true; do
MIN_VALIDITY=3600 # 1 hour
if [ ! -f "${CERT}" ] || [ ! -f "${KEY}" ]; then
echo "[INFO] Certificate files not found yet. Waiting..."
elif ! openssl x509 -checkend 0 -noout -in "${CERT}" >/dev/null 2>&1; then
echo "[WARN] Certificate exists but is expired. Waiting for renewal..."
elif ! openssl x509 -checkend "${MIN_VALIDITY}" -noout -in "${CERT}" >/dev/null 2>&1; then
echo "[WARN] Certificate is invalid, expired, or expiring soon. Waiting..."
else
echo "[INFO] Valid TLS certificate detected."
break