-
Notifications
You must be signed in to change notification settings - Fork 17
/
setup_certauth.sh
51 lines (38 loc) · 853 Bytes
/
setup_certauth.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
#!/bin/bash
hr="-------------------------------------------"
br=""
strength=1024
valid=365
mkdir ca
mkdir server
mkdir server/certificates
mkdir server/requests
mkdir server/keys
mkdir user
mkdir user/certificates
mkdir user/requests
mkdir user/keys
mkdir user/p12
echo "01" > serial
touch index.txt
export OPENSSL_CONF=./conf/ca_openssl.cnf
echo $br
echo $hr
echo "CREATING CERTIFICATE AUTHORITY KEY"
echo $hr
openssl genrsa -des3 -out ./ca/ca.key $strength
echo $br
echo $hr
echo "CREATING CERTIFICATE REQUEST FOR CA"
echo $hr
openssl req -new -key ./ca/ca.key -out ./ca/ca.csr
echo $br
echo $hr
echo "CA SELF-SIGNING AND ISSUING CERTIFICATE"
echo $hr
openssl x509 -req -days $valid -in ./ca/ca.csr -out ./ca/ca.crt -signkey ./ca/ca.key
echo $br
echo $hr
echo "DUMPING CERTIFICATE TO CONSOLE"
echo $hr
openssl x509 -in ./ca/ca.crt -text