Skip to content

Instantly share code, notes, and snippets.

@markuskreitzer
Created April 10, 2025 15:38
Show Gist options
  • Save markuskreitzer/e9093e5e886f5e3830eadb12b2c8b283 to your computer and use it in GitHub Desktop.
Save markuskreitzer/e9093e5e886f5e3830eadb12b2c8b283 to your computer and use it in GitHub Desktop.
Get SSL certs using OpenSSL and sed

You can use the following syntax:

getcerts google.com 443
getcerts google.com

Place the following line in your aliases file:

alias getcerts='function _getcerts() { echo | openssl s_client -connect "${1}:${2:-443}" | sed -n "/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p"; }; _getcerts '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment