Skip to content
Docs›Operations›Gateway import guide
WAF & API gateway targets · 5 self-hosted native · 2 hosted-deploy

Gateway import guide

One x-security policy compiles to whichever gateway you run. This page is the canonical per-gateway matrix and the operator path per target: the exact artifact xsecurity generate writes, the command that loads it, and what each backend can and cannot do in shadow.

/ 01section

Targets at a glance

TargetStatusArtifactLoad commandShadow supportRollback
kongbetakong.ymldeck sync or POST /configNone todayYour deploy process (git revert + reload)
corazabetax-security.conf / coraza.ymlInclude + reloadEngine switch (SecRuleEngine DetectionOnly, you flip it)Your deploy process (git revert + reload)
bunkerwebbetaconfigs/modsec/x-security.confMount; bw-scheduler syncsEngine switch (SecRuleEngine DetectionOnly, you flip it)Your deploy process (git revert + reload)
openappsecbetapolicy.yaml + openapi-schema.yamlMount into the agent containerNative (mode: detect)Your deploy process (git revert + reload)
envoyalphaenvoy.yaml (+ lua, OPA rego)Mount + restart / ConfigMapNone todayYour deploy process (git revert + reload)
cloudflarelive · hostedRulesets API JSONDeployed by the hosted platformNative (action: log)Per-rule promote + watch-window auto-revert — shadow mode
aws-apigwbeta · hostedWAFv2 WebACL + usage plansDeployed via AssumeRoleNative (Count)Per-rule promote + watch-window auto-revert — shadow mode
Shadow mode, honestly
Shadow mode is native on 3 of 7 targets: Cloudflare (action: log), AWS WAFv2 (Count), both pushed by the hosted deployer with per-rule promote and a watch-window auto-revert, and OpenAppSec (policy mode: detect). The Coraza/ModSecurity family and BunkerWeb emit enforcing rules; you flip the engine to SecRuleEngine DetectionOnly to observe first. Kong and Envoy have no shadow mode today.
/ 02section

Kong — beta

bash
# Generate
$ xsecurity generate openapi.yml --target kong --out ./out

# Load — pick one
$ deck sync -s out/kong.yml                     # decK
$ curl -X POST http://kong-admin:8001/config \
    -F config=@out/kong.yml                     # DB-less admin API

OSS 3.x and Enterprise. Notable: on OSS, bearer-JWT supports HS256 only. RS256/ES256 need --kong-edition=enterprise; every downgrade is written to _x_security_warnings inside the artifact, never silent.

/ 03section

Coraza / ModSecurity — beta

bash
# Generate (engine: modsec-nginx | modsec-apache | coraza-go | coraza-spoa)
$ xsecurity generate openapi.yml --target coraza --coraza-engine modsec-nginx --out ./out

# Load (modsec-nginx): mount + include, then reload
#   /etc/modsecurity.d/x-security.conf  <- out/x-security.conf
$ echo "Include /etc/modsecurity.d/x-security.conf" >> /etc/modsecurity.d/setup.conf
$ nginx -s reload

# Load (coraza-go): feed directives to the embedded WAF
#   waf, _ := coraza.NewWAF(coraza.NewWAFConfig().WithDirectives(cfg.Directives))

Four engine profiles: modsec-nginx (default), modsec-apache, coraza-go, coraza-spoa (HAProxy stick-table rate limits). Per-identifier rate limits downgrade to global on libmodsecurity3 and say so in WARNINGS.md.

/ 04section

BunkerWeb — beta

bash
$ xsecurity generate openapi.yml --target bunkerweb --out ./out
# Mount out/configs/ under the bw-scheduler /data/configs volume;
# the scheduler syncs rules into BunkerWeb on its poll interval.
# Read out/DEPLOYMENT.md — it lists per-policy warnings and required env settings.
/ 05section

OpenAppSec — beta

bash
$ xsecurity generate openapi.yml --target openappsec --out ./out
$ docker run ghcr.io/openappsec/agent-unified:latest \
    -v ./out/openappsec/policy.yaml:/etc/appsec/policy.yaml:ro \
    -v ./out/openappsec/openapi-schema.yaml:/ext/appsec/openapi-schema.yaml:ro \
    -e POLICY_FILE=/etc/appsec/policy.yaml

The only self-hosted target with native detect/prevent modes per policy. Its ML layer needs baseline traffic before prevent is trustworthy. Plan an observation window.

/ 06section

Envoy — alpha

bash
$ xsecurity generate openapi.yml --target envoy --out ./out
$ docker run -v ./out/envoy.yaml:/etc/envoy/envoy.yaml \
    envoyproxy/envoy:v1.27-latest -c /etc/envoy/envoy.yaml
# Kubernetes: ship envoy.yaml as a ConfigMap and mount it into the proxy pod.
# If emitted: x-security.lua (body-level checks) and opa/policy.rego (ext_authz).
/ 07section

Cloudflare & AWS — hosted deploy

These two have no CLI generator: the CLI produces feasibility reports (xsecurity report --feasible cloudflare,aws-apigw), and the hosted platform deploys the compiled rules — Cloudflare Rulesets with action: log, AWS WAFv2 WebACLs with Count — shadow-first, per-rule promote, watch-window auto-rollback (see shadow mode). AWS uses AssumeRole with an externalId; no long-lived credentials are stored.

/ 08section

Test and verify

bash
# Closed-loop Docker test (kong · coraza · bunkerweb · openappsec)
$ xsecurity test openapi.yml --target kong

# Post-deploy drift check (kong · coraza · bunkerweb · openappsec · envoy)
$ xsecurity verify openapi.yml --target kong --gateway http://kong-admin:8001

xsecurity test boots the real gateway in Docker, replays traffic, and asserts allow/deny per rule. xsecurity verify reads the deployed config back and exits non-zero on drift. Wire it into CI.