canopy-manage Reference

For an operator who must do something no service API offers: generate key material, or act on a database directly. canopy-manage is that tool (ADR-007 Amendment 6; tools/canopy-manage). canopy-manage --help and canopy-manage <job> --help are authoritative for flags.

Which tool

Tool For

canopy (canopy CLI Reference)

Everything a service’s API offers. It signs in as the operator and is authorized by the service like any caller.

canopy-manage

Work below the API: key material, and jobs that hold a database credential. Run on a host that already holds what the job needs.

cargo xtask (cargo xtask Subcommand Catalog)

A developer’s or CI’s work on a checkout or a devstack. Never an operator’s tool.

Where it runs

The binary ships in the service image, beside the services and at their version, so it needs neither a checkout nor a Rust toolchain:

docker run --rm --entrypoint /app/canopy-manage <service-image> --help

Run it from the image being deployed, so the tool and the services are one release.

No job has a default target. Each is told where to write or what to connect to and refuses to start otherwise; nothing in the tool knows of a devstack. A developer runs a job against the devstack by giving it what an operator would.

identity check

canopy-manage identity check --issuer <identifier> --internal <url> [--client <client-id>]

canopy-identity’s deploy gate: its metadata, its keys, and one client-credentials grant validated as a receiver validates it. The checks and what each failure means: IdP Integration › Gating a deploy. The grant is its only side effect, so it is safe against production.

It signs as --client (default canopy-eligibility) with that client’s key, read only from CANOPY_<SERVICE>__IDENTITY_CLIENT_PRIVATE_KEY; an unset variable is refused by name. Run it where that service’s key already is. Both URLs must be https unless CANOPY_ENV=development.

migrate apply

CANOPY_MIGRATE__DATABASE_URL=… canopy-manage migrate apply --service <canopy-svc>

The deploy-time migration job, for a service that runs with CANOPY_<SVC>__SKIP_MIGRATIONS=true and so never holds its migration credential (Database Migrations). Each service’s migrations are compiled into the binary, so it applies the schema of the release the image was built from. An unknown --service is refused, naming the services it has.

The database comes only from CANOPY_MIGRATE__DATABASE_URL: never from an argument, which a process listing shows, and never from a default. Unset or empty refuses. Outside CANOPY_ENV=development the URL must name the service’s own database (in development a mismatch is a warning) and the connection refuses plaintext. A sealing service (persons, snap, tanf, medicaid, caps, wic, reporting) is refused without CANOPY_ENCRYPTION_KEY, before anything connects. It prints how many migrations this run applied; a second run applies none.

rewrap-keks

CANOPY_MIGRATE__DATABASE_URL=… canopy-manage rewrap-keks --service <sealing-svc> [--batch-size N]

The key-rotation job: moves a sealing service’s redaction_keys data keys from the retired key-encryption key to the current one. It needs CANOPY_ENCRYPTION_KEY (new), CANOPY_ENCRYPTION_KEY_PREVIOUS (retiring) and CANOPY_ENCRYPTION_KEY_VERSION (2 or more) in its environment, takes its database as migrate apply does, and accepts only the seven sealing services. It rewraps in transactions of --batch-size rows (default 500), prints rewrapped, already current, remaining below current and failed with each failed dek_id, and exits non-zero when anything failed. Idempotent: a second run reports rewrapped: 0. The procedure around it: Security Operations › The KEK.

gen-signing-keys

canopy-manage gen-signing-keys --program <name> --output-dir <dir>

Generates the ECDSA P-256 pair a service signs with. --program is one of snap, tanf, medicaid, caps, wic (the determination signers), notices or portal-applicant. chip is refused: canopy-medicaid signs CHIP with its medicaid key (#2952). --output-dir is required.

It writes <dir>/<name>-private.pem (PKCS#8, readable by its owner only, replacing any earlier file at that path whatever its mode) and <dir>/<name>-public.pem (SPKI), and prints the key id the service will boot under, the variable the private key belongs in, and where the public key goes. The procedure around it: Signing Key Rotation.

The devstack does not use this job: cargo xtask dev start generates its own pairs.

gen-client-key

canopy-manage gen-client-key --client <client-id> --output-dir <dir>

Generates a confidential client’s canopy-identity key, for a rotation (Security Operations › canopy-identity client keys). --client is a client id such as canopy-eligibility; an unknown id is refused, naming the known ones, and nothing is written.

It writes <dir>/<client-id>.pem (PKCS#8, readable by its owner only) and prints the variable the key belongs in (CANOPY_<SERVICE>__IDENTITY_CLIENT_PRIVATE_KEY) and the public key’s JWK x and y, in the form the client’s keys entry in canopy-security’s identity-clients.yaml takes. The report carries nothing of the private key.

Edit this page · default