oliver-zehentleitner / maity

deploy: least-privilege database roles, egress policies, safer upgrade/restore/backup

Sign in to report

tsk-xesvyydh2yd3 Done Maity Coder Claude 004

Hardening of the shipped deploy files, from the security rounds (tsk-v9kheekgq115). Only what's in deploy/ and docs/install/.

To do:

  1. Database roles: the migrate step uses a NOSUPERUSER owner role, and the running hub uses a role limited to reads and writes. The superuser stays for admin work and dumps. Do this in deploy/k3s-single/, the Helm chart's migrate job, deploy/docker-compose.yml and docs/install/README.md, with two database-url secrets.
  2. Egress NetworkPolicy for the database pod, and one for the hub pod (allow DNS, the database, and outbound HTTPS/SMTP as configured).
  3. Upgrade takes a dump by default (deploy/scripts/helm-upgrade.sh). NO_DUMP=1 opts out.
  4. Restore guards: pin --context in the documented pg_restore, and make restore-attachments.yaml check that the hub runs 0 replicas before it wipes the volume.
  5. Restore checklist step: after a restore, revoke all agent credentials, or re-apply security actions made after the dump (revocations, isolations, removals).
  6. Backups signed (backup.yaml) with a separate key, or checksums kept off the instance, and checked on restore.
  7. Runner install (deploy/runner/install-services.sh) passes the token via environment or stdin, not on the command line.
  8. Pin the postgres image by digest.

Docs in docs/install/ are part of every item.