-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_certs.sh
executable file
·46 lines (37 loc) · 1.03 KB
/
gen_certs.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
#!/bin/bash
#some initial values
site_name='*'
email_address='[email protected]'
organization='organization'
organizational_unit='unit'
country='MW'
state='SS'
city='EH'
#initial path
CERTDIR='/etc/ssl/certs'
CERTNAME='default_ss'
DHPARAM='/etc/ssl/certs/dhparam.pem'
DHSTRENGTH=4096
KEY=$CERTDIR'/'$CERTNAME'.key'
CRT=$CERTDIR'/'$CERTNAME'.crt'
PEM=$CERTDIR'/'$VERTNAME'.pem'
CSR=$CERTDIR'/'$CERTNAME'.csr'
#make shure there is dir to place certs
mkdir -p $CERTDIR
#gencert
echo -e "Making ssl serts:"
#rm -f $KEY
#rm -f $CRT
#rm -f $PEM
#rm -f $CSR
openssl req -new -nodes -x509 -newkey rsa:4096 -nodes \
-keyout $KEY -out $CRT \
-subj "/CN=$site_name/O=$organization/OU=$organizational_unit/C=$country/ST=$state/L=$city"
#gen Diffie-Hellman
echo -e "Making DH:"
#uncomment this if you want get strong-primes algorythm ( it take really long time )
openssl dhparam -out $DHPARAM $DHSTRENGTH
#faster Diffie-Hellman algorhytm, that uses DSA-like.
#openssl dhparam -dsaparam -out $DHPARAM $DHSTRENGTH
#genpem
cat $CRT $KEY > $PEM