Skip to content

Commit 54b66e0

Browse files
author
jdv
committed
updating configuration page
1 parent 79c8203 commit 54b66e0

File tree

2 files changed

+48
-14
lines changed

2 files changed

+48
-14
lines changed

crowdsec-docs/docs/appsec/configuration.md

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
id: configuration
3-
title: AppSec Component Configuration Files
3+
title: How To Setup AppSec Components
44
sidebar_position: 6
55
---
66

77
## Overview
88

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.
1010

1111
**Prerequisites**:
1212
- Familiarity with [AppSec concepts](/appsec/intro.md)
@@ -18,11 +18,23 @@ The AppSec Component configuration consists of three main parts:
1818
- **AppSec configurations**: Define which rules are loaded and how they behave, along with [hooks](/appsec/hooks.md) for runtime customization
1919
- **[AppSec rules](/appsec/rules_syntax.md)**: The actual detection signatures that identify and block malicious requests
2020

21-
## Acquisition Configuration
21+
## AppSec Acquisition
2222

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.
2426

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.
2638

2739
```yaml title="/etc/crowdsec/acquis.d/appsec.yaml"
2840
appsec_configs:
@@ -35,13 +47,18 @@ source: appsec
3547
```
3648
3749
:::info
38-
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`.
3953
This collection installs OWASP CRS in out-of-band and adds a scenario to ban IPs triggering multiple rules.
4054
:::
4155

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.
4360

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.
4562

4663
```yaml title="/etc/crowdsec/acquis.d/appsec.yaml"
4764
appsec_configs:
@@ -53,7 +70,7 @@ listen_addr: 127.0.0.1:7422
5370
source: appsec
5471
```
5572

56-
Create your custom configuration:
73+
A custom configuration file could look like this:
5774

5875
```yaml title="/etc/crowdsec/appsec-configs/my_vpatch_rules.yaml"
5976
name: custom/my_vpatch_rules
@@ -63,11 +80,17 @@ inband_rules:
6380
# Add custom hooks as needed
6481
```
6582

83+
## AppSec Configuration Files
84+
85+
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+
6689
:::info
6790
When loading multiple AppSec configs, _hooks_ and _appsec rules_ are appended, and for conflicting options (e.g., `default_remediation`), the last one takes precedence.
6891
:::
6992

70-
## Configuration Processing Order
93+
### Configuration Processing Order
7194

7295
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).
7396

@@ -80,7 +103,10 @@ When multiple AppSec configurations are loaded, they are processed in the order
80103

81104
## AppSec Configuration Reference
82105

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:
84110

85111
### Core Configuration Directives
86112

@@ -119,6 +145,10 @@ Default action for in-band rules that match. Special value `allow` prevents bloc
119145
default_remediation: ban # or "allow", "captcha", etc.
120146
```
121147

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.
150+
:::
151+
122152
#### `default_pass_action` (optional, default: "allow")
123153
Action for requests that don't match any rules or match rules with pass action.
124154

@@ -300,7 +330,7 @@ on_match:
300330

301331
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).
302332

303-
## Appsec configuration
333+
## Appendix: Appsec configuration properties
304334

305335
The AppSec configuration is referenced by the acquisition configuration (`appsec_config`, `appsec_configs` or `appsec_config_path`):
306336

crowdsec-docs/docs/log_processor/data_sources/appsec.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,17 @@ Defaults to `127.0.0.1:7442`.
3535
The path the Application Security Component will respond to.
3636
Defaults to `/`.
3737

38-
### `appsec_config`
38+
### `appsec_configs`
3939

4040
The name of the appsec-config to use (as seen in `cscli appsec-configs list`).
4141

42+
### `appsec_config`
43+
44+
**Deprecated**, use [`appsec_configs`](#appsec_configs)
45+
4246
### `appsec_config_path`
4347

44-
The path to the appsec-config to use (as seen in `cscli appsec-configs list`).
48+
**Deprecated**, use [`appsec_configs`](#appsec_configs)
4549

4650
### `routines`
4751

0 commit comments

Comments
 (0)