Created
October 5, 2017 22:44
-
-
Save mikedotexe/b12de6d87be14e047bd2f78864e9fe72 to your computer and use it in GitHub Desktop.
Script to list Laravel Forge SSL cert expirations by site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
printf "%-50s | %-25s\n" "SITE" "EXPIRES" | |
echo "-------------------------------------------------------------------" | |
for site in `grep -hR "ssl_certificate /etc/nginx/" /etc/nginx/sites-enabled/|awk '/ssl_certificate/ {print $2}'`; do | |
sitename="$(echo $site | awk -F/ '{print $5}')" | |
expire="$(sudo openssl x509 -enddate -noout -in ${site::-1}|awk -F= '/notAfter=/ {print $2}')" | |
printf "%-50s | %-25s\n" "$sitename" "$expire" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment