Skip to content

Instantly share code, notes, and snippets.

@fionn
Last active July 8, 2022 13:08
Show Gist options
  • Save fionn/77d23f2a11c87b2dba162854ed638abe to your computer and use it in GitHub Desktop.
Save fionn/77d23f2a11c87b2dba162854ed638abe to your computer and use it in GitHub Desktop.
Server name
#!/bin/bash
set -euo pipefail
echo | openssl s_client -servername "$1" -connect "$1":443 2>/dev/null | openssl x509 -noout -text | grep -A 1 "X509v3 Subject Alternative Name:" | grep "DNS:" | tr -d "DNS:" | tr -d " " | tr "," "\n"
#!/bin/bash
set -euo pipefail
echo | openssl s_client -servername "$1" -connect "$1":443 2>/dev/null | openssl x509 -noout -subject | sed -n "s/subject=.*CN *= *//p"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment