Matty9191 / ssl-cert-check

Send notifications when SSL certificates are about to expire.
GNU General Public License v2.0
736 stars 289 forks source link

Robust cert file handling #133

Open lwsystems opened 1 year ago

lwsystems commented 1 year ago

The format of the cert file given with parameter -f is a little bit strict and must be

^<hostname><whitespace><blank>[<blank>,]<portnum>$

If one paste hostname and/or port, a blank could be added by mistake before the end of line or DOS line endings with ( could be added. In this situations, the call of ssl-cert-check will be fail with weird errors. It would be useful, ssl-cert-check cleans the line before parsing like this:

--- ssl-cert-check 2023-10-09 17:52:21.955896376 +0200 +++ ssl-cert-check.robust 2023-10-09 17:52:35.595892084 +0200 @@ -917,6 +917,7 @@ IFS=$'\n' for LINE in $(grep -E -v '(^#|^$)' "${SERVERFILE}") do

Best regards, Martin