diff fullchain

This commit is contained in:
2022-11-09 07:14:25 +00:00
parent e33c7c2d6a
commit 8e6c875d64

View File

@@ -22,41 +22,38 @@ start_letsencrypt() {
fi fi
} }
LETSENCRYPT_FILE=$(find /acme.sh/ -type f -name letsencrypt); check_new_cert() {
if [ -n "$LETSENCRYPT_FILE" ] ; then
DOMAIN=$(jq -r .DOMAIN $LETSENCRYPT_FILE) ;
DATE=$(date +%y%m%d%H)
echo $DATE
start_letsencrypt;
rm $LETSENCRYPT_FILE;
#DATE=$(date +%s)
if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then
#D1=$(date -r /acme.sh/$DOMAIN/fullchain.pem +%s)
if [[ "$(date -r /acme.sh/$DOMAIN/key.pem +%y%m%d%H)" -ge "$DATE" && "$(date -r /acme.sh/$DOMAIN/fullchain.pem +%y%m%d%H)" -ge "$DATE" && "$(date -r /acme.sh/$DOMAIN/cert.pem +%y%m%d%H)" -ge "$DATE" ]] ; then #DIFF=$(expr $DATE - $D1);
#if [ $DIFF < 3600 ]; then touch /acme.sh/$DOMAIN/new_certificate; fi
NEW=$(openssl x509 -in /acme.sh/$DOMAIN/fullchain.pem -fingerprint -noout)
if [ "$ORIGINAL" != "$NEW" ]; then
touch /acme.sh/$DOMAIN/new_certificate; touch /acme.sh/$DOMAIN/new_certificate;
fi
else else
sending_error_msg $DOMAIN $DATE; sending_error_msg $DOMAIN $DATE;
fi fi
fi }
LETSENCRYPT_FILE=$(find /acme.sh/ -type f -name letsencrypt);
if [ -n "$LETSENCRYPT_FILE" ] ; then
DOMAIN=$(jq -r .DOMAIN $LETSENCRYPT_FILE) ;
ORIGINAL=$(openssl x509 -in /acme.sh/$DOMAIN/fullchain.pem -fingerprint -noout)
start_letsencrypt;
rm $LETSENCRYPT_FILE;
check_new_cert
else else
cd /domains cd /domains
for i in `ls` ; do for i in `ls` ; do
DOMAIN=$(jq -r .DOMAIN $i) ; DOMAIN=$(jq -r .DOMAIN $i) ;
DATE=$(date +%y%m%d%H) ORIGINAL=$(openssl x509 -in /acme.sh/$DOMAIN/fullchain.pem -fingerprint -noout)
echo $DATE
start_letsencrypt $DOMAIN; start_letsencrypt $DOMAIN;
if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then check_new_cert
if [[ "$(date -r /acme.sh/$DOMAIN/key.pem +%y%m%d%H)" -ge "$DATE" && "$(date -r /acme.sh/$DOMAIN/fullchain.pem +%y%m%d%H)" -ge "$DATE" && "$(date -r /acme.sh/$DOMAIN/cert.pem +%y%m%d%H)" -ge "$DATE" ]] ; then
touch /acme.sh/$DOMAIN/new_certificate;
else
sending_error_msg $DOMAIN $DATE;
fi
fi
done ; done ;
fi fi