Secrets
The server stores secrets for pipelines (hod secret set) encrypted with a key that never goes into the database. Postgres, its logs, replicas and backups only ever hold ciphertext.
-
Back the key up apart from the database. Without it, stored secrets can't be read; with it and a backup, they all can.
-
Give the file to the server's user only. The server refuses a key file its group or others can read. With systemd,
LoadCredential=secrets.key:/etc/hod/secrets.keyandHOD_SECRETS_KEY_FILE=%d/secrets.key; on Kubernetes, mount a Secret withdefaultMode: 0400. The key is never given as a value in the environment. -
The server won't start if secrets are stored and no key, or the wrong key, is configured.
-
Rotating the key:
hod-server generate-key new.key;- set
HOD_SECRETS_KEY_FILEto the new key and add the old one toHOD_SECRETS_OLD_KEY_FILES(orsecrets.key_fileandsecrets.old_key_filesin the config file); - restart every server;
- run
hod-server rotate-keywith the same configuration. It rewraps each secret's data key with the new key (values aren't re-encrypted) and says when no secret needs the old key; - remove the old key. Until then the server warns at startup.
Rotation doesn't undo a leak: an old key still opens old backups. If a key may have leaked, rotate it and also change the secrets themselves.
-
Releases are audited. When the server assigns a job, it decrypts each secret the job's steps are granted and sends it to the runner with the job; the
secret_releasestable records which secret (its scope, name and version) went to which job, step and attempt. A job granted a secret it can't have (not set, refused by the secret's rule or by its seal, or a fork's run) fails withsecretbefore it reaches a runner. -
A secret can be sealed to published components (
--component), and pinned to the inputs that say where they send it (--with): see Components.