Keep existing cert while it is still valid

Letsencrypt has some hiccups sometimes during renewals. Instead of instantly replacing a still valid cert with a self-signed, it should be kept, while it hasn't expired
This commit is contained in:
Johannes Feichtner
2022-12-03 23:53:11 +01:00
parent cbe7fd719f
commit a58778311d

View File

@@ -98,6 +98,8 @@ if [ -n "$CERT" ] ; then
cp -p "$LOCALDIR/$KEY" "$VMWARE_KEY"
cp -p "$LOCALDIR/$CRT" "$VMWARE_CRT"
log "Success: Obtained and installed a certificate from Let's Encrypt."
elif openssl x509 -checkend 86400 -noout -in "$VMWARE_CRT"; then
log "Warning: No cert obtained from Let's Encrypt. Keeping the existing one as it is still valid."
else
log "Error: No cert obtained from Let's Encrypt. Generating a self-signed certificate."
/sbin/generate-certificates