From 52ecd33e3b1ad6b8eb2faeb4a90e9eb1b470efb8 Mon Sep 17 00:00:00 2001 From: Anthony Wood Date: Wed, 31 Jul 2019 15:41:24 -0400 Subject: [PATCH 1/2] Fix getopt argument for -S flag --- ssl-cert-check | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ssl-cert-check b/ssl-cert-check index 242e14d..f4ee17e 100755 --- a/ssl-cert-check +++ b/ssl-cert-check @@ -793,7 +793,7 @@ check_file_status() { ################################# ### Start of main program ################################# -while getopts abinNv:e:E:f:c:d:hk:p:s:S:t:qx:V option +while getopts abinNv:e:E:f:c:d:hk:p:s:St:qx:V option do case "${option}" in a) ALARM="TRUE";; @@ -801,7 +801,7 @@ do c) CERTFILE=${OPTARG};; d) CERTDIRECTORY=${OPTARG};; e) ADMIN=${OPTARG};; - E) SENDER=${OPTARG};; + E) SENDER=${OPTARG};; f) SERVERFILE=$OPTARG;; h) usage exit 1;; @@ -817,8 +817,7 @@ do q) QUIET="TRUE";; v) VERSION=$OPTARG;; V) echo "${PROGRAMVERSION}" - exit 0 - ;; + exit 0;; x) WARNDAYS=$OPTARG;; \?) usage exit 1;; From 015b72cdd49296fa96ad2021bf990bfa355e2f98 Mon Sep 17 00:00:00 2001 From: Anthony Wood Date: Wed, 31 Jul 2019 15:48:59 -0400 Subject: [PATCH 2/2] Cleanup and correct usage summary --- ssl-cert-check | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ssl-cert-check b/ssl-cert-check index f4ee17e..baa48cb 100755 --- a/ssl-cert-check +++ b/ssl-cert-check @@ -608,26 +608,26 @@ set_summary() usage() { echo "Usage: $0 [ -e email address ] [-E sender email address] [ -x days ] [-q] [-a] [-b] [-h] [-i] [-n] [-N] [-v]" - echo " { [ -s common_name ] && [ -p port] } || { [ -f cert_file ] } || { [ -c cert file ] } || { [ -d cert dir ] }" + echo " { [ -s common_name ] && [ -p port] } || { [ -f cert_file ] } || { [ -c cert_file ] } || { [ -d cert_dir ] }" echo "" echo " -a : Send a warning message through E-mail" echo " -b : Will not print header" - echo " -c cert file : Print the expiration date for the PEM or PKCS12 formatted certificate in cert file" - echo " -d cert directory : Print the expiration date for the PEM or PKCS12 formatted certificates in cert directory" - echo " -e E-mail address : E-mail address to send expiration notices" - echo " -E E-mail sender : E-mail address of the sender" - echo " -f cert file : File with a list of FQDNs and ports" + echo " -c file : Print the expiration date for the PEM or PKCS12 formatted certificate in cert file" + echo " -d directory : Print the expiration date for the PEM or PKCS12 formatted certificates in cert directory" + echo " -e address : E-mail address to send expiration notices" + echo " -E sender : E-mail address of the sender" + echo " -f file : File with a list of FQDNs and ports" echo " -h : Print this screen" echo " -i : Print the issuer of the certificate" echo " -k password : PKCS12 file password" echo " -n : Run as a Nagios plugin" echo " -N : Run as a Nagios plugin and output one line summary (implies -n, requires -f or -d)" echo " -p port : Port to connect to (interactive mode)" - echo " -s commmon name : Server to connect to (interactive mode)" + echo " -s fqdn : Server to connect to (interactive mode)" echo " -S : Print validation information" - echo " -t type : Specify the certificate type" + echo " -t type : Specify the certificate type (DER, PEM)" echo " -q : Don't print anything on the console" - echo " -v : Specify a specific protocol version to use (tls, ssl2, ssl3)" + echo " -v ver : Specify a specific protocol version to use (tls, ssl2, ssl3)" echo " -V : Print version information" echo " -x days : Certificate expiration interval (eg. if cert_date < days)" echo ""