List trust store certificates

truststore=/opt/glassfish3/glassfish/domains/domain1/config/cacerts.jks
storepassword=changeit

echo "Trust store content is: "

keytool -list -v -keystore "$truststore" -storepass ${storepassword} | grep Alias | cut -d " " -f3- | while read alias
do
           expiry=`keytool -list -v -keystore "$truststore" -storepass ${storepassword} -alias "${alias}" | grep Valid | perl -ne 'if(/until: (.*?)\n/) { print "$1\n"; }'`
           echo " Certificate ${alias} expires in '$expiry'"
done

Popular posts from this blog

How to delete / clear queue of PowerMTA