]> WPIA git - nre.git/blob - generateTime
restrict non-verified profiles to 6 months
[nre.git] / generateTime
1 #!/bin/bash
2
3 . structure.bash
4 . commonFunctions.bash
5
6 [ "$1" == "" ] && echo "Usage: $0 <year>" && exit 1
7 year=$1
8
9 cd generated
10
11 genTimeCA(){ #csr,ca to sign with,start,end
12     KNAME=$2
13     . ../CAs/${KNAME}
14     cat <<TESTCA > timesubca.cnf
15 basicConstraints=critical,CA:true
16 keyUsage=critical,keyCertSign, cRLSign
17
18 subjectKeyIdentifier = hash
19 authorityKeyIdentifier = keyid:always
20
21 crlDistributionPoints=URI:http://g2.crl.${DOMAIN}/g2/$2.crl
22 authorityInfoAccess = OCSP;URI:http://g2.ocsp.${DOMAIN},caIssuers;URI:http://g2.crt.${DOMAIN}/g2/$2.crt
23
24 certificatePolicies=@polsect
25
26 [polsect]
27 policyIdentifier = 1.3.6.1.4.1.18506.9.2.${CPSID}
28 CPS.1="http://g2.cps.${DOMAIN}/g2/${KNAME}.cps"
29
30 TESTCA
31     caSign $1 $2 timesubca.cnf "$3" "$4"
32     rm timesubca.cnf
33 }
34
35 mkdir -p $year/ca
36
37
38 for i in "${TIME_IDX[@]}"; do
39     point=${year}${points[${i}]}
40     nextp=${points[$((${i} + 1))]}
41     if [[ "$nextp" == "" ]]; then
42         epoint=$((${year} + 3 ))${epoints[${i}]}
43     else
44         epoint=$((${year} + 2 ))${epoints[${i}]}
45     fi
46
47     for ca in "${STRUCT_CAS[@]}"; do
48         . ../CAs/$ca
49         genKey "/CN=$name ${year}-${i}" $year/ca/${ca}_${year}_${i}
50         genTimeCA $year/ca/${ca}_${year}_${i} $ca "$point" "$epoint"
51     done
52 done