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

update for newer openssl version; update help

parent 38732040
No related branches found
No related tags found
1 merge request!257Update for newer openssl
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
# 2021-10-06 v0.1 <axel.hahn@iml.unibe.ch> initial version # 2021-10-06 v0.1 <axel.hahn@iml.unibe.ch> initial version
# 2022-03-16 v0.2 <axel.hahn@iml.unibe.ch> shell fixes; shorten perfdata label # 2022-03-16 v0.2 <axel.hahn@iml.unibe.ch> shell fixes; shorten perfdata label
# 2022-10-21 v1.3 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # 2022-10-21 v1.3 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space
# 2024-04-24 v1.4 <axel.hahn@unibe.ch> update for newer openssl version; update help
# ====================================================================== # ======================================================================
. $(dirname $0)/inc_pluginfunctions . $(dirname $0)/inc_pluginfunctions
self_APPVERSION=1.4
typeset -i iWarn=14 typeset -i iWarn=14
typeset -i iCrit=5 typeset -i iCrit=5
...@@ -36,15 +38,11 @@ myDomain=".iml.unibe.ch" ...@@ -36,15 +38,11 @@ myDomain=".iml.unibe.ch"
# functions # functions
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# show help text
function showHelp(){ function showHelp(){
local _self; _self=$(basename $0)
cat <<EOF cat <<EOF
______________________________________________________________________ $( ph.showImlHelpHeader )
CHECK_SSL_CERTS
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
______________________________________________________________________
Check locally installed SSL client certificates and warn if the Check locally installed SSL client certificates and warn if the
expiration date comes closer. expiration date comes closer.
...@@ -118,7 +116,7 @@ for mycert in $( ls -1 $filelist 2>/dev/null ) ...@@ -118,7 +116,7 @@ for mycert in $( ls -1 $filelist 2>/dev/null )
do do
iCounter=$iCounter+1 iCounter=$iCounter+1
data=$(openssl x509 -noout -text -in $mycert 2>/dev/null ) data=$(openssl x509 -noout -text -in $mycert 2>/dev/null )
mySubject=$( echo "$data" | grep "Subject: CN = " | grep -v "," | cut -f 2- -d "=" | cut -c 2- ) mySubject=$( echo "$data" | grep "Subject: CN *= *" | grep -v "," | cut -f 2- -d "=" | tr -d ' ' )
mySubject2="${mySubject//${myDomain}}" mySubject2="${mySubject//${myDomain}}"
if [ -z "$mySubject" ]; then if [ -z "$mySubject" ]; then
...@@ -149,7 +147,7 @@ do ...@@ -149,7 +147,7 @@ do
fi fi
shortstatus="${shortstatus}${result} ${mySubject} [${iLeft}d] ; " shortstatus="${shortstatus}${result} ${mySubject} [${iLeft}d] ; "
fullstatus="${fullstatus} fullstatus="${fullstatus}
----- [$iCounter of $iTotal] ${mySubject} - expires in $iLeft days $mySubject2 ----- [$iCounter of $iTotal] ${mySubject} - expires in $iLeft days
$( echo "$data" | grep -E "(DNS:|Issuer:|Not |Subject:)" | sed 's#^ *##g') $( echo "$data" | grep -E "(DNS:|Issuer:|Not |Subject:)" | sed 's#^ *##g')
File: $mycert File: $mycert
" "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment