Encrypt artifactapi GitHub App keys with Vault transit (#616)
artifactapi stores GitHub App private keys in Postgres in plaintext. It can now encrypt them with a Vault transit key, logging in via Kubernetes auth. - enable transit encryption of GitHub App keys on the api Deployment - point it at Vault (`k8s/au/syd1` role `artifactapi`, transit key `artifactapi-github-app-keys`) using the combined CA bundle - mount a projected SA token with audience `vault` for the login Requires IUCLabs/terraform-vault#15 applied and an artifactapi release containing IUCLabs/artifactapi#22. Reviewed-on: #616 Co-authored-by: unkin-agent <unkin-agent@unkin.net> Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #616.
This commit is contained in:
@@ -42,6 +42,23 @@ spec:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: GITHUB_APP_KEY_ENCRYPTION
|
||||
value: transit
|
||||
- name: VAULT_ADDR
|
||||
value: https://vault.service.consul:8200
|
||||
- name: VAULT_CACERT
|
||||
value: /etc/ssl/combined/ca-certificates.crt
|
||||
- name: VAULT_K8S_MOUNT
|
||||
value: k8s/au/syd1
|
||||
- name: VAULT_K8S_ROLE
|
||||
value: artifactapi
|
||||
- name: VAULT_K8S_TOKEN_PATH
|
||||
value: /var/run/secrets/vault/token
|
||||
- name: VAULT_TRANSIT_MOUNT
|
||||
value: transit
|
||||
- name: VAULT_TRANSIT_KEY
|
||||
value: artifactapi-github-app-keys
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: api-env
|
||||
@@ -53,6 +70,9 @@ spec:
|
||||
- name: combined-certs
|
||||
mountPath: /etc/ssl/combined
|
||||
readOnly: true
|
||||
- name: vault-token
|
||||
mountPath: /var/run/secrets/vault
|
||||
readOnly: true
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
httpGet:
|
||||
@@ -89,4 +109,12 @@ spec:
|
||||
path: ca.crt
|
||||
- name: combined-certs
|
||||
emptyDir: {}
|
||||
# The default kubernetes.io token has the wrong audience for Vault login.
|
||||
- name: vault-token
|
||||
projected:
|
||||
sources:
|
||||
- serviceAccountToken:
|
||||
path: token
|
||||
audience: vault
|
||||
expirationSeconds: 600
|
||||
restartPolicy: Always
|
||||
|
||||
Reference in New Issue
Block a user