Skip to content

Instantly share code, notes, and snippets.

@larstobi
Created November 26, 2024 08:41
Show Gist options
  • Save larstobi/0e3c312b9cb1e8be24e34bd229e140fe to your computer and use it in GitHub Desktop.
Save larstobi/0e3c312b9cb1e8be24e34bd229e140fe to your computer and use it in GitHub Desktop.
if echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | \
openssl x509 -noout -checkend $((30*24*60*60)) >/dev/null; then
echo "Certificate is valid for more than 30 days."
else
echo "Certificate expires in less than 30 days!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment