From b498e0ba314cb987a6bb5704a808207df1bd70b7 Mon Sep 17 00:00:00 2001 From: David Todd Date: Fri, 25 Oct 2019 12:59:21 -0500 Subject: [PATCH] add script to determine ssl certificates expiry --- .bin/cert_expiry | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 .bin/cert_expiry diff --git a/.bin/cert_expiry b/.bin/cert_expiry new file mode 100755 index 0000000..63f6919 --- /dev/null +++ b/.bin/cert_expiry @@ -0,0 +1,15 @@ +#!/bin/bash +# Prints the expiration dates of all TLS Certificates in a directory + +# This is usually pem, but can also be crt +if [[ -z $1 ]]; then + echo "certificate type not set, defaulting to pem" + filetype="pem" +else + filetype=$1 +fi + +for filename in ./*.${filetype}; do + echo -n "${filename} expires on: " + openssl x509 -noout -dates -in "${filename}" | sed -n '/notAfter/p' | sed 's/^.\{9\}//' +done