CLI Commands
APF ships three command-line programs. This page lists every flag each one accepts on the main branch. Where a flag has an environment variable, the flag takes precedence over the variable.
Build all three with Cargo:
apf-policy-service
serve
Core Options
Policy Source Options
Document Signing Options
HTTP Surface Options
Other Options
keygen
Writes <key-id>.seed and <key-id>.pub and prints the public key.
The files are written with the process umask. Set their permissions yourself, for example chmod 0600 on the seed.
Configuration File
--config reads a TOML file whose values fill in options not set on the command line or in the environment.
The configuration file has several limitations in this release:
- The
socketandcounter_storekeys apply only when the flag or environment variable holds an outdated default,/run/apf/apf-policy-service.sockor/tmp/apf-counter, and then override it. In practice they do not set the option. Thedocument_ttl_secs,[verifier] key_id, and[provenance]keys are parsed but never applied. Set these options with flags or environment variables. - There is no key for
--http-bearer-token-file. If you sethttp_addrin the file, pass the token file as a flag or environment variable. - Unknown keys are ignored without a warning.
- A flag or environment variable whose value equals the built-in default can be overridden by the file.
- The sample
examples/policy-service.tomlin the repository is out of date and does not work as written.
Refer to Settings Are Ignored.
apf-policy-gateway
The gateway has no subcommands and no configuration file. Provider registration is a separate YAML file passed with --pip-config.
Core Options
Provider Options
Provenance Options
OpenShell Options
Listener Rules
The gateway checks each OpenShell listener before it does anything else:
- An enabled listener needs either all three of its trust file, certificate, and key, or the insecure flag.
- The insecure flag cannot be combined with a trust file, certificate, or key.
- A trust file, certificate, key, or insecure flag without the listener’s address is an error.
- Certificate files must be regular files of at most 1 MiB that are not group or world writable. Key files must be regular files of at most 64 KiB with no group or other permissions. Symbolic links are refused.
Refer to Configure Service Authentication for the trust profile format.
Audit Files
The gateway does not accept --trust-root-dir or --counter-store. It verifies documents through provenance tokens and the JWKS, and the policy service owns the counter store.
apf-compile
On failure, both commands print Error: <message> to standard error and exit with status 1.
genfixture
The command prints one manifest <path>: sha256=<digest> line per member and signed bundle written to <path>.
genfixture fills placeholders in the order manifest entries appear, one per entry. Use a placeholder for every entry and nowhere else in the template, including comments. Refer to Compile and Sign.
compile
On success it prints verified digest=<sha256> counter=<revision>, and without --verify-only, one projection kind=<kind> name=<name> bytes=<n> line per surface. It produces apf.policy.v1 and openshell.provider-profile.v1, not the OpenShell sandbox projection.
The command uses a new, empty counter store for every run, so it cannot detect a replayed bundle, and it rejects policy_revision: 0. It does not build the Cedar evaluator. Refer to Validate and Test Policies.
Logging
apf-policy-service and apf-policy-gateway log to standard output. Set RUST_LOG to change the level, for example RUST_LOG=debug or RUST_LOG=apf_policy_gateway=debug. The default is info. apf-compile prints plain output and has no log level.
Repository Tasks
The repository’s mise.toml defines development tasks. Run them with mise run <task>.
dev-native does not start on main because it sets no audit directory, which both services require, and passes flags the gateway no longer accepts. Use the commands in Installation instead.
Next Steps
- To see how these options fit together on a host, refer to Host and Workstation Deployment.
- For the HTTP and gRPC interfaces, refer to Service APIs.