adding cert checks

This commit is contained in:
silversword411 2021-09-09 12:56:16 -04:00
parent df44f8f5f8
commit 83d7a03ba4
1 changed files with 22 additions and 0 deletions

View File

@ -68,6 +68,12 @@ else
exit exit
fi fi
while [[ $domain != *[.]* ]]
do
echo -ne "${YELLOW}Enter yourdomain used for letsencrypt (e.g. example.com)${NC}: "
read domain
done
echo -ne ${YELLOW} Checking IPs | tee -a checklog.log echo -ne ${YELLOW} Checking IPs | tee -a checklog.log
printf >&2 "\n\n" printf >&2 "\n\n"
@ -243,6 +249,22 @@ else
printf >&2 "\n\n" printf >&2 "\n\n"
fi fi
echo -ne ${YELLOW} Checking SSL Certificate is up to date | tee -a checklog.log
printf >&2 "\n\n"
#SSL Certificate check
cert=$(openssl verify -CAfile /etc/letsencrypt/live/$domain/chain.pem /etc/letsencrypt/live/$domain/cert.pem)
if [[ "$cert" == *"OK"* ]]; then
echo -ne ${GREEN} SSL Certificate for $domain is fine | tee -a checklog.log
printf >&2 "\n\n"
else
echo -ne ${RED} SSL Certificate has expired or doesnt exist for $domain | tee -a checklog.log
printf >&2 "\n\n"
fi
printf >&2 "\n\n" printf >&2 "\n\n"
echo -ne ${YELLOW} echo -ne ${YELLOW}
printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n" printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"