-
Notifications
You must be signed in to change notification settings - Fork 4
/
gen-CA
executable file
·28 lines (18 loc) · 897 Bytes
/
gen-CA
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
#!/bin/bash
source $(cd $(dirname ${BASH_SOURCE[0]}) && pwd)/common-func
init() {
generalInit
setConfValue emailAddress "dev_root_ca@devcert.com"
setConfValue CN "Dev_Root_CA"
}
generateCA() {
#From CA.pl
# gen CA_ROOT key and CA_ROOT request
openssl req -config ${WORKING_CONF} -new -keyout ${CA_DIR}/${CA_NAME}.key -out ${REQ_DIR}/${CA_NAME}.req -days 3650 -passout "pass:${DEFAULT_PASS}"
# gen signed CA_ROOT certificate
openssl ca -config ${WORKING_CONF} -create_serial -out ${CA_DIR}/${CA_NAME}.crt -days 3650 -batch -keyfile ${CA_DIR}/${CA_NAME}.key -selfsign -passin "pass:${DEFAULT_PASS}" -extensions v3_ca -infiles ${REQ_DIR}/${CA_NAME}.req
openssl x509 -in ${CA_DIR}/${CA_NAME}.crt -days 3650 -out ${CA_DIR}/${CA_NAME}.crt -passin "pass:${DEFAULT_PASS}" -signkey ${CA_DIR}/${CA_NAME}.key
}
init
generateCA
generalCleanup