Skip to main content

CrowdSec

CrowdSec enforcement is optional. When a local CrowdSec LAPI is available, the gateway can apply its decisions at the edge. Enforcement is switched on per host under Host → Edit → Security · CrowdSec:

SettingEffect
Inherit the deployment defaultFollows the node default shown in the selector.
Enforce decisions for this hostRequests from an address under an active decision are blocked with 403.
Do not enforce for this hostDecisions are ignored for this host.

The decision source is node-wide: one LAPI feeds every host, but each host decides whether to enforce it. A host can therefore stay reachable during an incident while the rest of the deployment enforces.

Prerequisites​

  • A CrowdSec LAPI the node can reach. A local LAPI on the host is fine: the data plane reaches it through the Compose data network's gateway. It must be reachable from the data-plane container, not only from the host.
  • A bouncer API key. Create one for this node in CrowdSec (cscli bouncers add portavium-proxy-1) and store it in a file that the controller can read, mode 0640 and group 10001 when it lives in secrets/.
  • A controller restart after changing either value: both are read at start.

The LAPI is configured in config/controller.env:

CROWDSEC_URL=http://192.0.2.30:8080
CROWDSEC_KEY_FILE=/secrets/crowdsec-bouncer.key

CROWDSEC_KEY_FILE is a bouncer key file (mode 0600) mounted read-only into the controller through the existing ./secrets:/secrets:ro mount. The controller seals the key into the compiled configuration, so the data-plane container does not need the file itself. Leave CROWDSEC_URL empty to run without enforcement.

What you can rely on — and what you cannot​

  • Client identity is the socket address. A client cannot change it with X-Forwarded-For unless you explicitly trust a proxy in front of the node.
  • Cached decisions keep blocking while the LAPI is down. That is what protects you during a decision-service outage.
  • A cold start with the LAPI unreachable fails open in the pinned bouncer. This was measured, not assumed. Plan restarts accordingly: restart the data plane only while the LAPI is reachable if enforcement must be continuous.
  • The outage policy is node-wide. The bouncer applies it to the whole node; the host editor shows the effective value and does not pretend a per-host outage policy exists.

Decision-source health, cache age and the effective outage policy are shown on System and alongside Security → CrowdSec blocks.

Measured boundary​

In the packaged acceptance lab (CrowdSec LAPI 1.8.2, isolated clients):

  • A newly added decision blocked the addressed client 8.6 s after it was created; another client was unaffected.
  • The blocked request reached neither the origin nor the origin's access log.
  • After a 120 s decision expired, the client was admitted again 15.3 s later.
  • During the refresh window, requests from a just-blocked client can still reach the origin. The measured window starts when the edge first denies.

These are the tested boundaries for this release. They are not a promise about a different LAPI version or a larger decision set.