-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate-secrets.sh
executable file
·47 lines (41 loc) · 1.12 KB
/
generate-secrets.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
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# SPDX-FileCopyrightText: 2023-2024 Univention GmbH
# define hostname to be signed
hostname=localhost
mkdir -p ssl
#########################################
# Generate CA certificate
openssl genrsa \
-out ssl/CAcert.key \
4096
openssl req \
-new \
-x509 \
-key ssl/CAcert.key \
-out ssl/CAcert.pem \
-subj "/C=DE/ST=Bremen/L=Bremen/O=Fake Corporation/OU=Souvereign Workplace/CN=Souvereign Workplace Root CA/[email protected]"
#########################################
# Generate server certificate
openssl genrsa \
-out ssl/cert.key \
4096
openssl req \
-new \
-key ssl/cert.key \
-out ssl/cert.csr \
-subj "/C=DE/ST=Bremen/L=Bremen/O=Fake Corporation/OU=Souvereign Workplace/CN=${hostname}/[email protected]"
openssl x509 \
-req \
-in ssl/cert.csr \
-CA ssl/CAcert.pem \
-CAkey ssl/CAcert.key \
-CAcreateserial \
-out ssl/cert.pem
rm ssl/cert.csr
#########################################
# Generate Diffie-Hellman parameters
openssl dhparam \
-2 \
-out ssl/dh_2048.pem \
2048