summaryrefslogtreecommitdiffstats
path: root/scripts/certs/cert-check
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-04-15 13:21:48 +0200
committerJan Pokorný <jpokorny@redhat.com>2013-04-15 13:30:03 +0200
commit4ae2d925fd025968286242b0b2ec3819f5609c4f (patch)
treea15603372284516e9a33bba90a25aa0dbc82341a /scripts/certs/cert-check
parent3efa7cbe18a1154c248a5ec910cc2a24d2cc33bd (diff)
downloaddotfiles-4ae2d925fd025968286242b0b2ec3819f5609c4f.tar.gz
dotfiles-4ae2d925fd025968286242b0b2ec3819f5609c4f.tar.xz
dotfiles-4ae2d925fd025968286242b0b2ec3819f5609c4f.zip
Cert scripts: backup on import, check passes extra options
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'scripts/certs/cert-check')
-rwxr-xr-xscripts/certs/cert-check6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/certs/cert-check b/scripts/certs/cert-check
index 88a6fb2..5c50a1f 100755
--- a/scripts/certs/cert-check
+++ b/scripts/certs/cert-check
@@ -83,9 +83,11 @@ cert_pick_from_server() {
echo "Trying from server.." >&2
local server=$1
local port=443 # https
- [ $# -ge 2 ] && port=$2
+ local opts=
+ [ $# -ge 2 ] && [[ "${2}" =~ ^[^-].* ]] && shift && port=$1
+ [ $# -ge 2 ] && opts=$2
( echo; sleep 2 ) \
- | openssl s_client -connect "${server}:${port}" -crlf 2>/dev/null \
+ | openssl s_client -connect "${server}:${port}" -crlf $opts 2>/dev/null \
| sed -ne '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' \
| awk '/-BEGIN CERTIFICATE-/{if(++i > 1){exit;}}{print;}'
}