pushleft
Deploy your first app
Manual contents
Handbook
HandbookPushleftArchitecture
Operate
Install the control planeYour own serversFleetOperations and alertsAuthenticationAccess gateDomains and DNSUsage and budgetsScheduled jobsAbuse controlsAI provider proxyCustomer mailErrors and performanceLogs and metricsRetentionObject storageContainer registryGit server
Develop
The .pl.yaml manifestOnboard with an AI agentThe pl up demoBuild executorSource ingestionAgent gatewayManaged databasesSecurity findingsTunnels and shellsDev workspacesPrivate hostnamesMesh coordinatorsDesign baseline
Runbooks
Control-plane host failoverControl-plane PostgreSQL failoverControl-plane PostgreSQL restoreCustom domains and certificatesGateway key compromiseIngress host failureNode busyNode disk fullNode drain and replacementNode lostRegistry outageHetzner Robot hostsSecret rotationSecurity incidentStaging fleet on ProxmoxStaging build cacheStuck deploymentVault/OpenBao backup and recovery
More
CI pipelines
Manual · docs/runbooks/secret-rotation.md

Secret rotation

Use this runbook when a secret leaks, when a person with access leaves, or when you rotate on a schedule.

Each service reads a secret at a fixed time. That time decides whether the rotation needs a restart. The table was checked against the code.

SecretRead byWhen it is readRotation needs
PUSHLEFT_DEV_TOKEN (development mode only)APIstartupAPI restart
API tokens and console sessions (production)APIper request, by hashnothing; revocation applies to the next request
Registry token signing key PUSHLEFT_REGISTRY_TOKEN_KEY_FILE and certificategatewaystartup (registry::load)gateway restart, plus the registry’s rootcertbundle
Registry realm secret PUSHLEFT_REGISTRY_SCHEDULER_SECRET_FILEgateway, schedulerstartup (registry::load, Retention::from_env)gateway and scheduler restart
Vault token file PUSHLEFT_VAULT_TOKEN_FILEgateway, API, controller, scheduler (leftovers), AI proxy, mail, git backup (nodes and the mesh controller hold none)startup (VaultClient::new); git backup at each runrestart of that one service
Cloudflare tokencontroller (env value), mesh (file)startuprestart
DATABASE_URL passwordsevery servicestartup (pool)restart
Gateway/telemetry TLS keys, agent CA keygatewaysstartuprestart (CA/key compromise)

For the expiry date of each credential, see credential lifetimes.

Development token

Development mode is loopback-only. Never use it in production.

  1. Write a new token in the checkout. The script creates the file with mode 0600 and does not print the old value.

    rm .env.herdr && scripts/dev setup
  2. Restart scripts/dev api and each shell that exported PUSHLEFT_TOKEN.

The token was in git history once. We rotated it and rewrote the history on 17 October 2026, before the repository had a remote. If .env.herdr shows up in a diff again, rotate it in every checkout before you push.

Production API tokens

  1. List the tokens of the organization. Admins see all of them.

    curl -fsS -H "Authorization: Bearer $ADMIN" https://api.pushleft.dev/v1/auth/tokens
  2. Revoke the leaked token.

    curl -fsS -X DELETE -H "Authorization: Bearer $ADMIN" -H 'X-Pushleft-CSRF: 1' https://api.pushleft.dev/v1/auth/tokens/<id>
  3. Issue a replacement, if one is needed.

    curl -fsS -H "Authorization: Bearer $ADMIN" -H 'Content-Type: application/json' -d '{"name":"ci","service":true,"role":"member"}' https://api.pushleft.dev/v1/auth/tokens

The API checks revocation on the next request. SSE streams close within about 750 ms. Each revocation writes a token_revoked row in auth_events.

If the owner token is lost, issue a new token for the same owner (onboarding and revocation):

DATABASE_URL=$OWNER_URL pushleft-api bootstrap-owner --email <owner>

Registry credential

There is no registry login (H1, registry tokens). The gateway signs tokens that are valid for 15 minutes and for one repository. Two secrets remain: the signing key and the realm secret.

Signing key

The key is in PUSHLEFT_REGISTRY_TOKEN_KEY_FILE, and its certificate is in PUSHLEFT_REGISTRY_TOKEN_CERT_FILE.

  1. Generate a new P-256 key and certificate.

    openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -days 3650 \
      -subj '/CN=pushleft registry token' -keyout registry-token.key -out registry-token.crt
  2. Append the new certificate to the registry’s rootcertbundle. Keep the old one.

  3. Restart the registry.

  4. Write the new key and certificate to the gateway’s files. The owner is pushleft, and the key mode is 0600.

  5. Restart the gateway.

    systemctl restart pushleft-agent-gateway
  6. Wait 15 minutes (the token lifetime).

  7. Remove the old certificate from the bundle and restart the registry.

On a key compromise, do not wait at step 6. Remove the old certificate at once. Tokens in flight then fail, and their callers retry.

Realm secret

The gateway and the scheduler both read PUSHLEFT_REGISTRY_SCHEDULER_SECRET_FILE.

  1. Write the same new secret to both files, with mode 0600.

    openssl rand -hex 32
  2. Restart the gateway and the scheduler. Deletes that fail between the two restarts are retried by the next retention pass.

Check the registry rotation worked

  • A test pl up reaches live.
  • The next retention pass records image_release_status = 'deleted' for an eligible artifact (registry retention).

Vault/OpenBao token

Nodes hold no Vault token. Of the services that hand node secrets out, only the gateway (pushleft-agent-gateway.hcl) holds one. The mesh controller holds none since 2026-11-03. The other tokens are on the control-plane host, one per service, each with its policy from deploy/vault:

ServiceToken filePolicy
pushleft-agent-gateway/etc/pushleft/agent-gateway/vault-tokenpushleft-agent-gateway
pushleft-api/etc/pushleft/api/vault-tokenpushleft-api
pushleft-controller/etc/pushleft/controller/vault-tokenpushleft-controller
pushleft-scheduler (since 2026-11-05, deletes purged projects’ leftovers)/etc/pushleft/vault-scheduler/tokenpushleft-scheduler-leftovers
pushleft-ai-proxy/etc/pushleft/ai-proxy/vault-tokenpushleft-ai-proxy
pushleft-mail/etc/pushleft/mail/vault-tokenpushleft-mail
pushleft-git-backup (hourly oneshot)/etc/pushleft/git-backup/vault-tokenpushleft-git-backup

The tokens are periodic orphans (token create -orphan -period=72h -policy=<policy>). Each service renews its own token while it runs (Vault service tokens). The tokens do not expire, so you rotate them only when you choose to.

  1. Issue a new periodic orphan token with the same policy.

    bao token create -orphan -period=72h -policy=<policy> -field=token
  2. Write it atomically to the service’s token file on the host, with mode 0600 and the service’s owner.

  3. Restart that service. For the gateway, agents retry their lease and heartbeat calls, and leases survive a short restart. pushleft-git-backup reads its file at its next run and needs no restart.

    systemctl restart pushleft-agent-gateway
  4. Revoke the old token in Vault after the service has restarted. Wrapping tokens that the gateway issued stay valid until their 5-minute TTL.

  5. On older nodes that still have /etc/pushleft/credentials/vault-token, delete the file and revoke that token. pushleft-agent doctor warns while the file exists.

Check the Vault rotation worked

  • A manage_database ensure_instance or backup job succeeds, and the gateway logs no secret wrap failed.
  • The restarted service’s /readyz answers 200, and it logs no vault_token_renewal_failed.

If Vault itself is lost or sealed, use Vault recovery.

Database passwords

  1. Set the new password on the role.

    ALTER ROLE pushleft_<service> PASSWORD '...';
  2. Update DATABASE_URL in /etc/pushleft/<service>.env.

  3. Restart that one service. Existing connections keep working until the restart.

Do not

  • Do not put secret values into jobs.payload, deployment_events or results. The gateway refuses secret-shaped result fields. Nothing else checks.
  • Do not loosen file modes to share a file between users. The binaries refuse key files that a group or other users can read.
Rendered from the repository at build time. Edit docs/runbooks/secret-rotation.md to change it.