Skip to content
Snippets Groups Projects
Commit e07de733 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add check_ssl_certs

parent 3f794c2e
No related branches found
No related tags found
No related merge requests found
......@@ -112,7 +112,7 @@ for mycert in $( ls -1 $filelist 2>/dev/null )
do
iCounter=$iCounter+1
data=$(openssl x509 -noout -text -in $mycert 2>/dev/null )
mySubject=$( echo "$data" | grep "Subject:\ CN\ =\ " | cut -f 2- -d "=" | grep -v ",")
mySubject=$( echo "$data" | grep "Subject:\ CN\ =\ " | grep -v "," | cut -f 2- -d "=" | cut -c 2- )
if [ -z "$mySubject" ]; then
bHasWarning=true
fullstatus="${fullstatus}
......@@ -124,8 +124,8 @@ do
typeset -i iExpire=$( date +%s -d "$dateExpire" )
typeset -i iLeft=($iExpire-$iNow)/60/60/24
if [ $iLeft -lt $iWarn ]; then
if [ $iLeft -lt $iCrit ]; then
if [ $iLeft -le $iWarn ]; then
if [ $iLeft -le $iCrit ]; then
bHasCritical=true
if [ $iLeft -lt 0 ]; then
result="EXPIRED ALREADY"
......@@ -141,7 +141,7 @@ do
fi
shortstatus="${shortstatus}${result} ${mySubject} [${iLeft}d] | "
fullstatus="${fullstatus}
----- $iCounter/ $iTotal: ${mySubject} - $iLeft days
----- [$iCounter of $iTotal] ${mySubject} - expires in $iLeft days
$( echo "$data" | grep -E "(DNS:|Issuer:|Not\ |Subject:)" | sed 's#^\ *##g')
File: $mycert
"
......@@ -164,7 +164,7 @@ fi
ph.status "SSL certs | $shortstatus"
echo "$fullstatus"
echo "INFO: warning below $iWarn d before expiration; raise to critical $iCrit days before"
echo "INFO: warning starts $iWarn d before expiration, raising to critical $iCrit days before"
echo
ph.exit
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment