diff --git a/zsh.d/zshfunctions/x509 b/zsh.d/zshfunctions/x509 index 592fd35..6a4e555 100644 --- a/zsh.d/zshfunctions/x509 +++ b/zsh.d/zshfunctions/x509 @@ -1,5 +1,23 @@ -if [ -r "$1" ]; then - openssl x509 -in $1 -noout -text | less -else - echo "x509 " -fi +usage() { + echo "x509 " + echo "x509 -r " + return +} + +[ $# -eq 0 ] && usage + +remote=0 + +while getopts ":hr:" arg; do + case $arg in + r) + remote=1 + host=$OPTARG + ;; + h) usage + ;; + esac +done + +[ $remote -eq 0 ] && openssl x509 -in $* -noout -text +[ $remote -eq 1 ] && openssl s_client -connect $host < /dev/null | openssl x509 -noout -text diff --git a/zsh.d/zshfunctions/x509.zwc b/zsh.d/zshfunctions/x509.zwc index 63ae6ab..05406e2 100644 Binary files a/zsh.d/zshfunctions/x509.zwc and b/zsh.d/zshfunctions/x509.zwc differ