Skip to content

Commit

Permalink
Added -p option to cert-checker.
Browse files Browse the repository at this point in the history
  • Loading branch information
rexberg committed Nov 21, 2022
1 parent 31f4615 commit 39f899e
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .local/bin/cert-checker
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,27 @@
#
# Dependency: openssl

usage(){ printf "Usage: %s example.com\n" "$0"; }
usage(){ printf "Usage: %s [OPTION]... example.com\n\nRequire argument\n\n\t-p\tPORT\t(default: 443)\n\n" "$0"; }

# Handle flags and operators.
while getopts p:h flags; do
case $flags in
p)
PORT=${OPTARG}
;;
h)
usage
exit 0
;;
\?)
usage
exit 1
;;
esac
done

shift $((OPTIND-1))

[ $# -ne 1 ] && usage && exit 1

echo | openssl s_client -servername NAME -connect "$1":443 2>/dev/null | openssl x509 -text 2>/dev/null
echo | openssl s_client -servername NAME -connect "$1":${PORT:-443} 2>/dev/null | openssl x509 -text 2>/dev/null

0 comments on commit 39f899e

Please sign in to comment.