From 5704302e33a2c916c80d1c721371c733edda1e20 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Thu, 26 Sep 2024 19:21:38 -0600 Subject: [PATCH] check_https_valid: adjust string --- check_https_valid.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/check_https_valid.sh b/check_https_valid.sh index 7312090..d43e5c4 100755 --- a/check_https_valid.sh +++ b/check_https_valid.sh @@ -42,22 +42,22 @@ curl_exit_code=$? if [ $curl_exit_code -ne 0 ]; then case $curl_exit_code in 6) - MSG="Could not resolve host for $url" + MSG="Could not resolve host for \"$url\"" ;; 7) - MSG="Failed to connect to $url" + MSG="Failed to connect to \"$url\"" ;; 35) - MSG="SSL connect error for $url" + MSG="SSL connect error for \"$url\"" ;; 51) - MSG="SSL certificate verification failed for $url" + MSG="SSL certificate verification failed for \"$url\"" ;; 60) - MSG="SSL certificate cannot be authenticated with known CA certificates for $url" + MSG="SSL certificate cannot be authenticated with known CA certificates for \"$url\"" ;; *) - MSG="curl request failed with exit code $curl_exit_code for $url" + MSG="curl request failed with exit code $curl_exit_code for \"$url\"" ;; esac echo "CRITICAL - $MSG" @@ -68,7 +68,7 @@ fi expiration_date=$(echo | openssl s_client -servername "$hostname" -connect "$hostname:$port" 2>/dev/null | openssl x509 -noout -enddate | cut -d "=" -f 2) if [ -z "$expiration_date" ]; then - echo "UNKNOWN - Failed to retrieve SSL certificate expiration date for $url" + echo "UNKNOWN - Failed to retrieve SSL certificate expiration date for \"$url\"" exit 3 fi @@ -76,16 +76,16 @@ expiration_timestamp=$(date -d "$expiration_date" +%s) current_timestamp=$(date +%s) if [ $expiration_timestamp -lt $current_timestamp ]; then - echo "CRITICAL - SSL certificate for $url has expired on $(date -d @$expiration_timestamp)" + echo "CRITICAL - SSL certificate for \"$url\" has expired on $(date -d @$expiration_timestamp)" exit 2 fi days_remaining=$((($expiration_timestamp - $current_timestamp) / (60*60*24))) if [ $days_remaining -lt 30 ]; then - echo "WARNING - SSL certificate for $url is expiring on $(date -d @$expiration_timestamp) ($days_remaining days remaining)" + echo "WARNING - SSL certificate for \"$url\" is expiring on $(date -d @$expiration_timestamp) ($days_remaining days remaining)" exit 1 else - echo "OK - SSL certificate for $url is valid" + echo "OK - SSL certificate for \"$url\" is valid" exit 0 fi