Skip to content

Commit cf7200f

Browse files
committed
up
1 parent a64b7e9 commit cf7200f

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

crowdsec-docs/docs/appsec/configuration.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ Even though we try to provide rules without false positives, sometimes a virtual
6464

6565
You can disable rules at runtime, either globally (for all requests) or based on specific conditions (source IP, URI, ...).
6666

67+
You can can disable rules by:
68+
- Name with `RemoveInBandRuleByName`: Intended for disabling rules provided by crowdsec (the name is the name of the appsec-rule as seen in `cscli appsec-rules list`).
69+
- ID with `RemoveInBandRuleByID`: Intended for disabling seclang rules
70+
- Tag with `RemoveInBandRuleByTag`: Intended for disabling seclang rules
71+
72+
The same functions exist for out-of-band rules, prefixed with `RemovedOutBandRuleBy...`
73+
6774
To disable a rule, we'll first create a new `appsec-config` to avoid tainting the configuration from the hub (if you are already using a custom configuration, you can update this one instead).
6875

6976
```yaml title="/etc/crowdsec/appsec-configs/my_config.yaml"
@@ -74,14 +81,14 @@ on_load:
7481
pre_eval:
7582
- filter: IsInBand == true && req.URL.Path startsWith "/bar/"
7683
apply:
77-
- RemoveInBandRuleByName("generic-wordpress-uploads-php")
84+
- RemoveInBandRuleByName("crowdsecurity/generic-wordpress-uploads-php")
7885
```
7986

8087
We are using the [hooks](/docs/appsec/hooks.md) provided by the appsec to modify the configuration in 2 places:
8188
- `on_load`: Expressions here will be applied when crowdsec loads the configuration, effectively disabling the rule `crowdsecurity/vpatch-env-access` globally.
8289
- `pre_eval`: Expressions here will be applied only if the provided filter matches. In this example, we are disabling the rule `crowdsecurity/generic-wordpress-uploads-php` only if the request URI starts with `/blog/` and if we are currently processing in-band rules.
8390

84-
You can also disable native (seclang) rules by providing their ID with the `RemoveInBandRuleByID` helper. See the [hooks](/docs/appsec/hooks.md) documentation for a list of available helpers.
91+
You can also disable native (seclang) rules by providing their ID with the `RemoveInBandRuleByID` helper. See the [hooks](appsec/hooks.md) documentation for a list of available helpers.
8592

8693
Also note that we are not loading any rules in our custom config: the rules are loaded by the `crowdsecurity/appsec-default` config, and we are just modifying the runtime behavior with this config.
8794

@@ -114,7 +121,7 @@ name: custom/my_config
114121
pre_eval:
115122
- filter: req.RemoteAddr == "1.2.3.4"
116123
apply:
117-
- RemoveInBandRuleByName("generic-wordpress-uploads-php")
124+
- RemoveInBandRuleByName("crowdsecurity/generic-wordpress-uploads-php")
118125
```
119126

120127
### Disable appsec for a specific FQDN

0 commit comments

Comments
 (0)