Skip to main content
Version: 0.22

CLI reference

This page is for operators. The Continuous Compliance Framework (CCF) API ships as a single binary that's also its command line. The container image runs api run; every other command is a maintenance or administrative task you run from a shell. This page covers the API at v0.22.5.

Invoking the CLI​

The binary is named api. Run it on the API host, or inside the API container:

api <command> [subcommand] [flags]

api help lists every command.

The CLI reads the same configuration as the server: environment variables with the CCF_ prefix, or a .env file in the working directory. Every command that touches the database needs CCF_DB_DRIVER and CCF_DB_CONNECTION. Every setting is in the configuration reference.

One flag applies to every command:

FlagPurposeTypeDefault
-d, --debugTurn on database debug logging, the same mode as CCF_DB_DEBUG.boolfalse

Commands​

CommandWhat it does
api runStarts the API server.
api migrate up / down / refreshCreates, removes or recreates the database schema.
api bootstrapCreates the JWT signing key files.
api users add / updateManages users who sign in with a password.
api authz exportPrints the authorization vocabulary.
api oscal import / exportMoves OSCAL documents in and out of the database.
api dashboards export / importMoves dashboard filters in and out of the database.
api digest test / previewTests the evidence digest.
api riskdigest testRuns the risk digest now.
api seed heartbeats / evidence / workflows / lineageLoads demo data directly into the database.

api run​

Starts the API server. It needs a PostgreSQL database; configure it with CCF_DB_DRIVER and CCF_DB_CONNECTION. On startup the command:

  1. Creates the JWT key files when both CCF_JWT_PRIVATE_KEY and CCF_JWT_PUBLIC_KEY are set and the files don't exist yet. When both are set and one is empty, startup fails; unset both to keep the keys in memory only.
  2. Connects to the database and upgrades the schema, the same as api migrate up.
  3. Starts the background worker, the metrics server when CCF_METRICS_ENABLED is true (the default), and the pprof server when CCF_PPROF_ENABLED is true.
  4. Listens for API requests on CCF_APP_PORT (default :8080).
api run

api run takes no flags.

api migrate​

Manages the database schema.

SubcommandWhat it does
api migrate upCreates the database schema, or upgrades it to this version.
api migrate downRemoves the database schema CCF created.
api migrate refreshRemoves the schema and recreates it: down followed by up.

api run migrates the schema up on its own at startup, so run these only to prepare a database in advance or to reset one.

api bootstrap​

Creates the RSA key pair the API uses to sign JWTs, and prints what it did:

api bootstrap --bit-size 4096
JWT bootstrap complete (action=generated, private=private.pem, public=public.pem)
FlagPurposeTypeDefault
--private-keyPath for the private key file.stringCCF_JWT_PRIVATE_KEY, else private.pem
--public-keyPath for the public key file.stringCCF_JWT_PUBLIC_KEY, else public.pem
--bit-sizeRSA key size, in bits.int2048
--forceRegenerate the key files even when they already exist.boolfalse

api run creates the same files when you point CCF_JWT_PRIVATE_KEY and CCF_JWT_PUBLIC_KEY at paths that don't exist; run api bootstrap ahead of time when you want to fix the key size or pre-create them.

api users​

Manages users who sign in with a password. Single sign-on users don't need one. See Single sign-on.

api users add​

Adds a user. --email, --first-name and --last-name are required. When you don't pass --password, the command generates a random 12-character one and prints it in the User created successfully line — copy it before the user signs in.

api users add --email ada@example.com --first-name Ada --last-name Lovelace
FlagPurposeTypeDefault
-e, --emailEmail of the user; they sign in with it.stringrequired
-f, --first-nameFirst name of the user.stringrequired
-l, --last-nameLast name of the user.stringrequired
-p, --passwordPassword of the user.stringnone; a random 12-character password is generated

api users update​

Updates an existing user, looked up by email.

api users update --email ada@example.com --generate-password
FlagPurposeTypeDefault
-e, --emailEmail of the existing user.stringrequired
-f, --first-nameNew first name.stringunchanged
-l, --last-nameNew last name.stringunchanged
-p, --passwordNew password. Mutually exclusive with --generate-password.stringunchanged
--generate-passwordSet a new random 12-character password and print it. Mutually exclusive with --password.boolfalse

Set at least one of --first-name, --last-name, --password or --generate-password.

api authz export​

Renders the embedded authorization manifest — its subjects, resources, actions, attributes and default roles — for external policy decision points and GitOps pipelines. It exports the vocabulary that operator policies are written against, not the operator policies themselves. For what the vocabulary is, see Authentication and permissions.

api authz export --format cedar --output ccf.cedar
FlagPurposeTypeDefault
-f, --formatOutput format: json, yaml, cedar or openfga. Case-insensitive.stringjson
-o, --outputOutput file. Prints to standard output when unset.stringnone (stdout)

api oscal​

Moves OSCAL documents between the database and JSON files.

api oscal import​

Imports OSCAL documents from files or directories: catalogs, profiles, system security plans (SSPs), component definitions, assessment plans, assessment results and plans of action and milestones (POA&M). Pass -f once per file or directory; directories are read recursively, skipping hidden files.

api oscal import -f catalogs/ -f profiles/soc2-profile.json
FlagPurposeTypeDefault
-f, --fileA file or directory to import. Repeat the flag for more than one.listrequired

Import is an upsert by document UUID: re-importing an updated file updates the stored document in place, adding new controls, requirements and statements. The update is additive — values removed from the file aren't deleted from the database. Each file is reported as Created or Updated; a file that fails is reported and the rest still import, and the command exits non-zero if any file failed.

api oscal export​

Exports every object of one type from the database to a JSON file.

api oscal export --type ssp
FlagPurposeTypeDefault
-t, --typeType of OSCAL object to export: ssp, ap, catalog or profile.stringrequired
-o, --outputOutput file for exported objects.stringoscal_export.json

api dashboards​

Moves dashboard filters between the database and a JSON file, for example to promote a dashboard from staging to production.

api dashboards export​

Exports every dashboard — its name, SSP, evidence filter and controls — as a JSON array.

api dashboards export --output dashboards_export.json
FlagPurposeTypeDefault
-o, --outputOutput file for exported dashboards.stringrequired

The command registers dashboards_export.json as the flag's default, but marks --output required, so the default is never used: api dashboards export without --output fails with required flag(s) "output" not set.

api dashboards import​

Reads a JSON array in the format api dashboards export writes, and creates the dashboards and their control relations. A dashboard whose id already exists is updated. Each control is looked up by catalog and control ID; the import fails when a control doesn't exist in the database, so import the catalogs first.

api dashboards import --file dashboards_export.json
FlagPurposeTypeDefault
-f, --fileInput JSON file containing the dashboards.stringrequired

api digest​

Tests the global evidence digest, the summary CCF sends to subscribed users on the schedule in CCF_DIGEST_SCHEDULE.

api digest preview
CommandWhat it does
api digest testBuilds the digest and sends it to all subscribed users now, over email and Slack.
api digest test --dry-runPrints the digest counts (total, satisfied, not satisfied, expired) without sending anything.
api digest previewPrints the evidence summary, the number of subscribed users and whether a digest would be sent. Nothing is sent.
FlagPurposeTypeDefault
--dry-runWith test: show what would be sent without sending emails.boolfalse

When CCF_ENVIRONMENT is production, api digest test asks you to type yes before it sends, unless you pass --dry-run.

api riskdigest test​

Runs the open-risk digest now, sending notifications to subscribed users directly instead of waiting for the worker's schedule.

api riskdigest test --window weekly
FlagPurposeTypeDefault
--windowDigest window: daily, weekly or none.stringthe openDigestWindow value of the risk configuration (CCF_RISK_CONFIG), daily when it's unset

When CCF_ENVIRONMENT is production, the command asks you to type yes before it sends. On completion it prints the window it used and the number of recipients.

api seed​

Loads demo data directly into the database, for development and demos. Don't run these against production.

CommandWhat it seeds
api seed heartbeatsAgent heartbeats.
api seed evidenceEvidence items with beats.
api seed workflowsWorkflow definitions from a JSON file.
api seed lineageA demo Policy catalog, a demo Procedure catalog and control links for the Compliance Lineage demo.
api seed evidence --amount 50 --beats 10
CommandFlagPurposeTypeDefault
api seed heartbeats-a, --amountNumber of agents. A count flag: repeat the flag, once per agent.count10 when the flag is absent
api seed heartbeats-b, --beatsBeats per agent, one minute apart. A count flag: repeat the flag, once per beat.count1440 when the flag is absent (a full day)
api seed evidence-a, --amountNumber of evidence items.int10
api seed evidence-b, --beatsBeats per evidence item.int5
api seed workflows-f, --fileInput JSON file containing workflow definitions.stringrequired

api seed lineage takes no flags.