Skip to main content
Security Engine version:
Version: v1.8

OWASP CRS Installation

Choosing a CRS version​

The CRS is shipped in CrowdSec through versioned collections: each CRS minor release has its own pair of collections, one for non-blocking (out-of-band) mode and one for blocking (in-band) mode:

CRS versionNon-blocking (out-of-band)Blocking (in-band)
4.31crowdsecurity/crs-4.31crowdsecurity/crs-4.31-inband

A versioned collection is pinned to a CRS release line:

  • Patch releases (for example 4.31.1, 4.31.2) are delivered automatically through cscli hub upgrade.
  • Newer CRS versions are published as new collections (crowdsecurity/crs-<version> and crowdsecurity/crs-<version>-inband). You never get a new CRS version unless you explicitly install it, because a new version can contain breaking changes for your application or your customizations.

You can list the available CRS collections with:

SH
cscli collections list -a | grep crs

We recommend using the latest versioned collection available in the Hub.

Legacy collections

The crowdsecurity/appsec-crs and crowdsecurity/appsec-crs-inband collections (and their crowdsecurity/crs and crowdsecurity/crs-inband appsec-configs) ship a very old CRS version. They are only kept for backward compatibility and will not receive newer CRS versions.

If you are using them, we recommend migrating to a versioned collection.

Only install one CRS version at a time

Only one CRS version must be installed and used at a time: do not combine collections from different CRS versions (for example crowdsecurity/crs-4.31 and crowdsecurity/crs-4.32), or a versioned collection with crowdsecurity/appsec-crs or crowdsecurity/appsec-crs-inband.

The out-of-band and in-band collections of the same version (for example crowdsecurity/crs-4.31 and crowdsecurity/crs-4.31-inband) can be installed together: they ship the same CRS rules, which are loaded by a different engine depending on the mode.

Installing the CRS​

The examples below use CRS 4.31: replace the version with the one you want to use.

Non-blocking mode​

If you have never deployed the CRS on your website, we recommend deploying the rules first in non-blocking mode.

In this mode, requests are evaluated out of band, meaning they cannot be blocked, but events will still be generated.

In order to use the CRS in non-blocking mode, you need to install the corresponding collection:

SH
cscli collections install crowdsecurity/crs-4.31

The crowdsecurity/crs-4.31 collection includes:

  • crowdsecurity/crs-4.31: AppSec config that loads CRS rules in out-of-band mode and generates an alert for every request matching CRS rules
  • crowdsecurity/crowdsec-appsec-outofband: Scenario that bans IPs after 5+ requests matching CRS rules

Then use it in your acquisition configuration, for example /etc/crowdsec/acquis.d/waf.yaml:

YAML
source: appsec
appsec_configs:
- crowdsecurity/crs-4.31
labels:
type: appsec
info

If an IP triggers too many different rules in a very short timespan, the IP will be blocked, regardless of whether the CRS rules are in blocking mode or not.

note

With the legacy crowdsecurity/crs appsec-config, non-blocking mode does not generate alerts by default. You can change this by adding a custom appsec-config to your acquisition configuration, for example /etc/crowdsec/appsec-configs/crs-alerting.yaml:

YAML
name: custom/crs-alerting
outofband:
on_match:
- apply:
- SendAlert()
- CancelEvent() # This one is optional: if set, no event will be generated, meaning CrowdSec will never take a decision based on the rules that were matched.
YAML
source: appsec
appsec_configs:
- crowdsecurity/crs
- custom/crs-alerting
labels:
type: appsec

Blocking mode​

You can also configure the CRS in blocking mode. In this mode, any requests reaching the default CRS threshold for blocking will be dropped.

You need to install the corresponding collection:

SH
cscli collections install crowdsecurity/crs-4.31-inband

Then load it in your configuration:

YAML
source: appsec
appsec_configs:
- crowdsecurity/crs-4.31-inband
labels:
type: appsec

In this mode, requests will be blocked, and alerts will be generated by default.

Upgrading to a new CRS version​

Because each CRS version is a separate collection, upgrading to a new CRS version (or migrating from the legacy crowdsecurity/appsec-crs / crowdsecurity/appsec-crs-inband collections) is a manual operation.

warning

Before upgrading, make sure your application and your customizations are compatible with the new version:

  • Read the CRS release notes for every version between the one you are running and the target one.
  • Review your plugins and custom exclusions: variables you override (such as tx.allowed_methods) can change format, and rule IDs can be added, changed or removed.
  • New or updated rules can trigger new false positives on your application. If you are running in blocking mode, consider testing the new version in non-blocking mode first, or on a staging environment.

Once you are ready, install the new collection and remove the previous one (here, moving from CRS 4.31 to a hypothetical CRS 4.32 in blocking mode):

SH
cscli collections install crowdsecurity/crs-4.32-inband
cscli collections remove crowdsecurity/crs-4.31-inband

Then replace the previous appsec-config with the new one in your WAF acquisition configuration:

YAML
source: appsec
appsec_configs:
- crowdsecurity/crs-4.32-inband
labels:
type: appsec

Finally, restart CrowdSec:

SH
sudo systemctl restart crowdsec

Your CRS plugins (installed from the Hub or manually) are kept during the upgrade.

CrowdSec Docs
We use cookies

This site uses cookies to help us improve your experience. You can accept or decline below.