changes 4

This commit is contained in:
Andrea Mistrali 2021-11-23 17:49:14 +01:00
parent 863abe744e
commit ec0eab3b21
No known key found for this signature in database
GPG Key ID: 6FB0A77F6D5DA9B2
2 changed files with 23 additions and 5 deletions

View File

@ -1,10 +1,12 @@
usage() {
echo "x509 <certfile>"
echo "x509 -r <hostname:port>"
return 0
}
[ $# -eq 0 ] && return 0
if [ $# -eq 0 ]; then
usage
return 0
fi
help=0
remote=0
@ -19,6 +21,22 @@ while getopts ":hr:" arg; do
;;
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
if [ $help -eq 1 ]; then
usage
return 0
fi
if [ $remote -eq 0 ]; then
if [ -f $* ]; then
openssl x509 -in $* -noout -text
else
echo "$* not found"
usage
return 0
fi
else
openssl s_client -connect $host < /dev/null | openssl x509 -noout -text
fi
# vim: set ts=2 sw=2 tw=0 ft=sh :

Binary file not shown.