STIG Scanning
Scanning happens through recipes: each scanner ships as a built-in recipe
that the calling AI agent (Claude Code, Codex CLI, custom MCP client, or
pretorin agent) invokes through MCP. Use pretorin recipe list to discover
them.
Available Scanner Recipes
| Recipe ID | Wraps | CLI requirement |
|---|---|---|
inspec-baseline | Chef InSpec | inspec |
openscap-baseline | OpenSCAP | oscap |
cloud-aws-baseline | AWS APIs (boto3) | aws |
cloud-azure-baseline | Azure APIs | az |
postgresql-stig-baseline | PostgreSQL 16 in Docker (CD_Postgres_16_STIG) | docker |
postgresql-audit-generation | PostgreSQL 16 audit generation in Docker (CD_Postgres_16_STIG) | docker |
manual-attestation | Human attestation (no external tool) | — |
The PostgreSQL recipes each evaluate one rule: postgresql-stig-baseline
covers AU-10 audit attribution (SV-261860r1000977_rule), and
postgresql-audit-generation covers AU-12 audit generation
(SV-261861r1000588_rule). Both also ship an apply_remediation script
that refuses to run without an approved Issue, plan, and in-progress action.
List them locally:
pretorin recipe list
pretorin recipe show inspec-baseline
How a Calling Agent Runs a Scan
The agent (running in your IDE or via pretorin agent run) opens a recipe
context, calls the recipe’s run_scan script with a STIG id, and records the
result.
The recipe body (the markdown under the frontmatter in recipe.md) is the
prompt the agent reads to know what to do. You don’t run the recipe by hand;
you ask the agent something like:
“Run an inspec-baseline scan against
RHEL_9_STIGon this system.”
Behind the scenes the agent:
- Calls
start_recipe(id="inspec-baseline", system_id=...). - Calls the recipe’s script tool,
recipe_inspec_baseline__run_scan(stig_id="RHEL_9_STIG", target=...). - Reads the returned summary (per-rule pass/fail/error/not_applicable counts).
- Pushes one
scan_resultevidence record viacreate_evidencewith the activerecipe_context_id. - Calls
end_recipe(...).
Three recipes support per-rule results alongside summary evidence:
openscap-baselinecan import its raw XCCDF results into a STIG checklist (create_stig_checklist,import_stig_checklist_xccdf) and export a reviewable.cklb/.cklwithexport_stig_checklist.postgresql-stig-baselineandpostgresql-audit-generationreturnsubmit_test_results_argsthat the agent passes unchanged tosubmit_test_results.
Test Manifest
Browse what’s testable for a system without running anything:
pretorin stig applicable --system "My System"
pretorin cci chain ac-2 --system "My System"
The MCP equivalent is get_test_manifest — the calling agent uses
this to figure out which rules apply before running a scan.
Authoring Your Own Scanner Recipe
Scanner recipes are just recipes. If you have an internal tool that produces
STIG-style results, scaffold a recipe and drop it in
~/.pretorin/recipes/<id>/ (user) or <repo>/.pretorin/recipes/<id>/ (team):
pretorin recipe new my-scanner --location user
See the Authoring recipes docs for the full contract.
Submitting Results Manually
If you have raw scan output and want to push it without running the recipe flow, the platform endpoint is exposed directly:
submit_test_results(system_id, cli_run_id, results, framework_id)
via MCP. Each result needs rule_id, benchmark_id, status, and tool
metadata — see the STIG / CCI workflow for
schema details.