From d08429d16c45aff999cbfdf93fca2ef847b61b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Dudr?= Date: Mon, 1 Jan 2024 13:30:53 +0100 Subject: [PATCH] showcert: allow port selection --- bin/executable_showcert | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/executable_showcert b/bin/executable_showcert index 3ecb4bd..88d7841 100644 --- a/bin/executable_showcert +++ b/bin/executable_showcert @@ -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() {