From 4ae2d925fd025968286242b0b2ec3819f5609c4f Mon Sep 17 00:00:00 2001 From: Jan Pokorný Date: Mon, 15 Apr 2013 13:21:48 +0200 Subject: Cert scripts: backup on import, check passes extra options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- scripts/certs/cert-check | 6 ++++-- scripts/certs/cert-import | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts') 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;}' } diff --git a/scripts/certs/cert-import b/scripts/certs/cert-import index 7e23d32..062d3d3 100755 --- a/scripts/certs/cert-import +++ b/scripts/certs/cert-import @@ -14,6 +14,7 @@ cert_import_homebundle() { [ "$1" != "1" ] && return echo "Adding to homebundle" >&2 mkdir -p "$(dirname ${HOMEBUNDLE})" + cp ${HOMEBUNDLE}{,$(date '+%y%m%d%H%M%s')} cat >>${HOMEBUNDLE} } @@ -21,6 +22,7 @@ cert_import_mutt() { [ "$1" != "1" ] && return echo "Adding to mutt" >&2 mkdir -p "$(dirname ${MUTT_CERTIFICATES})" + cp ${MUTT_CERTIFICATES}{,$(date '+%y%m%d%H%M%s')} cat >>${MUTT_CERTIFICATES} } -- cgit