-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerateTime.sh
executable file
·57 lines (43 loc) · 1.33 KB
/
generateTime.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
. structure
. commonFunctions
[ "$1" == "" ] && echo "Usage: $0 <year>" && exit 1
year=$1
cd generated
genTimeCA(){ #csr,ca to sign with,start,end
KNAME=$2
. ../CAs/${KNAME}
cat <<TESTCA > timesubca.cnf
basicConstraints=critical,CA:true
keyUsage=critical,keyCertSign, cRLSign
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always
crlDistributionPoints=URI:http://g2.crl.${DOMAIN}/g2/$2.crl
authorityInfoAccess = OCSP;URI:http://g2.ocsp.${DOMAIN},caIssuers;URI:http://g2.crt.${DOMAIN}/g2/$2.crt
certificatePolicies=@polsect
[polsect]
policyIdentifier = 1.3.6.1.4.1.18506.9.2.${CPSID}
CPS.1="http://g2.cps.${DOMAIN}/g2/${KNAME}.cps"
TESTCA
caSign $1 $2 timesubca.cnf "$3" "$4"
rm timesubca.cnf
}
mkdir -p $year/ca
for i in $TIME_IDX; do
point=${year}${points[${i}]}
nextp=${points[$((${i} + 1))]}
if [[ "$nextp" == "" ]]; then
epoint=$((${year} + 3 ))${epoints[${i}]}
else
epoint=$((${year} + 2 ))${epoints[${i}]}
fi
. ../CAs/env
genca "/CN=$name ${year}-${i}" $year/ca/env_${year}_${i}
genTimeCA $year/ca/env_${year}_${i}.ca/key env "$point" "$epoint"
for ca in $STRUCT_CAS; do
[ "$ca" == "env" ] && continue
. ../CAs/$ca
genKey "/CN=$name ${year}-${i}" $year/ca/${ca}_${year}_${i}
genTimeCA $year/ca/${ca}_${year}_${i} $ca "$point" "$epoint"
done
done