mirror of
https://github.com/akelge/zsh
synced 2025-07-03 13:09:07 +00:00
Change x509 function to work local and remote
This commit is contained in:
@ -1,5 +1,23 @@
|
||||
if [ -r "$1" ]; then
|
||||
openssl x509 -in $1 -noout -text | less
|
||||
else
|
||||
echo "x509 <certfile>"
|
||||
fi
|
||||
usage() {
|
||||
echo "x509 <certfile>"
|
||||
echo "x509 -r <hostname:port>"
|
||||
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
|
||||
|
Reference in New Issue
Block a user