Check certificate end date Macro (v11.0.4)
I'm not sure what rules are here for putting own macros, but maybe my small solution will be usable for someone.
The idea is to check and display validity dates for certificates from set of hosts (included in macro). I maintain a few small VPS and use LetsEncrypt to generate certificates. Most of them use mechanism like cron to refresh certificates but sometime that automation fails. So I thought that it is good occasion to learn more about KM and build some small tool.
Certificate is taken directly from the service (using openssl s_client) and analysed by openssl x509 . Because date of validity is formatted in very specific way, I have to analyse it and convert for further processing. The certificates could be also checked on other services (f.ex.mail's protocols: IMAP or POP), that's why specifying port is also possible.
The result is displayed in window in form:
- 77 days wiki.keyboardmaestro.com:443
243 days www.wp.pl:443
284 days www.onet.pl:443
The character '*' prefix the line where number of days to the end is less than 90 (defined by variable local_WarnPeriod),
Im very fresh adept of KM so please be understanding.
The trigger is not defined, but in my environment it its connected to the cron.