Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Operation

Summary: how to deploy and run a secrets server: the three origins, configuration, storage and backups, limits, logging, hardening, and the capacity of one process.
Key terms: web origin, API origin, admin origin, discovery, server.toml, SQLite, PostgreSQL, backup, request log, one process per database.
Related: Self-host recipe · Data · Spec §14

A secrets deployment is one secrets-server process, one database (SQLite or PostgreSQL), and a static web app. The server holds no secret key material, so a deployment needs no key management service; the database holds only ciphertext and metadata. The web app should come from a host other than the API server, because whoever controls the web app’s files can steal keys from the people who use it. One process serves one database: secrets scales up on one machine and does not run several server processes against one database.

The picture as text
flowchart LR
    B[Browser] -->|static files| W[Web origin<br/>static host or CDN]
    B -->|HTTPS, DPoP| P[Proxy or tunnel]
    C[CLI, CI, agents] -->|HTTPS, DPoP| P
    P --> S[secrets-server<br/>127.0.0.1:8470]
    S --> D[(SQLite file<br/>or PostgreSQL)]
    D --> K[Backups]
    O[Operator on a private network] --> A[Admin listener<br/>127.0.0.1:8471]
    A --- S

Why one process

PartReason it stays in one process
Log appendsSQLite serializes them through one writer connection
Write rate limitwrites_per_minute is a token bucket in memory
Audit of readsRead events wait in a memory buffer and are stored once per second
CapacityA small VM (1 vCPU, 1 GB RAM) serves hundreds of users; a bulk read answers in milliseconds

PostgreSQL can be made highly available on its own, but the server does not coordinate several processes. auth-chad’s account limits are already counted in the database.

Origins and discovery

OriginServesExample
Web originThe static web app, config.json and the discovery documenthttps://secrets.example.com
API originThe public listenerhttps://secrets-api.example.com
Admin originThe admin listener, on a private network onlyhttps://secrets-admin.internal.example.com

A client given a host fetches https://HOST/.well-known/secrets-server. Both the web origin and the API origin serve the same document. Prefer a single-level API name such as secrets-api.example.com: many CDN certificates cover one subdomain level only.

Configuration

/etc/secrets/server.toml; every key can be overridden with SECRETS_SERVER_<KEY>.

public_listen = "127.0.0.1:8470"
admin_listen  = "127.0.0.1:8471"
database      = "sqlite:///var/lib/secrets/secrets.db"   # or "postgres:///secrets?host=/run/postgresql"
issuer        = "https://secrets-api.example.com"
web_origins   = ["https://secrets.example.com"]
auth_path     = "/v1/auth"
client_ip_header = "X-Real-IP"          # one address set by the proxy; omit to use the socket address

[rate_limits]
auth_per_minute   = 20
writes_per_minute = 600

[audit]
days    = 365
ip_days = 30                            # 0 stores no IP addresses

The server refuses to start when admin_listen binds a public address, unless allow_public_admin = true.

Storage and backups

BackendURLBackups
SQLite (default)sqlite:///path/to/secrets.dbAny tool that copies a WAL database consistently, for example Litestream. The server runs no checkpoint or VACUUM of its own
PostgreSQL 15 or laterpostgres://… (no password in the URL)The operator’s: pg_dump or WAL archiving
  • Migrations are embedded and run at startup in a transaction.
  • auth-chad’s account tables are in the same database, so a signup or a device approval is one transaction.
  • A backup holds no plaintext secret and no usable credential. It shows the metadata listed in what the server sees.
  • For PostgreSQL, prefer authentication without a password (a Unix socket with peer). Otherwise put the password in the file named by database_password_file.

Limits

LimitDefault
Account calls without a login, per address and minute20 (auth_per_minute), counted in the database
Writes through project routes, per address and minute600 (writes_per_minute)
Request time, idle keep-alive10 s, 60 s
Request body128 KiB; 1 MiB for bulk writes; 8 MiB for identity key replacement
Projects per user, environments per project, secrets per environment25, 20, 1,000
Value size64 KiB

Logging and metrics

  • The server writes nothing about request content to its logs.
  • The optional request log ([request_log], off by default) writes one line per request with fields from a fixed set: time, method, route template, status, duration, actor, client address, request ID, body sizes.
  • Tokens, proofs, envelopes, wraps, ciphertexts, IDs in paths and query strings are never logged.
  • GET /metrics on the admin listener gives Prometheus text.

Process hardening

Run the server under systemd as its own user with a strict sandbox: NoNewPrivileges=yes, ProtectSystem=strict, ReadWritePaths=/var/lib/secrets, PrivateTmp=yes, PrivateDevices=yes, IPAddressAllow=localhost, IPAddressDeny=any, MemoryDenyWriteExecute=yes, SystemCallFilter=@system-service, LimitCORE=0, MemoryMax=256M. The full list is in spec §14.6.

Releases

  • Server and CLI share a version and are tagged vX.Y.Z.
  • A release has the binaries for each platform and the web bundle as .tar.gz with its SHA-256 (spec §15.4).
  • cargo xtask web --issuer URL --web URL [--auth-path PATH] writes a web bundle with its config.json.

Where the details are