Skip to content

Instantly share code, notes, and snippets.

@ifnull
Created May 6, 2021 19:40
Show Gist options
  • Save ifnull/bca9621ef405d973fd85070ce81024e3 to your computer and use it in GitHub Desktop.
Save ifnull/bca9621ef405d973fd85070ce81024e3 to your computer and use it in GitHub Desktop.
Check SSL cert of localhost virtual host by forcing / overriding the server name.
# Solution 1
echo | openssl s_client -showcerts -servername example.com -connect 127.0.0.1:443 2>/dev/null | openssl x509 -inform pem -noout -text
# Solution 2
curl --insecure --resolve example.com:443:127.0.0.1 -vvI https://example.com 2>&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment