1
0
mirror of https://github.com/akelge/zsh synced 2025-07-03 13:09:07 +00:00
Files
zsh/zsh.d/zshfunctions/x509
2021-11-23 17:43:43 +01:00

25 lines
440 B
Plaintext

usage() {
echo "x509 <certfile>"
echo "x509 -r <hostname:port>"
return 0
}
[ $# -eq 0 ] && return 0
help=0
remote=0
while getopts ":hr:" arg; do
case $arg in
r)
remote=1
host=$OPTARG
;;
h|*) help=1
;;
esac
done
[ $help -eq 1 ] && usage && return 0
[ $remote -eq 0 ] && openssl x509 -in $* -noout -text
[ $remote -eq 1 ] && openssl s_client -connect $host < /dev/null | openssl x509 -noout -text