X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=generateTime.sh;h=300d823857f7c2ab8a3eaae120fb926b7d99f4c7;hb=26af5d502565f10a3d3d91192e5545f59075ca59;hp=0b0b0b4e8da46018c3e05aa1392635824acb166a;hpb=c4ec3f02627ad85f5794d457936ca125ce13e506;p=nre.git diff --git a/generateTime.sh b/generateTime.sh index 0b0b0b4..300d823 100755 --- a/generateTime.sh +++ b/generateTime.sh @@ -6,6 +6,8 @@ [ "$1" == "" ] && echo "Usage: $0 " && exit 1 year=$1 +cd generated + genTimeCA(){ #csr,ca to sign with,start,end cat < timesubca.cnf basicConstraints = CA:true @@ -14,8 +16,8 @@ keyUsage = keyCertSign, cRLSign subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:always -crlDistributionPoints=URI:http://g2.crl.cacert.org/g2/$2.crl -authorityInfoAccess = OCSP;URI:http://g2.ocsp.cacert.org,caIssuers;URI:http://g2.crt.cacert.org/$2.crt +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 TESTCA caSign $1 $2 timesubca.cnf "$3" "$4" rm timesubca.cnf @@ -24,19 +26,23 @@ TESTCA mkdir -p $year/ca -STARTDATE="${year}" -ENDDATE="$((${year} + 3))" - for i in $TIME_IDX; do - point=${points[${i}]} - . CAs/env + 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 "$STARTDATE$point" "$ENDDATE$point" + genTimeCA $year/ca/env_${year}_${i}.ca/key env "$point" "$epoint" for ca in $STRUCT_CAS; do [ "$ca" == "env" ] && continue - . CAs/$ca + . ../CAs/$ca genKey "/CN=$name ${year}-${i}" $year/ca/${ca}_${year}_${i} - genTimeCA $year/ca/${ca}_${year}_${i} $ca "$STARTDATE$point" "$ENDDATE$point" + genTimeCA $year/ca/${ca}_${year}_${i} $ca "$point" "$epoint" done done