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