-
Notifications
You must be signed in to change notification settings - Fork 0
/
test
executable file
·198 lines (164 loc) · 19.2 KB
/
test
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/bash
set -e
scriptdir=$(dirname "${BASH_SOURCE[0]}")
execTest()
{
local line="$1"; shift
local exitCode="$1"; shift
local config=--config="$scriptdir/mkcert-ca-complete.conf.json"
local result
[[ $RMDIRS =~ ssl ]] && rm -rf "$scriptdir/ssl"
[[ $RMDIRS =~ tmp ]] && rm -rf "$scriptdir/tmp"
if [[ $CHMOD ]]; then
chmod 600 \
"$scriptdir/ssl/CA-root"*"/private/"*".key"* \
"$scriptdir/ssl/private/"*".key"*
fi
status=0
result=$("$scriptdir/mkcert-ca-complete.sh" $config --verbose "$@" 2>&1) || status=$?
if [[ $status != $exitCode ]]; then
echo -e "\033[1;31mFAILED:$line\033[m '$scriptdir/mkcert-ca-complete.sh' $config --verbose $@"
echo -e "\033[1;31m\$?=$status (expected $exitCode)\n$result\033[m"
return 1
else
if result=$(diff -u - <(echo "$result")); then
echo -e "\033[32mPASSED:$line\033[m"
else
echo -e "\033[1;31mFAILED:$line\033[m '$scriptdir/mkcert-ca-complete.sh' $config --verbose $@"
sed -e '/^---/d; /^+++/d' \
-e $'s/^-.*$/\033[31m&\033[m/g' \
-e $'s/^+.*$/\033[33m&\033[m/g' \
-e $'s/^@@.*@@$/\033[36m&\033[m/g' <<< "$result"
return 1
fi
fi
}
# no certificate; nothing to do, no error
RMDIRS=ssl,tmp \
execTest $LINENO 0 <<< ""
# try creating user certificate without intermediate cert
RMDIRS=ssl,tmp \
execTest $LINENO 3 localhost <<"EOF"
[37;1mChecking for CA certificate:[m
[31mca-intermediate certificate not found.[m
EOF
# try creating intermediate and user certificate without root cert
RMDIRS=ssl,tmp \
execTest $LINENO 3 --genpkey=ca-intermediate localhost <<"EOF"
[37;1mChecking for CA certificate:[m
[31mca-root certificate not found.[m
EOF
# create complete chain, no pkeys yet -> will be created automatically
RMDIRS=ssl,tmp \
execTest $LINENO 0 ca-root ca-intermediate localhost <<"EOF"
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/CA-root/private/ca-root.key.enc -pass stdin
/usr/bin/openssl req -new -x509 -extensions v3_ca -sha512 -days 9125 -config ssl/openssl.cnf -utf8 -out ssl/CA-root/certs/ca-root.crt -key ssl/CA-root/private/ca-root.key.enc -subj /C=\?\?/L=City/O=organisation/CN=ca-root-name -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/CA-intermediate/private/ca-intermediate.key.enc -pass stdin
/usr/bin/openssl req -new -utf8 -config ssl/openssl.cnf -out ssl/CA-root/csr/ca-intermediate.csr -key ssl/CA-intermediate/private/ca-intermediate.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=ca-intermediate-name -passin stdin
/usr/bin/openssl ca -config ssl/openssl.cnf -name CA_root -extensions v3_intermediate_ca -notext -batch -passin stdin -cert ssl/CA-root/certs/ca-root.crt -keyfile ssl/CA-root/private/ca-root.key.enc -out ssl/CA-intermediate/certs/ca-intermediate.crt -infiles ssl/CA-root/csr/ca-intermediate.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/CA-root/certs/ca-root.crt ssl/CA-intermediate/certs/ca-intermediate.crt
/usr/bin/openssl ca -gencrl -config ssl/openssl.cnf -name CA_root -cert ssl/CA-root/certs/ca-root.crt -keyfile ssl/CA-root/private/ca-root.key.enc -out ssl/CA-root/revoked/ca-root.crl -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -aes-256-cbc -out ssl/private/localhost.key.enc -pass stdin
/usr/bin/openssl rsa -in ssl/private/localhost.key.enc -out ssl/private/localhost.key -passin stdin
/usr/bin/openssl req -new -utf8 -config ssl/openssl.cnf -out ssl/CA-intermediate/csr/localhost.csr -key ssl/private/localhost.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=localhost -passin stdin
/usr/bin/openssl ca -config ssl/openssl.cnf -name CA_default -extensions usr_cert -notext -batch -passin stdin -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/certs/localhost.crt -infiles ssl/CA-intermediate/csr/localhost.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/CA-intermediate/certs/ca-intermediate.crt ssl/certs/localhost.crt
/usr/bin/openssl ca -gencrl -config ssl/openssl.cnf -name CA_default -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/CA-intermediate/revoked/ca-intermediate.crl -passin stdin
EOF
# create complete chain, re-create all private keys
CHMOD=keys \
execTest $LINENO 0 --genpkey=ca-root,ca-intermediate,localhost <<"EOF"
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/CA-root/private/ca-root.key.enc -pass stdin
/usr/bin/openssl req -new -x509 -extensions v3_ca -sha512 -days 9125 -config ssl/openssl.cnf -utf8 -out ssl/CA-root/certs/ca-root.crt -key ssl/CA-root/private/ca-root.key.enc -subj /C=\?\?/L=City/O=organisation/CN=ca-root-name -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/CA-intermediate/private/ca-intermediate.key.enc -pass stdin
/usr/bin/openssl req -new -utf8 -config ssl/openssl.cnf -out ssl/CA-root/csr/ca-intermediate.csr -key ssl/CA-intermediate/private/ca-intermediate.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=ca-intermediate-name -passin stdin
/usr/bin/openssl ca -config ssl/openssl.cnf -name CA_root -extensions v3_intermediate_ca -notext -batch -passin stdin -cert ssl/CA-root/certs/ca-root.crt -keyfile ssl/CA-root/private/ca-root.key.enc -out ssl/CA-intermediate/certs/ca-intermediate.crt -infiles ssl/CA-root/csr/ca-intermediate.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/CA-root/certs/ca-root.crt ssl/CA-intermediate/certs/ca-intermediate.crt
/usr/bin/openssl ca -gencrl -config ssl/openssl.cnf -name CA_root -cert ssl/CA-root/certs/ca-root.crt -keyfile ssl/CA-root/private/ca-root.key.enc -out ssl/CA-root/revoked/ca-root.crl -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -aes-256-cbc -out ssl/private/localhost.key.enc -pass stdin
/usr/bin/openssl rsa -in ssl/private/localhost.key.enc -out ssl/private/localhost.key -passin stdin
/usr/bin/openssl req -new -utf8 -config ssl/openssl.cnf -out ssl/CA-intermediate/csr/localhost.csr -key ssl/private/localhost.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=localhost -passin stdin
/usr/bin/openssl ca -config ssl/openssl.cnf -name CA_default -extensions usr_cert -notext -batch -passin stdin -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/certs/localhost.crt -infiles ssl/CA-intermediate/csr/localhost.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/CA-intermediate/certs/ca-intermediate.crt ssl/certs/localhost.crt
/usr/bin/openssl ca -gencrl -config ssl/openssl.cnf -name CA_default -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/CA-intermediate/revoked/ca-intermediate.crl -passin stdin
EOF
# create complete chain, re-create all private keys, use --separator
CHMOD=keys \
execTest $LINENO 0 --separator=' ' --genpkey='ca-root ca-intermediate localhost' <<"EOF"
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/CA-root/private/ca-root.key.enc -pass stdin
/usr/bin/openssl req -new -x509 -extensions v3_ca -sha512 -days 9125 -config ssl/openssl.cnf -utf8 -out ssl/CA-root/certs/ca-root.crt -key ssl/CA-root/private/ca-root.key.enc -subj /C=\?\?/L=City/O=organisation/CN=ca-root-name -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/CA-intermediate/private/ca-intermediate.key.enc -pass stdin
/usr/bin/openssl req -new -utf8 -config ssl/openssl.cnf -out ssl/CA-root/csr/ca-intermediate.csr -key ssl/CA-intermediate/private/ca-intermediate.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=ca-intermediate-name -passin stdin
/usr/bin/openssl ca -config ssl/openssl.cnf -name CA_root -extensions v3_intermediate_ca -notext -batch -passin stdin -cert ssl/CA-root/certs/ca-root.crt -keyfile ssl/CA-root/private/ca-root.key.enc -out ssl/CA-intermediate/certs/ca-intermediate.crt -infiles ssl/CA-root/csr/ca-intermediate.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/CA-root/certs/ca-root.crt ssl/CA-intermediate/certs/ca-intermediate.crt
/usr/bin/openssl ca -gencrl -config ssl/openssl.cnf -name CA_root -cert ssl/CA-root/certs/ca-root.crt -keyfile ssl/CA-root/private/ca-root.key.enc -out ssl/CA-root/revoked/ca-root.crl -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -aes-256-cbc -out ssl/private/localhost.key.enc -pass stdin
/usr/bin/openssl rsa -in ssl/private/localhost.key.enc -out ssl/private/localhost.key -passin stdin
/usr/bin/openssl req -new -utf8 -config ssl/openssl.cnf -out ssl/CA-intermediate/csr/localhost.csr -key ssl/private/localhost.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=localhost -passin stdin
/usr/bin/openssl ca -config ssl/openssl.cnf -name CA_default -extensions usr_cert -notext -batch -passin stdin -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/certs/localhost.crt -infiles ssl/CA-intermediate/csr/localhost.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/CA-intermediate/certs/ca-intermediate.crt ssl/certs/localhost.crt
/usr/bin/openssl ca -gencrl -config ssl/openssl.cnf -name CA_default -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/CA-intermediate/revoked/ca-intermediate.crl -passin stdin
EOF
# create complete chain with existing keys
execTest $LINENO 0 ca-root ca-intermediate localhost <<"EOF"
/usr/bin/openssl req -new -x509 -extensions v3_ca -sha512 -days 9125 -config ssl/openssl.cnf -utf8 -out ssl/CA-root/certs/ca-root.crt -key ssl/CA-root/private/ca-root.key.enc -subj /C=\?\?/L=City/O=organisation/CN=ca-root-name -passin stdin
/usr/bin/openssl req -new -utf8 -config ssl/openssl.cnf -out ssl/CA-root/csr/ca-intermediate.csr -key ssl/CA-intermediate/private/ca-intermediate.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=ca-intermediate-name -passin stdin
/usr/bin/openssl ca -config ssl/openssl.cnf -name CA_root -extensions v3_intermediate_ca -notext -batch -passin stdin -cert ssl/CA-root/certs/ca-root.crt -keyfile ssl/CA-root/private/ca-root.key.enc -out ssl/CA-intermediate/certs/ca-intermediate.crt -infiles ssl/CA-root/csr/ca-intermediate.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/CA-root/certs/ca-root.crt ssl/CA-intermediate/certs/ca-intermediate.crt
/usr/bin/openssl ca -gencrl -config ssl/openssl.cnf -name CA_root -cert ssl/CA-root/certs/ca-root.crt -keyfile ssl/CA-root/private/ca-root.key.enc -out ssl/CA-root/revoked/ca-root.crl -passin stdin
/usr/bin/openssl req -new -utf8 -config ssl/openssl.cnf -out ssl/CA-intermediate/csr/localhost.csr -key ssl/private/localhost.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=localhost -passin stdin
/usr/bin/openssl ca -config ssl/openssl.cnf -name CA_default -extensions usr_cert -notext -batch -passin stdin -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/certs/localhost.crt -infiles ssl/CA-intermediate/csr/localhost.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/CA-intermediate/certs/ca-intermediate.crt ssl/certs/localhost.crt
/usr/bin/openssl ca -gencrl -config ssl/openssl.cnf -name CA_default -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/CA-intermediate/revoked/ca-intermediate.crl -passin stdin
EOF
# create user cert only
execTest $LINENO 0 localhost <<"EOF"
/usr/bin/openssl req -new -utf8 -config ssl/openssl.cnf -out ssl/CA-intermediate/csr/localhost.csr -key ssl/private/localhost.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=localhost -passin stdin
/usr/bin/openssl ca -config ssl/openssl.cnf -name CA_default -extensions usr_cert -notext -batch -passin stdin -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/certs/localhost.crt -infiles ssl/CA-intermediate/csr/localhost.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/CA-intermediate/certs/ca-intermediate.crt ssl/certs/localhost.crt
/usr/bin/openssl ca -gencrl -config ssl/openssl.cnf -name CA_default -cert ssl/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/CA-intermediate/private/ca-intermediate.key.enc -out ssl/CA-intermediate/revoked/ca-intermediate.crl -passin stdin
EOF
# "forget" to create CAs
RMDIRS=ssl,tmp \
execTest $LINENO 3 localhost <<"EOF"
[37;1mChecking for CA certificate:[m
[31mca-intermediate certificate not found.[m
EOF
# "forget" to create root CA
execTest $LINENO 3 --genpkey=ca-intermediate,localhost <<"EOF"
[37;1mChecking for CA certificate:[m
[31mca-root certificate not found.[m
EOF
# Use ssldir containing spaces
execTest $LINENO 0 --ssldir="ssl/subdir with spaces" ca-root ca-intermediate localhost <<"EOF"
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/subdir\ with\ spaces/CA-root/private/ca-root.key.enc -pass stdin
/usr/bin/openssl req -new -x509 -extensions v3_ca -sha512 -days 9125 -config ssl/subdir\ with\ spaces/openssl.cnf -utf8 -out ssl/subdir\ with\ spaces/CA-root/certs/ca-root.crt -key ssl/subdir\ with\ spaces/CA-root/private/ca-root.key.enc -subj /C=\?\?/L=City/O=organisation/CN=ca-root-name -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/subdir\ with\ spaces/CA-intermediate/private/ca-intermediate.key.enc -pass stdin
/usr/bin/openssl req -new -utf8 -config ssl/subdir\ with\ spaces/openssl.cnf -out ssl/subdir\ with\ spaces/CA-root/csr/ca-intermediate.csr -key ssl/subdir\ with\ spaces/CA-intermediate/private/ca-intermediate.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=ca-intermediate-name -passin stdin
/usr/bin/openssl ca -config ssl/subdir\ with\ spaces/openssl.cnf -name CA_root -extensions v3_intermediate_ca -notext -batch -passin stdin -cert ssl/subdir\ with\ spaces/CA-root/certs/ca-root.crt -keyfile ssl/subdir\ with\ spaces/CA-root/private/ca-root.key.enc -out ssl/subdir\ with\ spaces/CA-intermediate/certs/ca-intermediate.crt -infiles ssl/subdir\ with\ spaces/CA-root/csr/ca-intermediate.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/subdir\ with\ spaces/CA-root/certs/ca-root.crt ssl/subdir\ with\ spaces/CA-intermediate/certs/ca-intermediate.crt
/usr/bin/openssl ca -gencrl -config ssl/subdir\ with\ spaces/openssl.cnf -name CA_root -cert ssl/subdir\ with\ spaces/CA-root/certs/ca-root.crt -keyfile ssl/subdir\ with\ spaces/CA-root/private/ca-root.key.enc -out ssl/subdir\ with\ spaces/CA-root/revoked/ca-root.crl -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -aes-256-cbc -out ssl/subdir\ with\ spaces/private/localhost.key.enc -pass stdin
/usr/bin/openssl rsa -in ssl/subdir\ with\ spaces/private/localhost.key.enc -out ssl/subdir\ with\ spaces/private/localhost.key -passin stdin
/usr/bin/openssl req -new -utf8 -config ssl/subdir\ with\ spaces/openssl.cnf -out ssl/subdir\ with\ spaces/CA-intermediate/csr/localhost.csr -key ssl/subdir\ with\ spaces/private/localhost.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=localhost -passin stdin
/usr/bin/openssl ca -config ssl/subdir\ with\ spaces/openssl.cnf -name CA_default -extensions usr_cert -notext -batch -passin stdin -cert ssl/subdir\ with\ spaces/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/subdir\ with\ spaces/CA-intermediate/private/ca-intermediate.key.enc -out ssl/subdir\ with\ spaces/certs/localhost.crt -infiles ssl/subdir\ with\ spaces/CA-intermediate/csr/localhost.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/subdir\ with\ spaces/CA-intermediate/certs/ca-intermediate.crt ssl/subdir\ with\ spaces/certs/localhost.crt
/usr/bin/openssl ca -gencrl -config ssl/subdir\ with\ spaces/openssl.cnf -name CA_default -cert ssl/subdir\ with\ spaces/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/subdir\ with\ spaces/CA-intermediate/private/ca-intermediate.key.enc -out ssl/subdir\ with\ spaces/CA-intermediate/revoked/ca-intermediate.crl -passin stdin
EOF
# Use ssldir from JSON
jq '.ssldir="ssl/subdir from json"' mkcert-ca-complete.conf.json > "$scriptdir/ssl/mkcert.json"
execTest $LINENO 0 --config="$scriptdir/ssl/mkcert.json" ca-root ca-intermediate localhost <<"EOF"
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/subdir\ from\ json/CA-root/private/ca-root.key.enc -pass stdin
/usr/bin/openssl req -new -x509 -extensions v3_ca -sha512 -days 9125 -config ssl/subdir\ from\ json/openssl.cnf -utf8 -out ssl/subdir\ from\ json/CA-root/certs/ca-root.crt -key ssl/subdir\ from\ json/CA-root/private/ca-root.key.enc -subj /C=\?\?/L=City/O=organisation/CN=ca-root-name -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:8192 -aes-256-cbc -out ssl/subdir\ from\ json/CA-intermediate/private/ca-intermediate.key.enc -pass stdin
/usr/bin/openssl req -new -utf8 -config ssl/subdir\ from\ json/openssl.cnf -out ssl/subdir\ from\ json/CA-root/csr/ca-intermediate.csr -key ssl/subdir\ from\ json/CA-intermediate/private/ca-intermediate.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=ca-intermediate-name -passin stdin
/usr/bin/openssl ca -config ssl/subdir\ from\ json/openssl.cnf -name CA_root -extensions v3_intermediate_ca -notext -batch -passin stdin -cert ssl/subdir\ from\ json/CA-root/certs/ca-root.crt -keyfile ssl/subdir\ from\ json/CA-root/private/ca-root.key.enc -out ssl/subdir\ from\ json/CA-intermediate/certs/ca-intermediate.crt -infiles ssl/subdir\ from\ json/CA-root/csr/ca-intermediate.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/subdir\ from\ json/CA-root/certs/ca-root.crt ssl/subdir\ from\ json/CA-intermediate/certs/ca-intermediate.crt
/usr/bin/openssl ca -gencrl -config ssl/subdir\ from\ json/openssl.cnf -name CA_root -cert ssl/subdir\ from\ json/CA-root/certs/ca-root.crt -keyfile ssl/subdir\ from\ json/CA-root/private/ca-root.key.enc -out ssl/subdir\ from\ json/CA-root/revoked/ca-root.crl -passin stdin
/usr/bin/openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -aes-256-cbc -out ssl/subdir\ from\ json/private/localhost.key.enc -pass stdin
/usr/bin/openssl rsa -in ssl/subdir\ from\ json/private/localhost.key.enc -out ssl/subdir\ from\ json/private/localhost.key -passin stdin
/usr/bin/openssl req -new -utf8 -config ssl/subdir\ from\ json/openssl.cnf -out ssl/subdir\ from\ json/CA-intermediate/csr/localhost.csr -key ssl/subdir\ from\ json/private/localhost.key.enc -subj /C=\?\?/L=City/O=organisation/OU=unit/CN=localhost -passin stdin
/usr/bin/openssl ca -config ssl/subdir\ from\ json/openssl.cnf -name CA_default -extensions usr_cert -notext -batch -passin stdin -cert ssl/subdir\ from\ json/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/subdir\ from\ json/CA-intermediate/private/ca-intermediate.key.enc -out ssl/subdir\ from\ json/certs/localhost.crt -infiles ssl/subdir\ from\ json/CA-intermediate/csr/localhost.csr
/usr/bin/openssl verify -partial_chain -CAfile ssl/subdir\ from\ json/CA-intermediate/certs/ca-intermediate.crt ssl/subdir\ from\ json/certs/localhost.crt
/usr/bin/openssl ca -gencrl -config ssl/subdir\ from\ json/openssl.cnf -name CA_default -cert ssl/subdir\ from\ json/CA-intermediate/certs/ca-intermediate.crt -keyfile ssl/subdir\ from\ json/CA-intermediate/private/ca-intermediate.key.enc -out ssl/subdir\ from\ json/CA-intermediate/revoked/ca-intermediate.crl -passin stdin
EOF