externalscripts/certificate_expiration-bsd
author Tomas Zeman <tzeman@volny.cz>
Mon, 07 Apr 2014 14:54:26 +0200
changeset 32 e119fde089b8
parent 30 79eef9a447de
permissions -rwxr-xr-x
scripts/mfi_status

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