Created
April 8, 2016 19:12
-
-
Save Mohitsharma44/0fc45e2b31ba7ebaee9ad43d7b0b7835 to your computer and use it in GitHub Desktop.
recreate index.txt used by easy_rsa (for crl-verify). Make sure you have all the pem files. Pass all the pem files as argument as /pem_directory/*.pem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ] | |
then | |
echo "Usage: $0 *.pem" | |
exit 1 | |
fi | |
for cert | |
do | |
enddate=`openssl x509 -enddate -noout -in $cert | sed 's/notAfter=//' | awk '\ | |
{ year=$4-2000; | |
months="JanFebMarAprMayJunJulAugSepOctNovDec" ; | |
month=1+index(months, $1)/3 ; | |
day=$2; | |
hour=substr($3,1,2) ; | |
minutes=substr($3,4,2); | |
seconds=substr($3,7,2); | |
printf "%02d%02d%02d%02d%02d%02dZ", year, month, day, hour, minutes, seco$ | |
serial=`openssl x509 -serial -noout -in $cert |sed 's/serial=//'` | |
subject=`openssl x509 -subject -noout -in $cert |sed 's/subject= //'` | |
echo "V $enddate $serial unknown $subject" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment