1
0
Fork 0

showcert: allow port selection

This commit is contained in:
Vladimír Dudr 2024-01-01 13:30:53 +01:00
parent 5f325914b9
commit d08429d16c

View file

@ -2,6 +2,8 @@
[[ -z $1 ]] && { echo "where to get the cert?" >&2; exit 1; }
PORT=${2:-443}
fetch() {
if [[ $1 == "-" ]]
then
@ -15,7 +17,7 @@ fetch() {
}
fetch_remote() {
: | openssl s_client -connect $1:443 2>/dev/null| awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/'
: | openssl s_client -connect $1:${PORT} 2>/dev/null| awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/'
}
fetch_file() {