Choose a deployment
Run commands from the Harness Audit source checkout. You’ll need Python 3.11 or later to scan configurations.
Run locally
Create a sample report
python3 audit.py scan --workspace-only --workspace examples/workspace &&
python3 audit.py serveOpen 127.0.0.1:8080 for the sample report. For a real scan, run python3 audit.py scan --workspace /path/to/repo as the user whose settings you want to inspect. Repeat --workspace for additional workspaces, or use --config HARNESS FILE to add an explicit config file.
Try the fleet dashboard
python3 -m fleet.server demoOpen 127.0.0.1:8090 to see two synthetic collectors, including one marked stale. Keep the server command running while you use either local page.
Deploy on Cloudflare
Set up a live fleet on Workers and D1 to receive reports from managed devices.
Publish a static snapshot
Use Cloudflare Workers Static Assets to host the landing page and synthetic demo on a workers.dev address. You’ll need Node.js, npm, and permission to deploy Workers in your Cloudflare account. Wrangler can prompt you to sign in and set up your subdomain.
npx wrangler@4 deploy --config site/wrangler.jsoncOpen the URL Wrangler prints. This command uploads site/dist/, which holds the site and synthetic demo. The included configuration serves static files without Worker compute or a database.
Static asset requests are free and unlimited. Workers Free supports 20,000 files per version and 25 MiB per file. Zero Trust Free has a 50-user account limit. Asset billing · Worker limits · Zero Trust plans
Protect a real report with Access
Use the separate report Worker for findings from real systems. Set up and test sign-in with synthetic data first.
- Deploy a synthetic report.
python3 audit.py scan --workspace-only --workspace examples/workspace \ --output cloudflare/report-dist/index.html && cp cloudflare/report.headers cloudflare/report-dist/_headers && npx wrangler@4 deploy --config cloudflare/wrangler.jsonc - Require sign-in for all traffic. In Workers & Pages, select
harness-audit-report, open Access, and choose Protect this Worker behind Access. Select All traffic and allow the identities your team approves. Cloudflare Access setup - Verify the gate before uploading real findings. Open
/and/index.htmlat the Worker URL in a signed-out window. Both must lead to sign-in or an access denial. Then sign in as an approved user and confirm the sample report loads. - Upload the real snapshot. Generate and deploy the report to the same protected Worker. Repeat after each scan to refresh it.
python3 audit.py scan --workspace /path/to/repo \ --output cloudflare/report-dist/index.html && npx wrangler@4 deploy --config cloudflare/wrangler.jsonc
Run a live fleet on Workers
Workers serves the dashboard and collector API. D1 stores the fleet data. Use separate hostnames for the Access-protected dashboard and the collector’s authenticated upload API.
- Create a D1 database, copy
cloudflare/fleet/wrangler.example.jsonc, and fill in the database ID, both hostnames, and Access settings. - Apply the D1 migrations and deploy the Worker with the configuration you created.
- On a managed device, use the collector hostname when enrolling. Verify a scheduled scan appears in the dashboard before deploying to the rest of the fleet.
The checkout’s cloudflare/README.md has the complete Workers deployment commands.
Self-host a fleet
The fleet stack runs on a Docker host with PostgreSQL, Caddy, and an OIDC identity provider. It receives reports over HTTPS and keeps track of findings and scan coverage across enrolled collectors.
- Point a DNS hostname to the Docker host and register an OIDC client with the callback
https://YOUR_HOST/oauth2/callback. The example gateway uses ports 80 and 443. - Copy
deploy/.env.exampleto.env.production, restrict it to mode0600, and set the hostname, OIDC issuer and client credentials, allowed email domain, and database, gateway, and cookie secrets. SetHARNESS_VIEWER_GROUPto your dedicated SOC group andHARNESS_ADMINSto the administrator email allowlist. - Start the stack. Verify that a signed-out request redirects to OIDC, a same-domain user outside the SOC group is denied, an approved viewer can read the dashboard, and an administrator can create an enrollment.
docker compose --env-file .env.production -f compose.production.yaml up --build -d
Enroll an endpoint
In Collectors, create an enrollment. Run the collector as the account whose config you want to inspect. Replace the example hostname, then paste the one-time token into the terminal and press Enter. It expires after 15 minutes.
python3 collector.py enroll --server https://audit.example.orgAfter enrollment succeeds, replace the workspace path and run the first scan.
python3 collector.py run --workspace /path/to/workspaceVerify the report in the dashboard before scheduling scans with the Linux or macOS templates in deploy/endpoint/. The checkout’s docs/enterprise-deploy.md covers secrets, backups, and retention.
Check coverage and rotate credentials
Compare observed sources with expected sources in the fleet dashboard. Last complete scan uses the time the collector sampled the configuration. Last upload shows when the server received it. If a source is required on the first scan, pass it explicitly with --config HARNESS FILE.
To rotate a credential, create a rotation grant for the existing collector and run python3 collector.py rotate with its existing state. Enter the grant on the endpoint. The collector keeps its identity and finding history.
Triage and monitor a fleet
- Investigate empty, partial, or stale collectors before drawing conclusions about fleet coverage. Under View sources, compare the sample time, upload time, and source inventory. An administrator can retire a source that was intentionally removed.
- Verify a finding against the harness and its runtime or managed policy. An administrator can record it as active or inactive and add a ticket or evidence reference. Verification expires after seven days or clears if the evidence or rule policy changes.
- Search and filter the full findings dataset using the paginated view. Administrators can export all stored findings as JSON, including resolved findings and records from revoked collectors.
For monitoring, poll the authenticated GET /api/v1/alerts endpoint or run the command below on the Docker host. It emits JSON for open high-severity findings and stale collectors, with stable alert IDs for deduplication.
docker compose --env-file .env.production -f compose.production.yaml \
exec -T app python -m fleet.server alerts --exit-on-alertBefore enrolling real endpoints, run bash tests/production-smoke.sh to check the stack in an isolated Docker network with a synthetic identity provider. Then repeat the sign-in checks with your own identity provider and hostname.
Troubleshooting
- Local page won’t open
- Start the corresponding server and keep its terminal open. The standalone report uses
8080; the fleet demo uses8090. If a port is already in use, pass--port 8091and open the new URL. - Config files are missing or unreadable
- Use the correct user account and workspace root. Check file permissions and syntax, then rerun. Use
--config HARNESS FILEfor custom locations.--workspace-onlyskips user-level discovery. - The scan wrote a report and exited with code 1
- With
--fail-on high, this means at least one high-severity rule matched. Open the report to see the findings. Exit code 2 indicates a command or setup error. - Wrangler won’t deploy
- Run
npx wrangler@4 whoamito confirm the authenticated account. Run the command from the checkout root. For report hosting, confirmcloudflare/report-dist/index.htmlwas generated and is under the 25 MiB individual-file limit. - Access denies an approved user or the report opens signed out
- Check the exact Worker, its All traffic policy, and the signed-in email address. If a real report is reachable signed out, disable public access immediately and retest with synthetic data.
- The fleet dashboard has a stale collector or a rejected upload
- Check that its schedule is running under the enrolled user and that it can reach the configured HTTPS origin. Run the collector manually to see the error. If its enrollment token expired or its credential was revoked, create a new enrollment. Stale collectors have missed a complete scan within the configured interval.
- The fleet dashboard won’t sign in
- Check DNS, TLS, the OIDC issuer, and the exact callback URL. Confirm the sign-in email matches the allowed domain and the provider supplies the expected SOC group claim. Inspect Caddy and OAuth2 Proxy logs with
docker compose --env-file .env.production -f compose.production.yaml logs --tail=100 caddy oauth2.