The secrets reef

Every command of the secrets reef: vaults, and the secrets in them, encrypted before they leave the machine

O reef secrets

Todos os comandos do reef secrets: vaults, e os secrets dentro deles, cifrados antes de saírem da máquina

Opening · kinds

Three kinds: where secrets are kept, the secrets themselves, and where they are used

  • Vault: where secrets are kept, the Mandate whose Nereid keeps them and the namespaces allowed to bind them · nereus secrets vault
  • Secret: keys and their encrypted values, in a vault, named <vault>/<secret> · nereus secrets
  • SecretBinding: a Kubernetes Secret made from a secret, in the namespace of whoever asks for it · nereus secrets binding
Abertura · kinds

Três kinds: onde os secrets ficam, os próprios secrets, e onde eles são usados

  • Vault: onde os secrets ficam, o Mandate cuja Nereid os guarda e os namespaces que podem vinculá-los · nereus secrets vault
  • Secret: chaves e os seus valores cifrados, num vault, com o nome <vault>/<secret> · nereus secrets
  • SecretBinding: um Secret do Kubernetes feito de um secret, no namespace de quem o pede · nereus secrets binding
Setup

What comes before the first secret?

Preparação

O que vem antes do primeiro secret?

Setup · initbuilt

The profile brings the secrets reef ready to use, with its key and the vault default

Preparação · initpronto

O profile traz o reef secrets pronto para uso, com a sua chave e o vault default

~/example
# Install core and the internal developer platform profile$ nereus init \    --profile internal-developer-platform✓ reef secrets              0.0s  core/reefs/secrets 0.1.0 created (secrets.getnereus.dev/v1alpha1: secrets, secretbindings, vaults)✓ nereid openbao           21.5s  core/nereids/openbao created, Ready✓ mandate default           0.0s  core/mandates/default created (reef: secrets, nereid: openbao, default)✓ public key                5.0s  rsa-4096, SHA256:yJi61pETATOGjDo6b6B2y5+V8jiPPDruqOUYp2CtPFs, version 1✓ vault default             0.1s  secrets/vaults/default created (mandate: default)
Secret

How does a value reach the cluster without being seen?

Secret

Como um valor chega ao cluster sem ser visto?

Secret · createbuilt

A secret is encrypted on your machine, before it leaves it

Secret · createpronto

Um secret é cifrado na sua máquina, antes de sair dela

~/example
# Two keys, each from an environment variable$ nereus secrets create google-oauth \    --from-env GOOGLE_CLIENT_ID \    --from-env GOOGLE_CLIENT_SECRET✓ secrets/vaults/default/secrets/google-oauth created (key SHA256:GQ8TrJ9h6ZrNYHItBycWK+tXkURjowfJWcjEyabRIKI)Stored encrypted; a Kubernetes Secret is made only when a binding asks for it (#532). Next steps:   nereus secrets get default/google-oauth
Secret · create againbuilt

Creating it again is refused, with how to change it

Secret · create de novopronto

Criar de novo é recusado, com o jeito de mudá-lo

~/example
# Create it again$ nereus secrets create google-oauth \    --from-env GOOGLE_CLIENT_ID✗ secrets/vaults/default/secrets/google-oauth already exists. To change it, write it as a file, then apply the file:  nereus secrets create google-oauth --from-env GOOGLE_CLIENT_ID --dry-run --output yaml > google-oauth.yaml  nereus secrets apply --from-file google-oauth.yaml
Secret · create from a filebuilt

A key can come from a file, such as a private key

Secret · create a partir de arquivopronto

Uma chave pode vir de um arquivo, como uma chave privada

~/example
# A private key from a file, and an id from the environment$ nereus secrets create github-app \    --vault default \    --from-file private-key=key.pem \    --from-env APP_ID✓ secrets/vaults/default/secrets/github-app created (key SHA256:GQ8TrJ9h6ZrNYHItBycWK+tXkURjowfJWcjEyabRIKI)Stored encrypted; a Kubernetes Secret is made only when a binding asks for it (#532). Next steps:   nereus secrets get default/github-app
Secret · applybuilt

Apply takes a folder of secrets, and the second apply changes nothing

Secret · applypronto

O apply recebe uma pasta de secrets, e o segundo apply não muda nada

~/example
# Write each secret as a file$ nereus secrets create google-oauth \    --from-env GOOGLE_CLIENT_ID \    --from-env GOOGLE_CLIENT_SECRET \    --dry-run \    --output yaml > secrets/google-oauth.yaml # The second one$ nereus secrets create github-app \    --from-file private-key=key.pem \    --from-env APP_ID \    --dry-run \    --output yaml > secrets/github-app.yaml # Apply the folder$ nereus secrets apply \    --from-file secrets✓ secrets/vaults/default/secrets/github-app configured✓ secrets/vaults/default/secrets/google-oauth configured Next steps:   nereus secrets list # Apply it again$ nereus secrets apply \    --from-file secretssecrets/vaults/default/secrets/github-app unchangedsecrets/vaults/default/secrets/google-oauth unchanged Next steps:   nereus secrets list
Secret · listbuilt

The list shows every secret with its keys, never a value

Secret · listpronto

A lista mostra todo secret com as suas chaves, nunca um valor

~/example
# Every secret$ nereus secrets listVAULT    NAME          KEYS                  STATUS  AGEdefault  github-app    APP_ID, +1            Ready   4sdefault  google-oauth  GOOGLE_CLIENT_ID, +1  Ready   5s
Secret · getbuilt

One secret, by its vault and name

Secret · getpronto

Um secret, pelo seu vault e o seu nome

~/example
# One secret$ nereus secrets get default/google-oauthVault     defaultName      google-oauthKeys      GOOGLE_CLIENT_ID          GOOGLE_CLIENT_SECRETVersion   2Location  openbao: secret/nereus/default/google-oauthBindings  -Status    ReadyAge       10s
Secret · get as yamlbuilt

As YAML, the object shows the names of its keys instead of the envelopes

Secret · get em yamlpronto

Em YAML, o objeto mostra os nomes das suas chaves no lugar dos envelopes

~/example
# The object, without its values$ nereus secrets get google-oauth \    --output yamlapiVersion: secrets.getnereus.dev/v1alpha1kind: Secretmetadata:  name: default.google-oauth  namespace: nereus-systemspec:  vault: default  keys:  - GOOGLE_CLIENT_ID  - GOOGLE_CLIENT_SECRETstatus:  location: 'openbao: secret/nereus/default/google-oauth'  mandate: default  nereid: openbao  phase: Ready  version: '2'
Vault

Where are secrets kept, and who may bind them?

Vault

Onde os secrets ficam, e quem pode vinculá-los?

Vault · listbuilt

The list shows every vault, its Nereid and how many secrets it holds

Vault · listpronto

A lista mostra todo vault, a sua Nereid e quantos secrets ele guarda

~/example
# Every vault$ nereus secrets vault listNAME     NEREID   NAMESPACES     SECRETS  STATUS  AGEdefault  openbao  nereus-system  2        Ready   4m
Vault · createbuilt

A vault for a team, with the namespaces allowed to bind its secrets

Vault · createpronto

Um vault para um time, com os namespaces que podem vincular os seus secrets

~/example
# A vault the identity and tools namespaces may bind$ nereus secrets vault create team-a \    --allow-namespace identity \    --allow-namespace tools✓ secrets/vaults/team-a created Next steps:   nereus secrets create <secret> --vault team-a --from-env <VAR>
Vault · delete, heldbuilt

A vault that holds secrets is refused, with what to delete first

Vault · delete, ocupadopronto

Um vault que guarda secrets é recusado, com o que apagar antes

~/example
# The vault default still holds two secrets$ nereus secrets vault delete default✗ secrets/vaults/default holds secrets github-app, google-oauth. Delete them first:  nereus secrets delete default/github-app  nereus secrets delete default/google-oauth
Vault · delete a secretbuilt

A secret goes by its full name, or by its name in the vault default

Vault · delete de um secretpronto

Um secret sai pelo seu nome completo, ou pelo seu nome no vault default

~/example
# By vault and name$ nereus secrets delete default/google-oauth✓ secrets/vaults/default/secrets/google-oauth deleted Next steps:   nereus secrets list # A bare name is in the vault default$ nereus secrets delete github-app✓ secrets/vaults/default/secrets/github-app deleted Next steps:   nereus secrets list
Vault · deletebuilt

An empty vault goes

Vault · deletepronto

Um vault vazio sai

~/example
# Delete the vault team-a$ nereus secrets vault delete team-a✓ secrets/vaults/team-a deleted Next steps:   nereus secrets vault list
Binding

How does a pod read a secret?

Binding

Como um pod lê um secret?

Binding · binding createbuilt

A binding makes a Kubernetes Secret from a secret, in a namespace the vault allows

Binding · binding createpronto

Um binding faz um Secret do Kubernetes a partir de um secret, num namespace que o vault permite

~/example
# Keycloak, in the namespace identity, reads the Google client under its own key names$ nereus secrets binding create keycloak-google \    --secret default/google-oauth \    --namespace identity \    --key client-id=GOOGLE_CLIENT_ID \    --key client-secret=GOOGLE_CLIENT_SECRET✓ secrets/vaults/default/secrets/google-oauth/secretbindings/identity/keycloak-google createdSecret keycloak-google ready in namespace identity. Next steps:   nereus secrets binding get keycloak-google --namespace identity
Binding · binding create, refusedbuilt

A namespace the vault does not allow, or a key the secret does not have, is refused before anything is written

Binding · binding create, recusadopronto

Um namespace que o vault não permite, ou uma chave que o secret não tem, é recusado antes de qualquer escrita

~/example
# The vault default does not allow the namespace payments$ nereus secrets binding create payments \    --secret default/google-oauth \    --namespace payments✗ secrets/vaults/default does not allow namespace payments (it allows: nereus-system, identity, tools).  Allow it: write the vault as a file, add payments to spec.allowedNamespaces, then apply the file:  nereus secrets vault get default --output yaml > default.yaml  nereus secrets vault apply --from-file default.yaml # The secret has no key NOT_A_KEY$ nereus secrets binding create missing \    --secret default/google-oauth \    --namespace identity \    --key x=NOT_A_KEY✗ secrets/vaults/default/secrets/google-oauth has no key NOT_A_KEY (it has: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET)
Binding · a chart asksbuilt

A chart asks for its secret with a SecretBinding among its templates

Binding · um chart pedepronto

Um chart pede o seu secret com um SecretBinding entre os seus templates

~/example
# The template of test/charts/binding-demo$ cat test/charts/binding-demo/templates/secretbinding.yamlapiVersion: {{ .Values.apiGroup }}/v1alpha1kind: SecretBindingmetadata:  name: {{ .Release.Name }}  namespace: {{ .Release.Namespace }}  labels:    {{- include "binding-demo.labels" . | nindent 4 }}spec:  secret: {{ required "secret is <vault>/<secret>" .Values.secret | quote }} # Installed with Helm, into the namespace tools$ helm install binding-demo test/charts/binding-demo \    --namespace tools \    --create-namespace \    --wait
Binding · binding listbuilt

Every binding, with who asked for it

Binding · binding listpronto

Todo binding, com quem o pediu

~/example
# In every namespace$ nereus secrets binding listNAME             SECRET                NAMESPACE  FOR                 STATUS  AGEkeycloak-google  default/google-oauth  identity   system:admin        Ready   12sbinding-demo     default/google-oauth  tools      chart binding-demo  Ready   4s
Binding · where a secret is usedbuilt

A secret says where it is used, and is not deleted while it is

Binding · onde um secret é usadopronto

Um secret diz onde é usado, e não sai enquanto é

~/example
# The secret lists its bindings$ nereus secrets get default/google-oauthVault     defaultName      google-oauthKeys      GOOGLE_CLIENT_ID          GOOGLE_CLIENT_SECRETVersion   2Location  openbao: secret/nereus/default/google-oauthBindings  identity/keycloak-google  by system:admin        Ready          tools/binding-demo        by chart binding-demo  ReadyStatus    ReadyAge       30s # And is refused while they are there$ nereus secrets delete default/google-oauth✗ secrets/vaults/default/secrets/google-oauth is used by 2 bindings: identity/keycloak-google, tools/binding-demo. Delete them first:  nereus secrets binding delete keycloak-google --namespace identity  nereus secrets binding delete binding-demo --namespace tools
Binding · binding deletebuilt

A binding goes, and its Kubernetes Secret with it

Binding · binding deletepronto

Um binding sai, e o seu Secret do Kubernetes com ele

~/example
# The binding keycloak-google$ nereus secrets binding delete keycloak-google \    --namespace identity✓ secrets/vaults/default/secrets/google-oauth/secretbindings/identity/keycloak-google deleted Next steps:   nereus secrets binding list --namespace identity