externalscripts/certificate_expiration-bsd
author Tomas Zeman <tzeman@volny.cz>
Fri, 27 Dec 2013 10:18:15 +0100
changeset 31 50abf2d64158
parent 30 79eef9a447de
permissions -rwxr-xr-x
conf/pkg-audit.conf: pkg audit counterpart to portaudit

#!/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