Skip to content

Recover agent identities when restoring a snapshot predating certificate renewal #487

Done

Description

@samuelmbabhazi

Problem

Restoring an instance backup made before a node successfully renewed its certificate can leave that node unable to reconnect. Keeping the same CA is insufficient: the gateway also requires the presented certificate serial to exist in the restored database. The agent keeps the newer certificate, whose serial did not exist at the backup's time.

The restore procedure and documentation currently promise that existing servers reconnect automatically with their existing identities. This case does not satisfy that promise and can require operator recovery after a disaster restore.

Audited revision: 1295e534d7a1c3cd0a492449de8806aa532a4924.

A pre-publication comparison of this snapshot with main 2ee78ff1e96118b1732b98bc54c99f5f91b95a32 found that the only intervening change was to apps/api/src/modules/deployments/application/exec-sessions.spec.ts. None of the affected production paths changed.

Scenario and evidence

  1. Enroll a node and create an instance backup containing its current registered certificate serial A.
  2. Renew the node certificate successfully. The control plane commits serial B, and the agent receives and persists it.
  3. Restore the older instance backup, including the CA and database, then point the same gateway name at the restored instance.
  4. The node presents B. Its signature can be valid under the restored CA, but B is absent from the restored credential registry, so gateway authentication rejects it.
  5. The agent requires operator recovery rather than silently enrolling again.

Relevant sources:

Verification and limits

This finding comes from tracing the restore, renewal, registry lookup and reconnect behavior in source. No actual backup restore, certificate rotation against a running gateway, or VM test was performed for this audit. It applies when a successful renewal occurred after the selected backup; it does not claim that all restored agents fail to reconnect. Existing workloads may keep serving locally while control-plane management is unavailable.

This is also not the documented lost-response renewal case: here the renewal response was received and persisted normally.

Proposed correction

Define and test the post-restore identity recovery contract. At minimum, qualify the documentation and completion message and provide an explicit operator-authorized recovery procedure that preserves the node's logical identity and its allocations. If automatic recovery is intended, design it without accepting every certificate signed by the CA or weakening revocation and tenant checks. Any change to those invariants needs an explicit design decision.

Acceptance criteria

  • A disposable integration environment enrolls a node, takes a backup, successfully renews and persists its certificate, then restores the backup.
  • The supported recovery path restores management of that same node and preserves its allocations, with auditable authorization if operator action is required.
  • Revoked, removed, wrong-node and wrong-organization credentials remain rejected; recovery cannot silently bypass revocation.
  • Documentation states which post-backup identity changes need recovery and distinguishes management recovery from continued local workload service.
  • The restore command does not report unconditional automatic reconnection when its prerequisites are absent.

Related work

Follow-up to closed #231, whose acceptance requires a restored control plane to re-adopt existing agents, and the identity work in closed #14. #227 covers retry-safe renewal after a lost response; this issue covers database rollback after a successful renewal. #439 concerns substitution of the wrong archive; this failure is possible with the correct, intentionally selected archive.

Activity

  1. added
    bug
    priority:P1
    v0.1-stable
    on Nov 25, 2026
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

    bugpriority:P1track:cross-cuttingv0.1-stable

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions