-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(postgres): Support TLS ca and client keypair as a secret (#121)
* feat(postgres): Support TLS ca and client keypair as a secret * Rename ldap script and create postgres tls secret * add version notice * wip, sort out cert permissions * fix test postgres deployment and certificate script * fix postgres cert init * create ns if it does not exist * move configmap to dedicated template. update jobs pod to use postgres tls init container * revert
- Loading branch information
Showing
11 changed files
with
309 additions
and
40 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
curl -L -o step-cli_amd64.deb https://github.com/smallstep/cli/releases/download/v0.26.1/step-cli_0.26.1_amd64.deb | ||
sudo apt-get install -y -qq -f ./step-cli_amd64.deb | ||
|
||
step certificate create \ | ||
ca.ldap.example.com \ | ||
ca.crt ca.key \ | ||
--profile root-ca \ | ||
--no-password \ | ||
--insecure \ | ||
--not-after=87600h | ||
|
||
# Can be used for server and client | ||
# despite the name being "client". | ||
step certificate create \ | ||
'ldap.example.com' \ | ||
client.crt client.key \ | ||
--profile leaf \ | ||
--not-after 2160h \ | ||
--no-password \ | ||
--insecure \ | ||
--ca ca.crt \ | ||
--ca-key ca.key | ||
|
||
kubectl create secret generic ldap-tls \ | ||
--from-file ca.crt \ | ||
--from-file client.crt \ | ||
--from-file client.key | ||
|
||
rm -f ca.crt ca.key client.crt client.key | ||
|
||
step certificate create \ | ||
postgres.svc.cluster.local \ | ||
ca.crt ca.key \ | ||
--profile root-ca \ | ||
--no-password \ | ||
--insecure \ | ||
--not-after=87600h | ||
|
||
step certificate create \ | ||
'postgres' \ | ||
client.crt client.key \ | ||
--profile leaf \ | ||
--not-after 2160h \ | ||
--no-password \ | ||
--insecure \ | ||
--ca ca.crt \ | ||
--ca-key ca.key | ||
|
||
step certificate create \ | ||
'postgres.postgres.svc.cluster.local' \ | ||
server.crt server.key \ | ||
--profile leaf \ | ||
--not-after 2160h \ | ||
--no-password \ | ||
--insecure \ | ||
--ca ca.crt \ | ||
--ca-key ca.key | ||
|
||
kubectl create secret generic postgres-tls \ | ||
--from-file ca.crt \ | ||
--from-file client.crt \ | ||
--from-file client.key | ||
|
||
kubectl create namespace postgres || true | ||
|
||
kubectl create secret generic postgres-tls \ | ||
-n postgres \ | ||
--from-file ca.crt \ | ||
--from-file server.crt \ | ||
--from-file server.key |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.backend.postgres.sslsecret.name }} | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: postgres-tls-init | ||
data: | ||
init.sh: | | ||
#!/bin/sh | ||
cp /ca.crt /client.crt /client.key /postgres-tls | ||
chmod 0400 /postgres-tls/* | ||
chown -R 65534:65534 /postgres-tls | ||
{{ end }} |
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,40 @@ | ||
# Required options | ||
config: | ||
username: bpuser | ||
password: bppass | ||
sessions_secret: 4484766F-5016-4077-B8E0-0DE1D637854B | ||
licenseUseSecret: true | ||
|
||
backend: | ||
type: postgres | ||
postgres: | ||
host: postgres.postgres.svc.cluster.local | ||
database: bindplane | ||
username: postgres | ||
password: password | ||
maxConnections: 12 | ||
sslmode: verify-ca | ||
sslsecret: | ||
name: postgres-tls | ||
sslrootcertSubPath: ca.crt | ||
sslcertSubPath: client.crt | ||
sslkeySubPath: client.key | ||
|
||
replicas: 2 | ||
|
||
resources: | ||
requests: | ||
memory: 100Mi | ||
cpu: 100m | ||
limits: | ||
memory: 100Mi | ||
cpu: 100m | ||
|
||
jobs: | ||
resources: | ||
requests: | ||
memory: 100Mi | ||
cpu: 100m | ||
limits: | ||
memory: 100Mi | ||
cpu: 100m |
Oops, something went wrong.