Skip to content

v6.8.0

Choose a tag to compare

@n36l3c7 n36l3c7 released this 21 Nov 12:21
· 9 commits to main since this release
85fd3a9

Who takes the disk reads nothing: the files Nik holds are encrypted where they lie, the keys leave .env, the audit log cannot be altered unseen and is sent to syslog, and one page says whether the server is well.

Run deploy/init-env.sh before starting: the server needs its store key. Read Upgrading.

What changed

  • The store is encrypted on the disk: every file (samples, e-mails, captures) encrypted and authenticated under a new key, STORE_KEY, that is in no database and in no backup. A store from before is sealed in the background, with progress and a pause in Settings → Storage.
  • The workers no longer mount the store or hold its key: the backend sends each the file its job needs.
  • Secrets in files instead of .env, one for each container that uses it; deploy/secrets.sh move moves an existing install.
  • Settings → Keys: every secret by a fingerprint, where it comes from and who holds it, and a guided change of SECRET_KEY, STORE_KEY, the key of the audit log and the backup passphrase.
  • The audit log is a signed chain: each entry carries the hash of the one before it and a signature made with a key outside the database. The server verifies it by itself and on demand, and names what was changed, removed, moved or forged.
  • The audit log is sent to syslog as it is written (RFC 5424 with the entry as JSON; TLS, TCP or UDP), in order, with checkpoints.
  • Settings → System → Health: disks and when they will be full, queues, workers, backups, database, certificate, audit log, keys and encryption, with warnings before things break.
  • Metrics for Prometheus at /api/metrics, behind a scrape token.
  • A damaged or replaced file is never served, and a server without its store key stays up and says so.

Upgrading

git pull
deploy/init-env.sh
podman compose up -d --build
  • deploy/init-env.sh adds STORE_KEY to an existing install and nothing else. Migration 0051_audit_chain runs after the snapshot and the rehearsal.
  • Keep a copy of STORE_KEY off the server, apart from the backups. The store cannot be read without it; the backups can.
  • The store is sealed in the background, about half a minute for each gigabyte; files from before stay in clear until it ends.
  • To send the audit log to a syslog receiver, set it in Settings → Audit log.
  • /api/metrics answers 401 without a scrape token made on the Health page; the path label of the request metrics now begins with /api.
  • deploy/secrets.sh move takes the secrets out of .env when it suits; the file it leaves beside .env holds every secret in clear until it is destroyed.

Choices made

  • A backup does not depend on the store key: it holds the files under the backup passphrase, and a restore seals them under the key of the server that restores. A key lost with the host must not make the backups useless.
  • The workers are sent bytes rather than given the key: they parse hostile files and are the most likely thing to be subverted.
  • Secrets as files mounted one by one, not compose secrets:, which the two compose engines do not treat alike. The files are readable inside a directory that is not: the directory is the protection.
  • A rotation is asked for on the screen and carried out by a command on the host: the server cannot write its own secret files. The earlier key is kept until everything is proven readable under the new one.
  • The plain chain stays beside the signature: a syslog receiver's copy can be checked with no secret; the signature is what a person with the database alone cannot redo.
  • An existing install signs with a key derived from SECRET_KEY until it is given one of its own; changing SECRET_KEY carries the old derived key along by itself.
  • No guard inside the database against editing the audit table: a trigger would make the backups refuse the database. The chain and the copy outside are the protection.
  • Nothing is trimmed from the audit log by itself. Clearing it needs a signed-in administrator and leaves an entry that says what went.
  • JSON only in the syslog message; no CEF.
  • A change of the forwarding is sent to the old receiver before it takes effect.
  • Metrics through the web port with a token of their own, closed without one; before, they were open on the compose network.
  • The sign-in limit is off for the end-to-end test server only; the built-stack smoke test still proves it.

Known limits

  • The database is not encrypted on the disk: incidents, analysis results, the text of e-mails and the audit log are readable by whoever takes it. Only the files of the store and the stored secrets are protected.
  • The key and the store are on the same disk unless NIK_SECRETS_DIR points elsewhere: whoever takes the whole host reads everything.
  • In clear for a while: a large capture on the pcap-work volume while it is open, a PST on pst-work while it is converted, a sample in a worker's memory.
  • What the disk still tells: how many files, their sizes and times, and the SHA-256 of each sample and e-mail.
  • Whoever holds the database and the audit key can sign a rewrite, and a signature says nothing of a cut tail: the copy at the syslog receiver is what proves the log.
  • Writing to the audit log is one at a time: about 250 entries a second on the development machine.
  • The database's own disk cannot be measured from the server; the Health page says so.
  • python -m app.auditlog verify-audit run by hand in the container cannot note the head it found; the server's own pass does.

Not verified on real systems

  • Podman: nothing ran under it. How the secret files are mounted there follows the reading of podman-compose, not a run.
  • The proofs ran on a small store (ten files, under a hundred megabytes for the last ones; under a gigabyte for the conversion and the timings).
  • Syslog: TLS against rsyslog and plain TCP were proven in containers; UDP, a client certificate and a real SIEM were not.
  • The end-to-end suite with the real analysis workers runs in CI only; on the development machine one start of two stopped on a password check the machine got wrong.
  • Migration 0051, the sealing of a real store and the move of the secrets have not met the server.