-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·75 lines (64 loc) · 1.9 KB
/
run.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
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
#! /usr/bin/env sh
# step 1
mkdir mutual-ssl
cd mutual-ssl
# step 2
mkdir nss node curl
cd nss
# step 3
nch create-db --directory root
nch create-db --directory server
nch create-db --directory client
# step 4
cd root
nch create-cert --common-name 'test-root-cn' \
--nickname 'test-root-nick' \
--signed-by 'self'
# step 5
nch export-cert --nickname 'test-root-nick' --cert-only
# step 6
cd ../server
nch import-cert --nickname 'test-root-nick' \
--filepath ../root/test-root-nick.crt.pem \
--is-root
# step 7
nch create-csr --common-name 'localhost' > test-server-nick.csr
cd ../client
nch create-csr --common-name 'test-client-cn' > test-client-nick.csr
# step 8
cd ../root
nch sign-csr --ca-nickname 'test-root-nick' \
--csr-filepath ../server/test-server-nick.csr \
> ../server/test-server-nick.crt
nch sign-csr --ca-nickname 'test-root-nick' \
--csr-filepath ../client/test-client-nick.csr \
> ../client/test-client-nick.crt
# step 9
cd ../server
nch import-cert --filepath test-server-nick.crt \
--nickname 'test-server-nick'
cd ../client
nch import-cert --filepath test-client-nick.crt \
--nickname 'test-client-nick'
# step 10
cd ../server
nch export-cert --nickname 'test-server-nick' \
--filepath ../../node/test-server-nick.p12 \
--format 'p12'
cd ../root
nch export-cert --nickname 'test-root-nick' \
--cert-only \
--filepath ../../curl/test-root-nick.crt.pem
cd ../client
nch export-cert --nickname 'test-client-nick' \
--cert-only \
--filepath ../../curl/test-client-nick.crt.pem
nch export-cert --nickname 'test-client-nick' \
--key-only \
--filepath ../../curl/test-client-nick.key.pem
# step 11
cd ../../node
wget https://raw.githubusercontent.com/olsonpm/nss-certutil-helpers/master/resources/node/package.json
wget https://raw.githubusercontent.com/olsonpm/nss-certutil-helpers/master/resources/node/server.js
npm install
echo -e "\n\nready for 'node server' and curl script\n\n"