diff --git a/run_node.sh b/run_node.sh index 27d1728..3e03b26 100755 --- a/run_node.sh +++ b/run_node.sh @@ -56,6 +56,8 @@ fi if [ -n "${DOMAIN}" ]; then ## A domain has been either set or inferred. Let's try to use it for websocket secure support. + apk add --no-cache openssl + LETSENCRYPT_PATH="/etc/letsencrypt/live/${DOMAIN}" CERT="${LETSENCRYPT_PATH}/fullchain.pem" KEY="${LETSENCRYPT_PATH}/privkey.pem" @@ -63,12 +65,10 @@ 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 "${MIN_VALIDITY}" -noout -in "${CERT}" >/dev/null 2>&1; then - echo "[WARN] Certificate is invalid, expired, or expiring soon. Waiting..." + elif ! openssl x509 -checkend 0 -noout -in "${CERT}" >/dev/null 2>&1; then + echo "[WARN] Certificate exists but is expired. Waiting for renewal..." else echo "[INFO] Valid TLS certificate detected." break