matteocorti / check_ssl_cert

A shell script (that can be used as a Nagios/Icinga plugin) to check an SSL/TLS connection.
GNU General Public License v3.0
368 stars 132 forks source link

Not all of the last 24 hours is necessarily today #375

Closed peternewman closed 2 years ago

peternewman commented 2 years ago

Describe the bug

Since: https://github.com/matteocorti/check_ssl_cert/commit/d6aa200cbabc702daea207337d33fbf19be0162d

"is expired (was valid until Apr 17 18:19:20 2022 GMT, today)" However I'm writing this on: Mon 18 Apr 2022

I'd argue that it was valid until Apr 17th, yesterday, and it would only be today since midnight.

To Reproduce

Check an expired certificate which expired in the last 24 hours, but before midnight.

I was going to try and add a test but it seemed a bit fiddly to do...

Expected behavior

"is expired (was valid until Apr 17 18:19:20 2022 GMT, yesterday)"

I'm aware there's a whole world of pain around timezones etc, so maybe changing it to say "last 24 hours"/"last 48 hours" might be easier?

System (please complete the following information):

matteocorti commented 2 years ago

I agree, for a correct behaviour I should also consider time zones, and on some platforms, it could be a nightmare. I will follow your suggestion and keep it simple.