diff --git a/troubleshoot_server.sh b/troubleshoot_server.sh index 8d169a4a..ffa99aa0 100644 --- a/troubleshoot_server.sh +++ b/troubleshoot_server.sh @@ -68,6 +68,12 @@ else exit 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 printf >&2 "\n\n" @@ -243,6 +249,22 @@ else printf >&2 "\n\n" 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" echo -ne ${YELLOW} printf >&2 "You will have a log file called checklog.log in the directory you ran this script from\n\n"