Skip to content

On Postgres the daemon anchors the audit chain but every reader reports the anchor unsupported and exits 2 #558

Open

Description

@vladimirrott

With a Postgres audit store and SYSKNIFE_CHECKPOINT_DB set, the daemon anchors the chain every 15 minutes, and every reader reports the anchor as unsupported and exits 2. Tail truncation on Postgres is never detected.

What happens

  • start_checkpoint_anchoring hands state.audit (an Arc<dyn AuditStore>, which can be the Postgres store) to spawn_periodic_anchor, which reads fetch_chain_rows() through the trait. Postgres chains are anchored.
  • verify_configured_anchor (apps/sysknife-cli/src/runner.rs:1483-1506) short-circuits every Postgres config with CannotVerify { reason: "checkpoint anchoring is implemented for the sqlite backend only ..." }. The daemon's own behaviour contradicts that reason.
  • sysknife audit checkpoint ignores [storage] and opens a SQLite store only. Since fix(audit): resolve checkpoint and MCP stores consistently #636 it picks the file with sysknife_core::resolve_audit_store() (runner.rs:1371-1402), which chooses between SQLite paths and never reads the backend.

A correctly configured Postgres deployment therefore gets a permanent exit 2, which teaches the operator to ignore 2.

Docs, same area

  • SECURITY.md:563-584 tells operators to set SYSKNIFE_CHECKPOINT_DB with systemctl edit sysknife-daemon. verify_configured_anchor reads it from the calling shell (runner.rs:1491), and sudo sysknife audit verify, the form the docs recommend for system stores, resets the environment. That run prints the "no anchor configured" caveat while the daemon is anchoring.
  • docs/configuration.md:115 describes the variable as used by audit checkpoint only.
  • docs/the-audit-chain.md:499 says "Three checks run". The code runs a fourth check, the status cross-check, which can exit 1. (The "out of scope by design" line this item also quoted is gone: fix(audit): chain SQLite status transitions and expose verdicts #571 rewrote that part of the page to describe status_check, at 309-335.)

Fix

  1. In verify_configured_anchor, read rows through the Postgres store when the backend is Postgres and call verify_against_anchor. Make run_audit_checkpoint honour [storage] too.
  2. Fix the three docs points. For the environment one, either document sudo -E / setting it in the verifying shell, or read the anchor URL from config.toml so daemon and CLI share one source. I lean to config.toml.

Done when

A Postgres contract test (the suite already runs in CI) anchors, truncates the tail, and expects Truncated from audit verify.

Nearest existing: #221 (closed), an inconclusive anchor masking a broken chain.

Getting started

CONTRIBUTING.md has the build and test commands. No CLA and no copyright waiver. The project is MIT; sign off each commit with git commit -s (the required dco check enforces it since #732).

Activity

  1. added
    bugSomething isn't working
    mediumDifficulty: needs familiarity with one subsystem
    on Oct 1, 2026
  2. vladimirrott commented on Oct 1, 2026

    @vladimirrott
    MemberAuthor

    @Georgefifth You've worked inside the chain columns and the signed approval events, so the Postgres anchor read is close to code you know. I'm holding it for you if you want it.

  3. added
    claimedSomeone has said in the thread that they are working on this
    on Oct 1, 2026
  4. vladimirrott commented on Oct 13, 2026

    @vladimirrott
    MemberAuthor

    @Georgefifth I held this for you on 1 October and I'm putting it back in the pool so someone else can pick it up. Say so here if you want it later and it's yours again.

  5. removed
    claimedSomeone has said in the thread that they are working on this
    on Oct 13, 2026
  6. vladimirrott commented on Oct 21, 2026

    @vladimirrott
    MemberAuthor

    Updated SECURITY.md:469-490 to :475-496 in the body; #609 added six lines above the anchoring section and the block is otherwise identical. Also added a Getting started section. At ed7c59da the defect stands: verify_configured_anchor still returns CannotVerify for a Postgres backend (apps/sysknife-cli/src/runner.rs:1474-1484).

  7. added
    twir-listedListed in a This Week in Rust CfP. Do not offer to anyone until that issue publishes.
    on Oct 24, 2026
  8. vladimirrott commented on Oct 26, 2026

    @vladimirrott
    MemberAuthor

    Line numbers moved after #626 merged today. I updated the anchors in the body; the code they point at is unchanged:

    • runner.rs:1462-1485 → :1473-1496
    • runner.rs:1355-1382 → :1366-1393
    • runner.rs:1470 → :1481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmediumDifficulty: needs familiarity with one subsystemtwir-listedListed in a This Week in Rust CfP. Do not offer to anyone until that issue publishes.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions