Skip to content

Commit

Permalink
add more ssl commands
Browse files Browse the repository at this point in the history
  • Loading branch information
anlutro committed Feb 1, 2024
1 parent 327fcf1 commit 145c9d3
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions configs/shell/shrc.d/misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,25 @@ function whatsmyip {
dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com
}

# check ssl dates
# openssl convenience wrappers
function ssl-connect {
host=$(echo "$1" | cut -d: -f1)
port=$(echo "$1" | grep -F : | cut -d: -f2)
cmd="echo -n Q | openssl s_client -connect \"${host}:${port:-443}\" -servername \"$host\""
echo "$cmd"
eval "$cmd"
}
function ssl-cert {
host=$(echo "$1" | cut -d: -f1)
port=$(echo "$1" | grep -F : | cut -d: -f2)
cmd="echo -n Q | openssl s_client -connect \"${host}:${port:-443}\" -servername \"$host\" 2>/dev/null | openssl x509"
echo "$cmd"
eval "$cmd"
}
function ssl-dates {
cmd="echo -n Q | openssl s_client -connect \"${1}:${2-443}\" -servername \"$1\" 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName -dates"
host=$(echo "$1" | cut -d: -f1)
port=$(echo "$1" | grep -F : | cut -d: -f2)
cmd="echo -n Q | openssl s_client -connect \"${host}:${port:-443}\" -servername \"$host\" 2>/dev/null | openssl x509 -noout -subject -ext subjectAltName -dates"
echo "$cmd"
eval "$cmd"
}

0 comments on commit 145c9d3

Please sign in to comment.