Skip to content

Instantly share code, notes, and snippets.

@mikedotexe
Created October 5, 2017 22:44
Show Gist options
  • Save mikedotexe/b12de6d87be14e047bd2f78864e9fe72 to your computer and use it in GitHub Desktop.
Save mikedotexe/b12de6d87be14e047bd2f78864e9fe72 to your computer and use it in GitHub Desktop.
Script to list Laravel Forge SSL cert expirations by site
#!/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