-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcert-metadata.sh
43 lines (36 loc) · 1.21 KB
/
cert-metadata.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
# Common configuration for all certificates
# Edit these fields to be appropriate for your organization
# If they are left blank, they will not be included. Do not leave COUNTRY
# blank (you may set it to "XX" if you want to be obtuse).
#
# Values for each may be optionally set as environment variables.
# Replace variables such as ${STATE} and ${CITY} as needed.
#
COUNTRY=US
STATE=XX
CITY=YY
ORGANIZATION=ZZ
ORGANIZATIONAL_UNIT=wtr
CAPASS=${CAPASS:-atakatak}
PASS=${PASS:-$CAPASS}
## subdirectory to put all the actual certs and keys in
DIR=~/ots/ca/
##### don't edit below this line #####
if [[ -z ${STATE} || -z ${CITY} || -z ${ORGANIZATIONAL_UNIT} ]]; then
echo "Please set the following variables before running this script: STATE, CITY, ORGANIZATIONAL_UNIT. \n
The following environment variables can also be set to further secure and customize your certificates: ORGANIZATION, ORGANIZATIONAL_UNIT, CAPASS, and PASS."
exit -1
fi
SUBJBASE="/C=${COUNTRY}/"
if [ -n "$STATE" ]; then
SUBJBASE+="ST=${STATE}/"
fi
if [ -n "$CITY" ]; then
SUBJBASE+="L=${CITY}/"
fi
if [ -n "$ORGANIZATION" ]; then
SUBJBASE+="O=${ORGANIZATION}/"
fi
if [ -n "$ORGANIZATIONAL_UNIT" ]; then
SUBJBASE+="OU=${ORGANIZATIONAL_UNIT}/"
fi