Skip to content

Security: what OpsCrew sets up and checks

OpsCrew hardens what it deploys and keeps checking it. Nothing here needs a model or costs money. Every change goes through a plan you approve by its hash, and no secret ever goes into a plan, a log, a report, a pull request or your repository (only the encrypted recovery copy does).

On the server (one OpsCrew creates, or one you already have through the host plan):

  • a deploy user with key-only SSH, no password logins, and SSH limited to modern algorithms;
  • a firewall that lets in only SSH and web traffic, fail2ban, and automatic security updates;
  • Docker with log limits, and every container port kept on the server except the proxy’s 80 and 443.

In front of the app:

For the app’s services: every database and cache OpsCrew runs gets a generated password, Valkey included, and every service is reachable only from the app’s own containers. A service on a server of its own answers only the app’s servers, over the app’s private WireGuard network.

Your own access: your devices can join that private network to reach SSH and the dashboards privately, after which you can close public SSH. A device can get its own read-only login to a database, off by default.

Command What it checks
npx opscrew scan the repository: leaked secrets, exposed Supabase or Firebase data, risky configuration
npx opscrew secure the server’s hardening over SSH, the ports that answer from outside, the plan’s policies, the certificates, the Cloudflare settings and the recovery copy; writes opscrew/SECURITY_REPORT.md
npx opscrew secure --deep also Lynis, ssh-audit and testssl.sh: see deeper checks
npx opscrew verify the live site: DNS, HTTPS, the health endpoint, the headers, that .env and .git are not served, and that the server cannot be reached around Cloudflare
npx opscrew drift changes made outside OpsCrew, on the server, at the provider and at Cloudflare
npx opscrew status each certificate’s expiry, the proxy and the recovery copy’s state

For example, npx opscrew scan on a test app shaped like a Lovable export, with its “Not run” and “Next” lines left out:

OpsCrew scan of habit-tracker: 2 critical, 2 high, 1 medium, 0 low, 0 info
CRITICAL Committed .env file with 3 values .env:1
CRITICAL Supabase service-role key in client code src/lib/admin.ts:4
HIGH Row-level security is not enabled on table "profiles" supabase/migrations/20260101000000_init.sql:3
HIGH Policy "Anyone can update profiles" lets anyone update "public.profiles" supabase/migrations/20260101000000_init.sql:9
MEDIUM .env files are not in .gitignore .gitignore
Full report: opscrew/SECURITY_SCAN.md

secure also warns about:

  • a certificate with fewer than 30 days left;
  • a Cloudflare token without the permissions for origin protection;
  • a CAA record that is not OpsCrew’s at one of the app’s names, or a minimum TLS version it could not raise;
  • a repository that became public with the recovery copy in it;
  • Valkey answering without its password;
  • a self-hosted runner that is offline or more than 21 days behind GitHub’s runner release, and, as high, a public repository with a self-hosted runner whose outside contributors’ workflow runs need no approval.

For a stack on your computer, secure checks only what applies there.

opscrew scan leaves out findings in test code, which never ships: files under test/, tests/, __tests__/, spec/, __mocks__/, mocks/, __fixtures__/ and testdata/, and *.test.*, *.spec.*, *.mock.*, *_test.*, test_*.py and *Test.php files. A fixtures/ folder counts only inside a test folder, because an app’s own fixtures (Django’s, for example) can be loaded into a real database.

To leave out more, commit an opscrew/scan.yaml. Each entry needs paths (patterns written as in .gitignore) and a reason. With rules, it leaves out only those rules; the rule of each finding is in opscrew/SECURITY_SCAN.md. The scan refuses the file when an entry has no reason or names a rule it does not know.

ignore:
- paths: [examples/]
reason: Example apps, never deployed
- paths: [legacy/Dockerfile]
rules: [config/dockerfile-root]
reason: Retired image, kept for reference

Nothing is left out silently: the summary, opscrew/SECURITY_SCAN.md and --json count what was left out, per rule and per entry. For example:

Ignored: 3 (config/dockerfile-root: 1, config/flask-debug: 2): 1 in test code, 2 by opscrew/scan.yaml
1 examples/: Example apps, never deployed
1 legacy/Dockerfile (config/dockerfile-root): Retired image, kept for reference

A secret the scan recognises is never left out: a token in a provider’s own format, a private key, a committed .env with values, or a gitleaks hit keeps its severity wherever it sits. Use a fake value in a test fixture, or remove the secret and rotate it. A guess, a random-looking value under a name like password (secrets/generic-high-entropy), is left out there like any other finding, and counted.

secure, the MCP server and the plugin run the same scan, so the same file applies there.

Give CLOUDFLARE_API_TOKEN these zone permissions (npx opscrew init lists them):

  • Zone → Zone → Read
  • Zone → DNS → Edit
  • Zone → Zone WAF → Edit
  • Zone → Config Rules → Edit
  • Zone → SSL and Certificates → Edit
  • Zone → Zone Settings → Edit

For Cloudflare’s hosting, also add:

  • Account → Workers Scripts → Edit (the Worker and its custom domains)
  • Zone → Single Redirect → Edit (OpsCrew’s redirects: plain HTTP to HTTPS, and www to the domain)
  • Account → Workers Observability → Read, only for a server-rendered site’s past requests in opscrew logs

Cloudflare’s hosting also needs a second token for the deploy workflow, OPSCREW_CLOUDFLARE_DEPLOY_TOKEN, with only Account → Workers Scripts → Edit. npx opscrew provision stores it as a GitHub secret; it never stores CLOUDFLARE_API_TOKEN there.

For the uptime check in your Cloudflare account (observability.check.runner: cloudflare), also add:

  • Account → Workers Scripts → Edit (the uptime Worker, its schedule and its secrets)
  • Account → Workers KV Storage → Edit, only for this check (the Worker’s storage)

Tunnels, Cloudflare Access and R2 need a few more; see Cloudflare token permissions.

Give GITHUB_TOKEN (or GH_TOKEN) a fine-grained token for your app’s repository only, created at https://github.com/settings/personal-access-tokens/new, with these repository permissions (npx opscrew init lists them). A logged-in GitHub CLI (gh auth login) works too.

  • Contents: Read and write
  • Pull requests: Read and write
  • Secrets: Read and write
  • Actions: Read and write (this also lets OpsCrew read GitHub environments, re-run a GitHub Pages run for opscrew rollback, and read the scheduled check’s state)
  • Workflows: Read and write
  • Metadata: Read
  • Administration: Read and write, only for an app with several environments (OpsCrew creates their GitHub environments), for self-hosted runners (runner registration and the fork pull request policy), for GitHub Pages (GitHub accepts nothing narrower for changing a Pages site) and for a hosting account (the read-only deploy key its agent fetches releases with)
  • Environments: Read and write, only for an app with several environments (the secrets in their GitHub environments)
  • Pages: Read and write, only for GitHub Pages (turning the site on and off, its custom domain and HTTPS, and its certificate’s state)
  • Plan: Read, optional, for GitHub Pages on a private repository: without it GitHub hides the owner’s plan, so OpsCrew cannot tell before any change whether GitHub allows Pages there. It is an account permission, or an organization permission when an organization owns the repository.
  • Issues: Read, only with the scheduled check (opscrew status reads its open alerts)
  • Variables: Read and write, for the scheduled check (OpsCrew pauses it while it moves or removes an app), for moving an app to another target, and for opscrew rollback (it pauses an environment’s deploys after a rollback)
  • Dependabot alerts: Read (optional, for opscrew advise)

GitHub’s container registry may not accept a fine-grained token. Where OpsCrew reads it (opscrew promote and opscrew rollback, a private image on your computer or in your Portainer), set OPSCREW_GHCR_READ_TOKEN to a classic token with only the read:packages scope: https://github.com/settings/tokens/new?scopes=read:packages.