diff --git a/ssl-check.sh b/ssl-check.sh index 5cc6e5e7..f1b69d05 100755 --- a/ssl-check.sh +++ b/ssl-check.sh @@ -330,6 +330,46 @@ set_summary() fi } +########################################## +# Purpose: Describe how the script works +# Arguments: +# None +########################################## +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 "" + 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 " -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 " -t type : Specify the certificate type" + echo " -q : Don't print anything on the console" + echo " -v : Specify a specific protocol version to use (tls, ssl2, ssl3)" + echo " -V : Only print validation data" + echo " -x days : Certificate expiration interval (eg. if cert_date < days)" + echo "" +} + + +########################################################################## +# Purpose: Connect to a server ($1) and port ($2) to see if a certificate +# has expired +# Arguments: +# $1 -> Server name +# $2 -> TCP port to connect to +########################################################################## check_server_status() { if [ "_${2}" = "_smtp" -o "_${2}" = "_25" ] @@ -586,4 +626,4 @@ fi rm -f ${CERT_TMP} ${ERROR_TMP} -exit 0 \ No newline at end of file +exit 0