bcgov / bcgov/SIMS

Implement Vaults

Open
#2,156 7 comments 1 reaction 1 assignee Assigned to @bidyashish View on GitHub
Dev & Architecture Devops Technical Debt
Dominant language
TypeScript
Stars
29
Forks
15
Avg merge
1d 14h
Merged PRs (30d)
38

Description

As a Ministry Security Officer, I would like secrets to be stored and controlled using Hashicorp Vault.

**Prerequisite**
Creation of vault secrets and implementation must occur in same sprint
- [ ] Technical lead to create secrets in Vault (Stephen can assist in automation if wanted)
- [ ] Creation of namespace-nonprod/envs/[dev/test]/common
- [ ] Creation of namespace-prod/envs/[staging/prod]/common
- [ ] Creation of namespace-nonprod/envs/[dev/test]/web
- [ ] Creation of namespace-prod/envs/[staging/prod]/web
- [ ] Creation of namespace-nonprod/envs/[dev/test]/api
- [ ] Creation of namespace-prod/envs/[staging/prod]/api
- [ ] Creation of namespace-nonprod/envs/[dev/test]/forms
- [ ] Creation of namespace-prod/envs/[staging/prod]/forms
- [ ] Creation of namespace-nonprod/envs/[dev/test]/queue-consumers
- [ ] Creation of namespace-prod/envs/[staging/prod]/queue-consumers
- [ ] Creation of namespace-nonprod/envs/[dev/test]/workers
- [ ] Creation of namespace-prod/envs/[staging/prod]/workers
- [ ] Creation of namespace-nonprod/envs/[dev/test]/edw-api
- [ ] Creation of namespace-prod/envs/[staging/prod]/edw-api
- [ ] Discuss Infrastructre items: Crunchy, Redis, hamongo and either remove from scope or create new tickets

**Acceptance Criteria**
- [ ] Inject common and specific vault secret into each DC mapped at /vault/secrets/secrets.txt
- [ ] Path and filename should be configurable (configmap or .env file) for secrets.txt
- [ ] On App startup code should read secrets.txt into memory and then delete it
- [ ] Code should reference secrets/configuration/environment from common mechanism
- [ ] Remove mapped secrets and environment variables from Deployment Configs
- [ ] Remove secrets from GH
- [ ] Exclude Infrastructure items: Crunchy, Redis, hamongo for this ticket
- [ ] Confirm that no secrets are on disk or in environment variables once pod has fully started

**Technical Context**

Insert the following yaml into the spec/strategy/template/metadata
Replace ${license-plate}, ${prod or nonprod} and secret1/2 with the real values
```
annotations:
vault.hashicorp.com/agent-inject-secret-secrets.txt: '${license-plate}-${prod or nonprod}/secret1,${license-plate}-${prod or nonprod}/secret2
vault.hashicorp.com/namespace: platform-services
vault.hashicorp.com/role: ${license-plate}-${prod or nonprod}
vault.hashicorp.com/agent-pre-populate-only: 'true'
vault.hashicorp.com/agent-inject: 'true'
vault.hashicorp.com/agent-inject-template-secrets.txt: |
{{- with secret "${license-plate}-${prod or nonprod}/secret1" -}}
{{- range $key, $value := .Data.data -}}
export {{ $key }}="{{ $value }}"{{ "\n" }}
{{- end -}}
{{- end -}}
{{- with secret "${license-plate}-${prod or nonprod}/secret2" -}}
{{- range $key, $value := .Data.data -}}
export {{ $key }}="{{ $value }}"{{ "\n" }}
{{- end -}}
{{- end -}}
```

Add user into spec/strategy/template/spec
```
serviceAccount: ${license-play}-vault
```

App reads configurable /vault/secrets/secrets.txt if present
App deletes /vault/secrets/secrets.txt if present

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.