inkwall

module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: Apache-2.0

README

Inkwall

A Kubernetes-native web application firewall. Install one operator; it injects an inspection engine (OWASP Coraza with the Core Rule Set) next to your ingress controller and enforces the WAFPolicy objects you attach to your routes.

Status: v0.1.0, early. Works today with Traefik and Ingress or IngressRoute routes, plus a standalone reverse proxy for anything else. The API is v1alpha1 and will change. See Limits and the roadmap.

How it works

  1. inkwall-operator injects inkwall-engine into Traefik's pods as a sidecar, attaches a ForwardAuth Middleware to every Ingress or IngressRoute a policy targets, and pushes signed policy bundles to every engine.
  2. inkwall-engine inspects each request with CRS and answers allow or deny. It keeps enforcing its last bundle when the operator is down.
  3. Status on each policy shows how far it got: Accepted → Programmed (wired) → Enforced (every engine runs it) → Ready.

Install

Needs Kubernetes 1.29+ and Helm 3.

helm install inkwall oci://ghcr.io/inkwall-dev/charts/inkwall --version 0.1.0 \
  --namespace inkwall-system --create-namespace

Then install or restart Traefik: pods started after the operator get the engine. Chart options are in the chart README.

Guides: upgrading, GitOps with Argo CD and Flux, rotating the signing key, connecting to a control plane, client IP behind a load balancer.

Images, chart and checksums are signed keyless with cosign. To verify:

cosign verify ghcr.io/inkwall-dev/inkwall-engine:0.1.0 \
  --certificate-identity-regexp '^https://github.com/inkwall-dev/inkwall/\.github/workflows/release\.yaml@refs/tags/v' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Binaries (inkwall-engine, inkwall-operator, inkwallctl) are on the releases page.

Protect a route

apiVersion: waf.inkwall.dev/v1alpha1
kind: WAFPolicy
metadata:
  name: web
  namespace: shop
spec:
  targetRefs: [{kind: Ingress, name: web}]   # an Ingress Traefik serves
  mode: Block                                # default Detect: log, never block
$ kubectl get wafpolicy -n shop
NAME   MODE    READY   BUNDLE   AGE
web    Block   True    2        3s
$ curl -s -o /dev/null -w '%{http_code}\n' -H 'Host: shop.example.com' "http://$TRAEFIK/?id=1%27%20OR%20%271%27%3D%271"
403

Start in Detect, tune false positives on the policy (exclusions, skip paths, the rule set's paranoiaLevel), then switch to Block. Extra rules come from WAFRuleSet and ClusterWAFRuleSet objects (built-in, SecLang or a ConfigMap). Samples are in operator/config/samples.

Safe by default. In block mode, a request that can't be inspected in time is rejected (503), so padding a request past the deadline doesn't get an attack through; detect mode never blocks. Bundles are signed and verified by every engine. While a policy blocks, Traefik pods can't start without the engine; see when the operator is down.

Without Kubernetes

The engine also runs as a standalone reverse proxy in front of any HTTP service:

$ inkwall-engine proxy --upstream http://localhost:3000 --mode block
$ curl -s -o /dev/null -w '%{http_code}\n' 'localhost:8480/?id=1%27%20OR%20%271%27%3D%271'
403

Main flags (inkwall-engine proxy -h for all):

Flag Default Purpose
--mode detect block to enforce
--paranoia-level 1 CRS paranoia level, 1-4
--rules / --rules-before-crs SecLang rules and exclusions, after / before CRS
--skip-paths, --skip-body-paths Routes not inspected, or without body inspection
--disable-rule-groups CRS families the app can't be vulnerable to, e.g. php,java
--max-body-bytes 65536 Body bytes inspected; --oversize-body decides the rest
--failure-mode auto Uninspectable requests: closed in block mode, open in detect
--trusted-proxies CIDRs whose X-Forwarded-For is trusted

Other modes: inkwall-engine forward-auth (Traefik ForwardAuth, 127.0.0.1:9001) and inkwall-engine check (the POST /v1/check API, api/engine/v1). Each blocked or detected request logs one JSON line with the rule IDs; metrics are on :9480/metrics. Inspection costs about 0.5 ms per request (baseline).

Test rules offline with inkwallctl test: a URL, a raw request (--request) or a browser HAR (--har), with the same flags; --expect allow|deny makes it a CI check.

$ inkwallctl test 'http://shop.example.com/?id=1%27%20OR%20%271%27%3D%271'
deny  403  GET /?id=1%27%20OR%20%271%27%3D%271  reason=rule  rules=942100,949110  interrupting=949110  847µs

Test WAFPolicy objects before they reach the cluster: --policy with the rule sets, ConfigMaps and Ingresses they use resolves them as the operator does (each request goes to the policy of its host and path, policy= names it) and compiles them as the engine does. Files (or directories of them) may hold several YAML documents of any of these kinds, or kubectl get -o yaml output. Without --ingress, a single policy applies to every request. Objects the operator would reject (a missing rule set, rules that don't compile) are errors. Inspection deadlines are raised to 10 s, so a slow CI runner can't turn a verdict into a timeout.

$ inkwallctl test --policy wafpolicy.yaml --rule-set wafruleset.yaml --configmap configmap.yaml \
    --ingress ingress.yaml --request requests.http
allow      GET /products/42  policy=shop/storefront  580µs
deny  403  GET /?id=1%27%20OR%20%271%27%3D%271  policy=shop/storefront  reason=rule  rules=942100,949110  interrupting=949110  623µs
log        GET /api/orders?debug=true  policy=shop/api  reason=rule  rules=100100  interrupting=100100  20µs
allow      GET /?id=1%27%20OR%20%271%27%3D%271  reason=no_policy  0s

Or test the bundle the cluster enforces, its signature checked with the cluster's key:

kubectl -n inkwall-system get secret inkwall-bundle -o yaml > bundle.yaml
kubectl -n inkwall-system get secret inkwall-bundle -o jsonpath='{.data.ed25519\.pub}' > bundle.pub
inkwallctl test --bundle bundle.yaml --bundle-key bundle.pub --har traffic.har

In CI, with attacks and legitimate traffic kept next to the policies (exit 1 on a wrong verdict, 2 on an error):

- run: |
    inkwallctl test --policy k8s/waf/ --expect deny --request test/waf/attacks.http
    inkwallctl test --policy k8s/waf/ --expect allow --har test/waf/legitimate.har

Limits

  • Proxies: Traefik only (and the standalone proxy). Envoy, HAProxy, ingress-nginx and Caddy are designed, not built.
  • Targets: Ingress and Traefik IngressRoute (rules of Host, Path and PathPrefix joined by &&); not Gateway API HTTPRoute yet.
  • One cluster; the optional control plane (fleet management, analytics) isn't built.
  • Behind a load balancer the engine sees the client's IP only with the PROXY protocol on Traefik's entry points or externalTrafficPolicy: Local: see client IP.

Roadmap

Tracked on the project board and in milestones:

  • v0.2.0: signing key rotation, memory at scale, offline tests of WAFPolicy objects.
  • v1.0.0: a stable API (out of v1alpha1) with an upgrade path.
  • Then more proxies: Envoy and Gateway API, HAProxy, ingress-nginx, Caddy.

Development

make check        # lint, tests, vulnerability scan
make crs-test     # OWASP CRS regression suite through the proxy
make kind-up      # kind cluster with a demo behind the engine and Traefik
make kind-e2e     # operator end to end on kind (what CI runs)

make help lists every target. Design docs are in docs/design; start with the component map.

Contributing, security, license

Read CONTRIBUTING.md (commit format, branches, releases) and follow the Code of Conduct. Report vulnerabilities privately as described in SECURITY.md. Inkwall is licensed under the Apache License 2.0.

Directories

Path Synopsis
api
cmd
engine command
Command inkwall-engine runs the Inkwall inspection engine.
Command inkwall-engine runs the Inkwall inspection engine.
inkwallctl command
Command inkwallctl is the Inkwall command-line tool.
Command inkwallctl is the Inkwall command-line tool.
operator command
Command inkwall-operator is Inkwall's Kubernetes operator: it turns WAFPolicy and the other waf.inkwall.dev objects into policy bundles for the engines, and wires the cluster's proxies to them (docs/design/0004).
Command inkwall-operator is Inkwall's Kubernetes operator: it turns WAFPolicy and the other waf.inkwall.dev objects into policy bundles for the engines, and wires the cluster's proxies to them (docs/design/0004).
hack
benchgate command
Command benchgate fails when benchmarks regressed.
Command benchgate fails when benchmarks regressed.
operator
api/v1alpha1
Package v1alpha1 holds the Inkwall Kubernetes API (group waf.inkwall.dev): the cluster configuration, the policies app teams attach to their routes, and the rule sets those policies use.
Package v1alpha1 holds the Inkwall Kubernetes API (group waf.inkwall.dev): the cluster configuration, the policies app teams attach to their routes, and the rule sets those policies use.
bundle
Package bundle builds, signs and stores policy bundles (0004 §4.6).
Package bundle builds, signs and stores policy bundles (0004 §4.6).
integrations
Package integrations knows the proxies Inkwall wires into (0004 §4.2): how to recognise each one's IngressClass and pods, and which engine adapter its pods use.
Package integrations knows the proxies Inkwall wires into (0004 §4.2): how to recognise each one's IngressClass and pods, and which engine adapter its pods use.
internal/controller
Package controller holds the operator's reconcilers.
Package controller holds the operator's reconcilers.
internal/controlplane
Package controlplane connects the operator to the optional control plane (0002 §3.4, §5.3, §7.5; api/controlplane/v1).
Package controlplane connects the operator to the optional control plane (0002 §3.4, §5.3, §7.5; api/controlplane/v1).
internal/crdwatch
Package crdwatch watches a kind whose CRD may be missing, such as Traefik's IngressRoute: a controller can't start with a watch on a kind the API server doesn't serve, so the watch is added once it does.
Package crdwatch watches a kind whose CRD may be missing, such as Traefik's IngressRoute: a controller can't start with a watch on a kind the API server doesn't serve, so the watch is added once it does.
internal/distribution
Package distribution serves bundles to the engines (0004 §4.7): every operator replica runs the BundleService, pushes each new bundle to its connected engines, and records what they applied.
Package distribution serves bundles to the engines (0004 §4.7): every operator replica runs the BundleService, pushes each new bundle to its connected engines, and records what they applied.
internal/injection
Package injection gets the engine into a proxy's pods (0004 §4.3): a Pod webhook adds it as a native sidecar, and a controller provides what the sidecar needs in the pod's namespace (the trust ConfigMap) and in the operator's (read access to the bundle Secret).
Package injection gets the engine into a proxy's pods (0004 §4.3): a Pod webhook adds it as a native sidecar, and a controller provides what the sidecar needs in the pod's namespace (the trust ConfigMap) and in the operator's (read access to the bundle Secret).
internal/wiring
Package wiring sends a proxy's protected routes to the engine (0004 §4.4).
Package wiring sends a proxy's protected routes to the engine (0004 §4.4).
manager
Package manager assembles the operator: the controllers and webhooks, in one controller-runtime manager.
Package manager assembles the operator: the controllers and webhooks, in one controller-runtime manager.
resolver
Package resolver turns the cluster's WAF objects into bundle policies (0004 §4.5): each WAFPolicy's targets are expanded into concrete host / path matches, its rule sets resolved, and conflicts between policies settled.
Package resolver turns the cluster's WAF objects into bundle policies (0004 §4.5): each WAFPolicy's targets are expanded into concrete host / path matches, its rule sets resolved, and conflicts between policies settled.
test/fakecontrolplane
Package fakecontrolplane is a control plane that implements api/controlplane/v1 for tests: enrollment with one-time tokens, client certificates from its own CA, and the Connect stream.
Package fakecontrolplane is a control plane that implements api/controlplane/v1 for tests: enrollment with one-time tokens, client certificates from its own CA, and the Connect stream.
test/fakeengine
Package fakeengine is a lightweight engine for operator tests (0004 §9): it speaks the bundle protocol, verifies each bundle's signature and acknowledges it, without inspecting any traffic.
Package fakeengine is a lightweight engine for operator tests (0004 §9): it speaks the bundle protocol, verifies each bundle's signature and acknowledges it, without inspecting any traffic.
test/stubcontrolplane command
Command stubcontrolplane runs the fake control plane (fakecontrolplane) as a server, for the end-to-end test on kind: it implements api/controlplane/v1 with its own CA, so this repository's tests never need a real control plane.
Command stubcontrolplane runs the fake control plane (fakecontrolplane) as a server, for the end-to-end test on kind: it implements api/controlplane/v1 with its own CA, so this repository's tests never need a real control plane.
test/testenv
Package testenv starts a local API server (envtest) with the Inkwall CRDs installed, for operator tests.
Package testenv starts a local API server (envtest) with the Inkwall CRDs installed, for operator tests.
webhook
Package webhook holds the operator's admission webhooks.
Package webhook holds the operator's admission webhooks.
pkg
adapters/forwardauth
Package forwardauth implements the forward-auth adapter used by Traefik's ForwardAuth middleware.
Package forwardauth implements the forward-auth adapter used by Traefik's ForwardAuth middleware.
adapters/httpcheck
Package httpcheck implements POST /v1/check, the engine's own check API (api/engine/v1).
Package httpcheck implements POST /v1/check, the engine's own check API (api/engine/v1).
adapters/internal/httpadapter
Package httpadapter holds request handling shared by the adapters that receive requests over net/http: the reverse proxy and forward-auth.
Package httpadapter holds request handling shared by the adapters that receive requests over net/http: the reverse proxy and forward-auth.
adapters/proxy
Package proxy implements Inkwall's standalone mode: an HTTP reverse proxy that inspects each request and forwards allowed ones to an upstream.
Package proxy implements Inkwall's standalone mode: an HTTP reverse proxy that inspects each request and forwards allowed ones to an upstream.
agent
Package agent connects the engine to the operator (0002 §5.2): it keeps one stream open, verifies and applies every bundle the operator sends, and reports what it applied.
Package agent connects the engine to the operator (0002 §5.2): it keeps one stream open, verifies and applies every bundle the operator sends, and reports what it applied.
bundlekey
Package bundlekey is how the operator and the engines name and exchange the public keys that bundles are signed with (0004 §4.6).
Package bundlekey is how the operator and the engines name and exchange the public keys that bundles are signed with (0004 §4.6).
clientip
Package clientip resolves the real client address of a request that may have passed through load balancers or proxies.
Package clientip resolves the real client address of a request that may have passed through load balancers or proxies.
events
Package events turns the engine's security events into SecurityEvents (0002 §5.4) and holds them, bounded, until the agent sends them to the operator.
Package events turns the engine's security events into SecurityEvents (0002 §5.4) and holds them, bounded, until the agent sends them to the operator.
pipeline
Package pipeline turns a request into a verdict: it runs the rule evaluator under a per-request deadline and applies the enforcement mode (detect or block) and the failure mode (fail open or closed).
Package pipeline turns a request into a verdict: it runs the rule evaluator under a per-request deadline and applies the enforcement mode (detect or block) and the failure mode (fail open or closed).
policy
Package policy enforces a bundle: each policy of the bundle gets its own pipeline (mode, failure mode, timeout, skip paths, rules, body settings), and each request is inspected by the policy of its route.
Package policy enforces a bundle: each policy of the bundle gets its own pipeline (mode, failure mode, timeout, skip paths, rules, body settings), and each request is inspected by the policy of its route.
request
Package request defines the canonical HTTP request that every Inkwall adapter produces and the inspection pipeline consumes.
Package request defines the canonical HTTP request that every Inkwall adapter produces and the inspection pipeline consumes.
router
Package router decides, before any rule runs, how much of a request needs inspection (pipeline tier T0).
Package router decides, before any rule runs, how much of a request needs inspection (pipeline tier T0).
rules
Package rules defines the interface between the inspection pipeline and a rule engine.
Package rules defines the interface between the inspection pipeline and a rule engine.
rules/coraza
Package coraza implements rules.Evaluator with OWASP Coraza and the OWASP Core Rule Set (CRS), which is embedded in the binary.
Package coraza implements rules.Evaluator with OWASP Coraza and the OWASP Core Rule Set (CRS), which is embedded in the binary.
telemetry
Package telemetry exposes engine metrics in the Prometheus format and the admin endpoints (/metrics, /healthz, /readyz).
Package telemetry exposes engine metrics in the Prometheus format and the admin endpoints (/metrics, /healthz, /readyz).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL