-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
348a2fd
commit 6144e39
Showing
15 changed files
with
147 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,9 @@ | |
.vscode/ | ||
|
||
# jetbrains | ||
.idea/ | ||
.idea/ | ||
|
||
# certs | ||
*.crt | ||
*.key | ||
*.csr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
( | ||
cd ./tls/certs | ||
|
||
# root certs | ||
echo "Generating root certificates..." | ||
openssl genrsa -out root.key 4096 | ||
openssl req -new -x509 -days 365 -subj "/CN=pepp" \ | ||
-key root.key -out root.crt -config ../config/root.conf | ||
|
||
# server certs | ||
echo "Generating server certificates..." | ||
openssl genrsa -out server.key 4096 | ||
openssl req -new -key server.key -subj "/CN=postgres" \ | ||
-config ../config/server_client.conf -extensions req_ext -out server.csr | ||
openssl x509 -req -in server.csr -days 365 \ | ||
-CA root.crt -CAkey root.key -CAcreateserial -out server.crt \ | ||
-extfile ../config/server_client.conf -extensions req_ext | ||
|
||
echo "Setting correct server.key ownership." | ||
sudo chmod 600 server.key | ||
sudo chown 70:70 server.key | ||
|
||
# client certs | ||
echo "Generating client certificates..." | ||
openssl genrsa -out client.key 4096 | ||
openssl req -new -key client.key -subj "/CN=client" \ | ||
-config ../config/server_client.conf -extensions req_ext -out client.csr | ||
openssl x509 -req -in client.csr -days 365 \ | ||
-CA root.crt -CAkey root.key -CAcreateserial -out client.crt \ | ||
-extfile ../config/server_client.conf -extensions req_ext | ||
|
||
echo "Successfully created all certificates!" | ||
echo | ||
) | ||
|
||
echo "You can now start the application" | ||
echo | ||
echo " docker compose up -d && docker compose logs -f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ssl = on | ||
ssl_ca_file = '/etc/postgres/security/root.crt' | ||
ssl_cert_file = '/etc/postgres/security/server.crt' | ||
ssl_key_file = '/etc/postgres/security/server.key' | ||
password_encryption = scram-sha-256 | ||
listen_addresses = '*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5CBC3B5D5E557F0ABB2A981CD276AF89164931B3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ req ] | ||
default_bits = 4096 | ||
distinguished_name = req_distinguished_name | ||
x509_extensions = v3_ca | ||
|
||
[ req_distinguished_name ] | ||
organizationName = Fachschaft MathPhysInfo | ||
commonName = pepp | ||
commonName_max = 64 | ||
|
||
[ v3_ca ] | ||
basicConstraints = CA:true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ req ] | ||
default_bits = 4096 | ||
distinguished_name = req_distinguished_name | ||
req_extensions = req_ext | ||
|
||
[ req_distinguished_name ] | ||
commonName = pepp | ||
commonName_max = 64 | ||
|
||
[ req_ext ] | ||
subjectAltName = @alt_names | ||
|
||
[ alt_names ] | ||
DNS.1 = postgres | ||
IP.1 = 127.0.0.1 |