-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplaycerts.sh
36 lines (28 loc) · 1014 Bytes
/
displaycerts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# ********
# * INIT *
# ********
RED='\033[0;31m'
YELLOW='\033[0;33m'
GREEN='\033[0;32m'
NC='\033[0m'
#if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi
if [ ! -f "rootpath" ]; then
echo "Run setup first"
exit 1
fi
rootpath=`cat rootpath`
cd $rootpath
indexf=$(sed 's/\t\t/\t\- \t/g' index.txt)
printf "${YELLOW}State\t\tExpiration Date\t\tRevocation Date\t\tSerial\t\tFilename\t\tDistinguished-Name${NC}\n"
while IFS=$'\t' read -r -a arr
do
printf "${arr[0]}\t\t${arr[1]}\t\t${arr[2]}\t\t${arr[3]}\t\t${arr[4]}\t\t\t${arr[5]}\n"
done <<< "$indexf"
indexif=$(sed 's/\t\t/\t\- \t/g' intermediate/index.txt)
printf "${YELLOW}State\t\tExpiration Date\t\tRevocation Date\t\tSerial\t\tFilename\t\tDistinguished-Name${NC}\n"
while IFS=$'\t' read -r -a arr
do
printf "${arr[0]}\t\t${arr[1]}\t\t${arr[2]}\t\t${arr[3]}\t\t${arr[4]}\t\t\t${arr[5]}\n"
done <<< "$indexif"
printf "\n\nLegend: V=valid,R=revoked,E=expired\t\tDate Format: YYMMDDHHMMSSZ${NC}\n"