You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crowdsec-docs/docs/appsec/configuration.md
+42-12Lines changed: 42 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
2
id: configuration
3
-
title: AppSec Component Configuration Files
3
+
title: How To Setup AppSec Components
4
4
sidebar_position: 6
5
5
---
6
6
7
7
## Overview
8
8
9
-
This section covers the detailed configuration options for the CrowdSec AppSec Component.
9
+
This page explains the interraction between various files involved in AppSec configuration and the details about the processing pipeline AppSec request processing.
10
10
11
11
**Prerequisites**:
12
12
- Familiarity with [AppSec concepts](/appsec/intro.md)
@@ -18,11 +18,23 @@ The AppSec Component configuration consists of three main parts:
18
18
-**AppSec configurations**: Define which rules are loaded and how they behave, along with [hooks](/appsec/hooks.md) for runtime customization
19
19
-**[AppSec rules](/appsec/rules_syntax.md)**: The actual detection signatures that identify and block malicious requests
20
20
21
-
## Acquisition Configuration
21
+
## AppSec Acquisition
22
22
23
-
### Multiple AppSec Configurations
23
+
The goals of the acquisition file are:
24
+
- To specify the **address** and **port** where the AppSec-enabled Remediation Component(s) will forward the requests to.
25
+
- And specify one or more [AppSec configuration files](#appsec-configuration) to use as definition of what rules to apply and how.
24
26
25
-
Use `appsec_configs` to load multiple configurations that work together:
27
+
Details can be found in the [AppSec Datasource page](/log_processor/data_sources/apps).
28
+
29
+
### Defining Multiple AppSec Configurations
30
+
31
+
Often you will want to activate multiple AppSec configuration defining groups of rules that will be handled the same way.
32
+
33
+
Use the `appsec_configs`*(with an S)* parameter to load multiple configurations that work together.
34
+
35
+
In the following example we have two configurations:
36
+
- One with [CrowdSec default AppSec rules ↗️](https://app.crowdsec.net/hub/author/crowdsecurity/appsec-configurations/appsec-default) running in inband mode
37
+
- The other for the [CRS rules ↗️](https://app.crowdsec.net/hub/author/crowdsecurity/collections/appsec-crs) that by default run in out of band mode.
Do not forget to `sudo cscli collections install crowdsecurity/appsec-crs`.
50
+
CrowdSec AppSec collections are available on [CrowdSec Hub ↗️](https://app.crowdsec.net/hub/collections?filters=search%3Dappsec) and kept up to date.
51
+
52
+
For example the CRS collection: `sudo cscli collections install crowdsecurity/appsec-crs`.
39
53
This collection installs OWASP CRS in out-of-band and adds a scenario to ban IPs triggering multiple rules.
40
54
:::
41
55
42
-
### Creating Custom Configurations
56
+
### Using Custom Configurations
57
+
58
+
If you want to alter the default configuration files we recommend creating a new configuration files instead of modifying existing hub configurations.
59
+
Modifying hub configurations will make them *tainted* and prevent automatic updates.
43
60
44
-
Create new configuration files instead of modifying existing hub configurations. Modifying hub configurations will make them *tainted* and prevent automatic updates.
61
+
For example, if you want to change the default vpatch rules config, create your own and use it instead in the acquisition file.
AppSec configuration files declare **which rules to load** in the **in-band** *(blocking)* and/or **out-of-band** *(non-blocking)*, define how matches are handled (e.g., default remediation), and let you tweak processing via hooks like `on_load`, `pre_eval`, `post_eval`, and `on_match`.
86
+
87
+
For details, jump to the [Configuration properties list](#appendix-appsec-configuration-properties)
88
+
66
89
:::info
67
90
When loading multiple AppSec configs, _hooks_ and _appsec rules_ are appended, and for conflicting options (e.g., `default_remediation`), the last one takes precedence.
68
91
:::
69
92
70
-
## Configuration Processing Order
93
+
### Configuration Processing Order
71
94
72
95
When multiple AppSec configurations are loaded, they are processed in the order specified in the `appsec_configs` list. For details on how in-band and out-of-band rules work, see the [AppSec Introduction](/appsec/intro.md#inband-rules-and-out-of-band-rules).
73
96
@@ -80,7 +103,10 @@ When multiple AppSec configurations are loaded, they are processed in the order
80
103
81
104
## AppSec Configuration Reference
82
105
83
-
Each AppSec configuration file defines how rules are loaded and processed. Here's the complete reference of available directives:
106
+
Each AppSec configuration file defines how rules are loaded and processed.
107
+
You can create custom configuration files in the following folder: `/etc/crowdsec/appsec-configs/`
108
+
109
+
Here's the complete reference of available directives:
84
110
85
111
### Core Configuration Directives
86
112
@@ -119,6 +145,10 @@ Default action for in-band rules that match. Special value `allow` prevents bloc
119
145
default_remediation: ban # or "allow", "captcha", etc.
120
146
```
121
147
148
+
:::info
149
+
When loading multiple AppSec configs, _hooks_ and _appsec rules_ are appended, and for conflicting options (e.g., `default_remediation`), the last one takes precedence.
Action for requests that don't match any rules or match rules with pass action.
124
154
@@ -300,7 +330,7 @@ on_match:
300
330
301
331
With this config, the rules will still be evaluated, but if a rule matches no alert or event will be generated, and the remediation will be set to `allow`(ie, instruct the bouncer to let the request through).
302
332
303
-
## Appsec configuration
333
+
## Appendix: Appsec configuration properties
304
334
305
335
The AppSec configuration is referenced by the acquisition configuration (`appsec_config`, `appsec_configs` or `appsec_config_path`):
0 commit comments