# HG changeset patch # User Tomas Zeman # Date 1377861657 -7200 # Node ID 79eef9a447de2a6729d945a06dd44c86bd0cc3ce # Parent 3f6120005a4025380d4416b441f913c91c187ba6 externalscripts/certificate_expiration-bsd: Certificate expiration check (BSD date(1) variant) as external check (via TCP) diff -r 3f6120005a40 -r 79eef9a447de externalscripts/certificate_expiration-bsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/externalscripts/certificate_expiration-bsd Fri Aug 30 13:20:57 2013 +0200 @@ -0,0 +1,10 @@ +#!/bin/sh + +echo | openssl s_client -connect $1:$2 2>/dev/null | \ +sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' | \ +openssl x509 -enddate | grep notAfter| awk -F= '{print $2}' | \ +while read l; do + t=`date -j -f "%b %d %T %Y %Z" "$l" +%s` + n=`date +%s` + echo `expr $t - $n` +done