Forum Discussion
Mar 26, 2015
Hi MickeyM,
here is a solution which is splitting the original bundle (stored in /var/tmp/ca-bundle.crt for the example) as well into multiple files and runs the openssl verification:awk '/-+BEGIN CERTIFICATE-+/,/-+END CERTIFICATE-+/ {print}' /var/tmp/ca-bundle.crt | \
awk '/-+BEGIN CERTIFICATE-+/ {file="cafile_"++i;} {print > "/var/tmp/"file".tmp";}'
for cert in /var/tmp/cafile_*.tmp; do openssl x509 -noout -subject -enddate -in $cert; done
rm -f /var/tmp/cafile_*.tmp
Temp files were stored as /var/tmp/cafile_.tmp and need to be deleted after test.
Thanks, Stephan PS: Kudos go to the guys at "theunixschool" for some pretty helpful awk-examples.