externalscripts/certificate_expiration-file-bsd
authorTomas Zeman <tzeman@volny.cz>
Wed, 07 Nov 2018 08:41:06 +0100
changeset 37 968d93e43326
parent 36 9db9af459e7b
child 38 1eada2e65e7a
externalscripts/certificate_expiration-file-bsd
externalscripts/certificate_expiration-file-bsd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/externalscripts/certificate_expiration-file-bsd	Wed Nov 07 08:41:06 2018 +0100
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+openssl x509 -in $1 -enddate -noout | 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