@@ -23,20 +23,20 @@ CrowdSec is a modular security tool offering [behavior-based detection](https://
-The crowd-sourced aspect allows the sharing of attacks they detected and blocked. Participants of this crowd-sourced threat intel receive, automatically via the security engine, a curated list of validated attackers (community blocklist) enhancing their real-time protection capabilities by taking preemptive actions against known threats.
+CrowdSec is crowdsourced: when you participate, you share the attacks you detect and block. In return, the Security Engine automatically downloads a curated list of validated attackers (the community blocklist), so you can take action sooner against known threats.
## Main Features
In addition to the core "detect and react" mechanism, CrowdSec is committed to several other key aspects:
-- **Easy Installation**: Effortless out-of-the-box installation on all [supported platforms](/u/getting_started/intro).
-- **Simplified Daily Operations**: You have access to our Web UI administration via [CrowdSec's console](http://app.crowdsec.net) or the powerful [Command line tool cscli](/cscli/cscli.md) for effortless maintenance and keeping your detection mechanisms up-to-date.
-- **Reproducibility**: The Security Engine can analyze not only live logs but also [cold logs](/u/user_guides/replay_mode), making it easier to detect potential false triggers, conduct forensic analysis, or generate reports.
-- **Versatile**: The Security Engine can analyze [system logs](/log_processor/data_sources/introduction.md) and [HTTP Requests](/appsec/intro.md) to exhaustively protect your perimeter.
+- **Easy Installation**: Get started quickly on all [supported platforms](/u/getting_started/intro).
+- **Simplified Daily Operations**: Manage and maintain your setup from the [CrowdSec Console](http://app.crowdsec.net) (Web UI) or with the [cscli command-line tool](/cscli/cscli.md).
+- **Reproducibility**: Analyze live logs and [cold logs](/u/user_guides/replay_mode) to validate detections, run forensic analysis, or generate reports.
+- **Versatile**: Protect your perimeter by analyzing [system logs](/log_processor/data_sources/introduction.md) and [HTTP requests](/appsec/intro.md).
- **Observability**: Providing valuable insights into the system's activity:
- - Users can view/manage alerts from the ([Console](https://app.crowdsec.net/signup)).
- - Operations personnel have access to detailed Prometheus metrics ([Prometheus](/observability/prometheus.md)).
- - Administrators can utilize a user-friendly command-line interface tool ([cscli](/observability/cscli.md)).
+ - View and manage alerts in the [Console](https://app.crowdsec.net/signup).
+ - Expose detailed [Prometheus metrics](/observability/prometheus.md).
+ - Use the [cscli CLI](/observability/cscli.md) for administration.
- **API-Centric**: All components communicate via an [HTTP API](/local_api/intro.md), facilitating multi-machine setups.
## Architecture
@@ -49,23 +49,23 @@ In addition to the core "detect and react" mechanism, CrowdSec is committed to s
Under the hood, the Security Engine has various components:
-- The [Log Processor](/log_processor/intro.mdx) is in charge of detection: it analyzes logs from [various data sources](/log_processor/data_sources/introduction.md) or [HTTP requests](/appsec/intro.md) from web servers.
-- The [Appsec](appsec/intro) feature is part of the Log Processor and filters HTTP Requests from the compatible web servers.
-- The [Local API](local_api/intro.md) acts as a middle man:
+- The [Log Processor](/log_processor/intro.mdx) handles detection. It analyzes logs from [various data sources](/log_processor/data_sources/introduction.md) and [HTTP requests](/appsec/intro.md) from compatible web servers.
+- The [Appsec](appsec/intro) feature is part of the Log Processor. It filters HTTP requests from compatible web servers.
+- The [Local API](local_api/intro.md) acts as a middleman:
- Between the [Log Processors](/log_processor/intro.mdx) and the [Remediation Components](/u/bouncers/intro) which are in charge of enforcing decisions.
- And with the [Central API](/central_api/intro.md) to share alerts and receive blocklists.
-- The [Remediation Components](/u/bouncers/intro) - also known as bouncers - block malicious IPs at your chosen level—whether via IpTables, firewalls, web servers, or reverse proxies. [See the full list on our CrowdSec Hub.](https://app.crowdsec.net/hub/remediation-components)
+- The [Remediation Components](/u/bouncers/intro) (also called bouncers) block malicious IPs at your chosen level—IpTables, firewalls, web servers, or reverse proxies. [See the full list on the CrowdSec Hub.](https://app.crowdsec.net/hub/remediation-components)
## Deployment options
-This architecture allows for both simple/standalone setups, or more distributed ones including as illustrated below:
+This architecture supports simple standalone setups and more distributed deployments:
-- Single machine ? Follow our [getting started guide](/u/getting_started/intro)
-- Multiple machines? Use the [distributed setup guide](/u/user_guides/multiserver_setup)
-- Already have a log pit (such as rsyslog or loki)? [Run crowdsec next to it](/u/user_guides/log_centralization), not on the production workloads
-- Running Kubernetes? Have a look at [our helm chart](/u/getting_started/installation/kubernetes)
-- Running containers? The [docker data source](/log_processor/data_sources/docker.md) might be what you need
-- Just looking for a WAF? Look at [our quickstart](appsec/intro)
+- Single machine: Follow the [getting started guide](/u/getting_started/intro).
+- Multiple machines: Use the [distributed setup guide](/u/user_guides/multiserver_setup).
+- Centralized logs (rsyslog, Loki, ...): [Run CrowdSec next to your log pipeline](/u/user_guides/log_centralization), not on production workloads.
+- Kubernetes: See [our Helm chart](/u/getting_started/installation/kubernetes).
+- Containers: Use the [Docker data source](/log_processor/data_sources/docker.md).
+- WAF only: Start with the [AppSec quickstart](appsec/intro).
Distributed architecture example:
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/local_api/allowlists.md b/crowdsec-docs/versioned_docs/version-v1.7/local_api/allowlists.md
index 166e557eb..045897c24 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/local_api/allowlists.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/local_api/allowlists.md
@@ -6,10 +6,16 @@ sidebar_position: 7
# AllowLists
-The AllowLists feature in CrowdSec lets users manage IP-based allowlists at the LAPI level, affecting both local decisions and blocklist pulls. [Paying customers can also control AllowLists directly from the console for added convenience](/u/console/allowlists). This ensures greater flexibility in managing trusted IPs while maintaining CrowdSec’s robust security measures.
+The AllowLists feature in CrowdSec lets you manage IP-based allowlists at the LAPI level. It affects both local decisions and blocklist pulls, giving you more flexibility to trust specific IPs while keeping CrowdSec security controls in place.
+:::tip CrowdSec Premium: Centralized Console Management
-The AllowLists affect local decision and blocklist pulls in different ways:
+Premium users can manage AllowLists directly from the [CrowdSec Console](/u/console/allowlists), enabling centralized management across multiple Security Engines and Integrations. Console-managed allowlists require subscribing entities (Security Engines, Integrations, or Organizations) after creation.
+
+:::
+
+
+AllowLists affect local decisions and blocklist pulls in different ways:
| Area | Action | Real Time |
|-------|------|------|
@@ -19,14 +25,14 @@ The AllowLists affect local decision and blocklist pulls in different ways:
| cscli | Decision is blocked unless special flag is provided | ✅ |
-AllowLists are limited to IP/Range based rules. If you need rules that rely on log elements such as URL and so on, [Parser Whitelists](/log_processor/whitelist/introduction.md) or [Profile Rules](/local_api/profiles/format.md) might more relevant.
+AllowLists are limited to IP/range-based rules. If you need rules based on log elements (such as URLs), [Parser Whitelists](/log_processor/whitelist/introduction.md) or [Profile Rules](/local_api/profiles/format.md) might be more relevant.
-### Creating an allowlist
+## Creating an allowlist
-Allowlists creation is done with `cscli allowlists create`, for example: `cscli allowlists create my_allowlistd -d safe_ips`.
+Create an allowlist with `cscli allowlists create`, for example: `cscli allowlists create my_allowlist -d safe_ips`.
-The `-d` parameter is mandatory, it's a description for the allowlist for future reference:
+The `-d` flag is mandatory. It sets a description for future reference:
```bash
$ cscli allowlists create my_allowlist --description "test allowlist"
allowlist 'my_allowlist' created successfully
@@ -34,20 +40,20 @@ allowlist 'my_allowlist' created successfully
This command must be run on the LAPI.
-### Adding entries to an allowlist
+## Adding entries to an allowlist
-Adding new entries to an allowlist is done with `cscli allowlists add
value_1 value_2 ...`.
+Add entries with `cscli allowlists add value_1 value_2 ...`.
The allowlist must exist.
By default, allowlist entries have no expiration, but you can specify one with the `-e` flag:
```bash
-$ cscli allowlist add my_allowlist 1.2.3.4 -e 7d
+$ cscli allowlists add my_allowlist 1.2.3.4 -e 7d
added 1 values to allowlist my_allowlist
```
-Values can be either IPs or ranges.
+Values can be IPs or ranges.
You can add an optional description for each entry with the `-d` flag:
@@ -56,14 +62,14 @@ $ cscli allowlists add my_allowlist 1.2.3.4 -e 7d -d "pentest IPs"
added 1 values to allowlist my_allowlist
```
-You cannot add the same values twice to an allowlist: if you want to edit an entry, you'll need to remove it first then add it again.
+You cannot add the same value twice to an allowlist. To edit an entry, remove it first, then add it again.
This command must be run on the LAPI.
-### Removing entries from an allowlist
+## Removing entries from an allowlist
-Removing entries from an allowlist is done with `cscli allowlists remove value_1 value_2 ...`:
+Remove entries with `cscli allowlists remove value_1 value_2 ...`:
```bash
$ cscli allowlists remove my_allowlist 1.2.3.4
removed 1 values from allowlist my_allowlist
@@ -72,12 +78,12 @@ removed 1 values from allowlist my_allowlist
This command must be run on the LAPI.
-### Viewing the content of an allowlist
+## Viewing the contents of an allowlist
-Allowlists can be inspected with `cscli allowlists inspect `:
+Inspect an allowlist with `cscli allowlists inspect `:
```bash
-$ cscli allowlist inspect my_allowlist
+$ cscli allowlists inspect my_allowlist
──────────────────────────────────────────────
Allowlist: my_allowlist
@@ -99,9 +105,9 @@ $ cscli allowlist inspect my_allowlist
This command can be run on the LAPI or any log processor machine.
-### Deleting an allowlist
+## Deleting an allowlist
-Allowlists can be deleted with `cscli allowlists delete `:
+Delete an allowlist with `cscli allowlists delete `:
```bash
$ cscli allowlists delete my_allowlist
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/local_api/notification_plugins/intro.md b/crowdsec-docs/versioned_docs/version-v1.7/local_api/notification_plugins/intro.md
index 0e9d29d74..e1f505466 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/local_api/notification_plugins/intro.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/local_api/notification_plugins/intro.md
@@ -643,6 +643,8 @@ Extract the meta associated with the alerts
plugin configuration. Those are provided by the `cscli notifications`
command and its subcommands.
+For a practical, end-to-end walkthrough, see [Testing notification plugins](/local_api/notification_plugins/testing.md).
+
| SubCommand | Description |
|---------|-------------|
| [list](/cscli/cscli_notifications_list.md) | List all notification plugins and their status |
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/local_api/notification_plugins/testing.md b/crowdsec-docs/versioned_docs/version-v1.7/local_api/notification_plugins/testing.md
new file mode 100644
index 000000000..bd72fd4da
--- /dev/null
+++ b/crowdsec-docs/versioned_docs/version-v1.7/local_api/notification_plugins/testing.md
@@ -0,0 +1,126 @@
+---
+id: testing
+title: Testing notification plugins
+---
+
+This guide walks through practical ways to validate a notification plugin, from config checks to end-to-end delivery.
+
+```info
+Template updates are picked up by the `cscli notifications` commands while testing. Restart CrowdSec only after you are satisfied with the changes.
+```
+
+## When to use test vs reinject
+
+- `cscli notifications test` sends a generic alert directly to a plugin. The plugin does not need to be active in any profile for this to work.
+- `cscli notifications reinject` replays a real alert through the profiles pipeline, so filters and profile settings apply. It can also include additional meta fields present in real alerts, which are not part of the generic test alert.
+
+## Pre-flight checklist
+
+1. Confirm the plugin binary and config file exist in the directories defined by `config_paths.plugin_dir` and `config_paths.notification_dir`. By default, standard packages already ship these; this check is mainly for custom installations.
+2. If you plan to test via profiles (using `reinject`), make sure the plugin config `name` matches the name used in your profile `notifications` list.
+3. If the plugin uses environment variables, export them before testing (see [Introduction](/local_api/notification_plugins/intro.md)).
+
+Example profile snippet:
+
+```yaml
+notifications:
+ - slackreport
+```
+
+## Check plugin status and config
+
+List plugins and ensure yours is enabled:
+
+```bash
+cscli notifications list
+```
+
+Inspect a specific plugin to confirm the resolved configuration:
+
+```bash
+cscli notifications inspect slackreport
+```
+
+## Send a direct test notification
+
+Send a generic alert directly to the plugin:
+
+```bash
+cscli notifications test slackreport
+```
+
+Override fields in the generic alert to match your formatting or routing logic:
+
+```bash
+cscli notifications test slackreport -a '{"scenario":"notification/test","remediation":true}'
+```
+
+If your plugin relies on secrets from environment variables, pass them inline or export them in your shell:
+
+```bash
+SMTP_PASSWORD=your_password cscli notifications test email_default
+```
+
+## Reinject a real alert through profiles
+
+Find an alert ID to replay using the default table output:
+
+```bash
+cscli alerts list
+```
+
+Example output:
+
+```
+cscli alerts list
+╭──────┬───────────────────┬────────────────────────────────────────────┬─────────┬──────────────────────┬───────────┬──────────────────────╮
+│ ID │ value │ reason │ country │ as │ decisions │ created_at │
+├──────┼───────────────────┼────────────────────────────────────────────┼─────────┼──────────────────────┼───────────┼──────────────────────┤
+│ 2843 │ Ip:10.0.12.10 │ crowdsecurity/http-probing │ GB │ 64500 ExampleNet │ ban:1 │ 2026-01-13T09:13:25Z │
+│ 2837 │ Ip:10.0.21.71 │ crowdsecurity/http-backdoors-attempts │ GB │ 64501 ExampleCloud │ ban:1 │ 2026-01-13T07:50:53Z │
+│ 2836 │ Ip:10.0.33.50 │ crowdsecurity/http-crawl-non_statics │ GB │ 64502 ExampleHosting │ ban:1 │ 2026-01-13T06:12:26Z │
+╰──────┴───────────────────┴────────────────────────────────────────────┴─────────┴──────────────────────┴───────────┴──────────────────────╯
+```
+
+Grab the ID from the `ID` column and use it with `cscli notifications reinject`.
+
+Reinject the alert through the profiles pipeline:
+
+```bash
+cscli notifications reinject
+```
+
+Override fields if needed to match your profile filter:
+
+```bash
+cscli notifications reinject -a '{"remediation": true}'
+```
+
+If nothing is sent, confirm the profile filter matches the alert fields you are setting (for example, `Alert.Remediation == true`).
+
+## Expected outcomes
+
+What "success" looks like depends on the plugin:
+
+- **HTTP/Teams/Telegram/Slack**: a delivered message or a 2xx response from the endpoint.
+- **File**: a new line appended to the configured file.
+- **Email**: a delivered message or an entry in the SMTP logs.
+- **Splunk/Elastic/Sentinel**: a new event ingested in the target index or workspace.
+
+If you get a response but no visible output, double-check the plugin-specific filters and templates.
+
+## Make reinject match your profiles
+
+If your profile filters depend on fields like `scenario`, `remediation`, or the source IP, override them in the reinjected alert:
+
+```bash
+cscli notifications reinject -a '{"scenario":"notification/test","remediation":true,"source":{"value":"10.0.12.10"}}'
+```
+
+This is useful when your profile uses conditions such as `Alert.Remediation == true` or specific scenarios.
+
+## Troubleshooting signals
+
+- Use `--debug` with `cscli` to surface plugin errors or config parsing issues.
+- Check the CrowdSec service logs for plugin startup or gRPC errors.
+- For file or HTTP-based plugins, verify that the target file or endpoint is being written to.
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/collections/format.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/collections/format.md
index ff11eca81..ec6b48a08 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/collections/format.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/collections/format.md
@@ -4,11 +4,14 @@ title: Format
sidebar_position: 2
---
-## Scenario configuration example
+## Collection configuration example
-```yaml title=/etc/crowdsec/collections/linux.yaml
-#the list of parsers it contains
+```yaml title="/etc/crowdsec/collections/my-collection.yaml"
+# List the Hub items included in this collection.
+# Names are the same as in `cscli ... list -a` (for example: `cscli scenarios list -a`).
+#
+# the list of parsers it contains
parsers:
- crowdsecurity/syslog-logs
- crowdsecurity/geoip-enrich
@@ -16,12 +19,21 @@ parsers:
#the list of collections it contains
collections:
- crowdsecurity/sshd
+# the list of contexts it contains
+# contexts:
+# - crowdsecurity/http_base
# the list of postoverflows it contains
# postoverflows:
# - crowdsecurity/seo-bots-whitelist
# the list of scenarios it contains
# scenarios:
# - crowdsecurity/http-crawl-non_statics
+# the list of appsec-rules it contains (WAF rules)
+# appsec-rules:
+# - crowdsecurity/crs
+# the list of appsec-configs it contains (WAF configurations)
+# appsec-configs:
+# - crowdsecurity/virtual-patching
description: "core linux support : syslog+geoip+ssh"
author: crowdsecurity
tags:
@@ -40,6 +52,14 @@ parsers:
List of parsers to include in the collection.
+### `collections`
+
+```yaml
+collections:
+```
+
+List of collections to include (collections can include other collections).
+
### `scenarios`
@@ -49,6 +69,16 @@ scenarios:
List of scenarios to include in the collection.
+### `contexts`
+
+```yaml
+contexts:
+```
+
+List of alert context definitions to include in the collection. Contexts enrich alerts with additional key/value fields and are stored under the `contexts` directory in the CrowdSec configuration.
+
+See [Alert Context](/log_processor/alert_context/intro.md) and the `cscli` commands used to manage Hub contexts: [`cscli contexts`](/cscli/cscli_contexts.md).
+
### `postoverflows`
```yaml
@@ -57,9 +87,27 @@ postoverflows:
List of postoverflows to include in the collection.
-The `description` is mandatory.
+See [Postoverflows](/log_processor/parsers/introduction.mdx#postoverflows).
-It is a quick sentence describing what it detects.
+### `appsec-rules`
+
+```yaml
+appsec-rules:
+```
+
+List of AppSec (WAF) rules to include in the collection.
+
+See [AppSec](/appsec/intro.md) and [`cscli appsec-rules`](/cscli/cscli_appsec-rules.md).
+
+### `appsec-configs`
+
+```yaml
+appsec-configs:
+```
+
+List of AppSec configuration items to include in the collection (these define which rules are evaluated and how matches are handled).
+
+See [AppSec configuration](/appsec/configuration.md) and [`cscli appsec-configs`](/cscli/cscli_appsec-configs.md).
### `description`
@@ -87,4 +135,3 @@ tags:
```
List of tags.
-
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/collections/introduction.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/collections/introduction.md
index bc2608e6a..3ee1c7170 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/collections/introduction.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/collections/introduction.md
@@ -4,6 +4,31 @@ title: Introduction
sidebar_position: 1
---
-Collections are bundle of parsers, scenarios, postoverflows that form a coherent package.
+Collections are bundles of detection content that you install together to support a given service or use case (for example: NGINX, SSH, WordPress, or generic HTTP attacks).
+In practice, a collection is a YAML file that references other Hub items such as:
+- **Parsers**: extract structured fields from raw log lines. See [Parsers](/log_processor/parsers/introduction.mdx).
+- **Scenarios**: detect behaviors by correlating events over time. See [Scenarios](/log_processor/scenarios/introduction.mdx).
+- **Postoverflows**: additional processing after a scenario triggers (often used for last-chance whitelisting). See [Postoverflows](/log_processor/parsers/introduction.mdx#postoverflows) and [Whitelists](/log_processor/whitelist/introduction.md).
+- **Contexts**: enrich alerts with additional key/value fields. See [Alert Context](/log_processor/alert_context/intro.md).
+- **AppSec rules / configurations**: WAF rules and their configuration. See [AppSec](/appsec/intro.md) and [AppSec configuration](/appsec/configuration.md).
+
+## Why collections exist
+
+Collections are the recommended way to install detection content because they:
+
+- Keep configurations consistent (the right parsers + scenarios shipped together).
+- Make installation and updates easier (one package per service).
+- Reduce missed detections caused by incomplete installs.
+
+## Installing and updating collections
+
+Collections are distributed via the CrowdSec Hub and managed with `cscli`:
+
+- Update the Hub index: see [`cscli hub update`](/cscli/cscli_hub_update.md)
+- Install or upgrade items: see [`cscli hub upgrade`](/cscli/cscli_hub_upgrade.md) and [Hub management](/cscli/cscli_hub.md)
+
+## Collection file format
+
+To understand what a collection can contain (and how it is defined), see [Collection format](/log_processor/collections/format.md).
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/data_sources/appsec.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/data_sources/appsec.md
index 676bc72d6..8b38aae3d 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/data_sources/appsec.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/data_sources/appsec.md
@@ -6,21 +6,22 @@ title: Application Security Component
This module allows you to enable the `Application Security Component` as a data source.
-A more detailed documentation is available [here](/docs/next/appsec/intro).
+A more detailed documentation is available [here](/appsec/intro.md).
-A quickstart tutorial is available for [Nginx/OpenResty](/docs/next/appsec/quickstart/nginxopenresty) and [Traefik](/docs/next/appsec/quickstart/traefik).
+A quickstart tutorial is available for [Nginx/OpenResty](/appsec/quickstart/nginxopenresty.mdx) and [Traefik](/appsec/quickstart/traefik.mdx).
## Configuration example
-To start an Application Security Component on port 7422, listening on 127.0.0.1, using the `crowdsecurity/vpatch` config:
+To start an Application Security Component on port 7422, listening on 127.0.0.1, using the `crowdsecurity/appsec-default` configuration:
```yaml
source: appsec
listen_addr: 127.0.0.1:7422
path: /
-appsec_config: crowdsecurity/virtual-patching
+appsec_configs:
+ - crowdsecurity/appsec-default
labels:
- type: appsec
+ type: appsec
```
## Parameters
@@ -28,7 +29,7 @@ labels:
### `listen_addr`
The address and port to listen on.
-Defaults to `127.0.0.1:7442`.
+Defaults to `127.0.0.1:7422`.
### `path`
@@ -37,7 +38,7 @@ Defaults to `/`.
### `appsec_configs`
-The name of the appsec-config to use (as seen in `cscli appsec-configs list`).
+The list of appsec-configs to use (as seen in `cscli appsec-configs list`).
### `appsec_config`
@@ -66,4 +67,4 @@ Path to the key file to allow HTTPS communication between the remediation compon
## DSN and command-line
-This module does not support acquisition from the command line.
\ No newline at end of file
+This module does not support acquisition from the command line.
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/parsers/format.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/parsers/format.md
index f81ace5e5..110aef98f 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/parsers/format.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/parsers/format.md
@@ -393,17 +393,18 @@ statics:
data:
- source_url: https://URL/TO/FILE
dest_file: LOCAL_FILENAME
- type: (regexp|string)
+ type: (regexp|string|map)
```
`data` allows user to specify an external source of data.
This section is only relevant when `cscli` is used to install parser from hub, as it will download the `source_url` and store it to `dest_file`. When the parser is not installed from the hub, CrowdSec won't download the URL, but the file must exist for the parser to be loaded correctly.
-The `type` is mandatory if you want to evaluate the data in the file, and should be `regex` for valid (re2) regular expression per line or `string` for string per line.
+The `type` is mandatory if you want to evaluate the data in the file, and should be `regex` for valid (re2) regular expression per line, `string` for string per line, or `map` for JSON-lines map files (see [map file helpers](/expr/file_helpers.md#map-file-helpers)).
+
The regexps will be compiled, the strings will be loaded into a list and both will be kept in memory.
Without specifying a `type`, the file will be downloaded and stored as file and not in memory.
-You can refer to the content of the downloaded file(s) by using either the `File()` or `RegexpInFile()` function in an expression:
+You can refer to the content of the downloaded file(s) by using `File()`, `RegexpInFile()`, `FileMap()`, or `LookupFile()` in an expression:
```yaml
filter: 'evt.Meta.log_type in ["http_access-log", "http_error-log"] and any(File("backdoors.txt"), { evt.Parsed.request contains #})'
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/scenarios/deploy.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/scenarios/deploy.md
new file mode 100644
index 000000000..6978b5f04
--- /dev/null
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/scenarios/deploy.md
@@ -0,0 +1,34 @@
+---
+id: deploy
+title: Deploy
+sidebar_position: 4
+---
+
+:::warning
+
+This documentation mostly focus on installation of custom scenarios. Scenarios from the hub should be installed as a part of the collection, by using `cscli collections install `. Installing scenarios directly with `cscli scenario install ` might lead to unexpected results because of missing dependencies (ie. parsers, enrichers, post-overflows etc.)
+
+:::
+
+
+## Deployment
+
+### Installation
+
+To deploy a scenario, simply copy it to `/etc/crowdsec/scenarios/`.
+
+### Verification
+
+Use `cscli scenarios list` to view all your installed scenarios:
+
+- `Name` presents the `name` field of the yaml file.
+- `Version` represents the version of the scenario according to the hub. Versions increment on upstream changes.
+- `Local path` represents the local path to the scenario file.
+- `📦 Status` indicates the state:
+
+| Status | Description |
+|--------|-------------|
+| `✔️ enabled` | Scenario is from the hub and up-to-date |
+| `🏠 enabled,local` | This is a custom scenario |
+| `⚠️ enabled,tainted` | This is an upstream scenario that has been modified |
+
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/scenarios/format.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/scenarios/format.md
index d7e8ff165..5e42120db 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/scenarios/format.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/scenarios/format.md
@@ -612,7 +612,7 @@ If the `cancel_on` expression returns true, the bucket is immediately destroyed
data:
- source_url: https://URL/TO/FILE
dest_file: LOCAL_FILENAME
- [type: (regexp|string)]
+ [type: (regexp|string|map)]
```
:::info
@@ -628,12 +628,12 @@ The `source_url` section is only relevant when `cscli` is used to install scenar
When the scenario is not installed from the hub, CrowdSec will not download the `source_url`, however, if the file exists at `dest_file` within the data directory it will still be loaded into memory.
-The `type` is mandatory if you want to evaluate the data in the file, and should be `regex` for valid (re2) regular expression per line or `string` for string per line.
+The `type` is mandatory if you want to evaluate the data in the file, and should be `regex` for valid (re2) regular expression per line, `string` for string per line, or `map` for JSON-lines map files (see [map file helpers](/expr/file_helpers.md#map-file-helpers)).
The regexps will be compiled, the strings will be loaded into a list and both will be kept in memory.
Without specifying a `type`, the file will be downloaded and stored as file and not in memory.
-You can refer to the content of the downloaded file(s) by using either the `File()` or `RegexpInFile()` function in an expression:
+You can refer to the content of the downloaded file(s) by using `File()`, `RegexpInFile()`, `FileMap()`, or `LookupFile()` in an expression:
```yaml
filter: 'evt.Meta.log_type in ["http_access-log", "http_error-log"] and any(File("backdoors.txt"), { evt.Parsed.request contains #})'
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/capi_based_whitelist.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/capi_based_whitelist.md
index 7394468de..f324c6795 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/capi_based_whitelist.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/capi_based_whitelist.md
@@ -6,13 +6,13 @@ title: CAPI
:::warning
This option is deprecated.
-You should use [centralized allowlists](local_api/allowlists.md) instead.
+You should use [centralized allowlists](/local_api/allowlists.md) instead.
:::
## Whitelists from CAPI (Central API) community blocklist or third party blocklist
-From version 1.5.0 a user can specify a list of IP's or IP ranges to be whitelisted from a community blocklist or third party blocklist. You will have to specify a path to the file within `config.yaml` as by default there is no file specified.
+From version 1.5.0, you can define IPs or IP ranges to whitelist from the community blocklist or third-party blocklists. Set the whitelist file path in `config.yaml` (no default path is set).
```yaml
api:
@@ -20,15 +20,15 @@ api:
capi_whitelists_path:
```
-We recommend to use the following files for each OS:
+Recommended file paths:
- Linux `/etc/crowdsec/capi-whitelists.yaml`
- Freebsd `/usr/local/etc/crowdsec/capi-whitelists.yaml`
- Windows `c:/programdata/crowdsec/config/capi-whitelists.yaml`
-*These files **DO NOT** exist and you **MUST** create them manually and configure the above settings*
+*These files **DO NOT** exist by default. You **MUST** create them manually and set the path above.*
-The following snippet should be used as a guide
+Example file content:
```yaml
ips:
@@ -44,8 +44,8 @@ sudo systemctl reload crowdsec
:::warning
-The whitelist only applies when crowdsec pulls the blocklist from CAPI. This means that any IPs already in your local database will not get whitelisted.
+The whitelist applies only when CrowdSec pulls blocklists from CAPI. IPs already in your local database are not retroactively whitelisted.
-You can either manually delete the decisions for the IPs you want to whitelist with `cscli decisions delete`, or delete all alerts and active decisions from the database with `cscli alerts delete --all` and restart crowdsec.
+You can either delete decisions for specific IPs with `cscli decisions delete`, or delete all alerts and active decisions with `cscli alerts delete --all` and then restart CrowdSec.
:::
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/expr_based_whitelist.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/expr_based_whitelist.md
index e4f8d2d97..1366d233e 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/expr_based_whitelist.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/expr_based_whitelist.md
@@ -3,47 +3,208 @@ id: create_expr
title: Expression
---
-Let's whitelist a **specific** user-agent (of course, it's just an example, don't do this in production !).
+Expression-based whitelists let you discard events during parsing using [expr](https://github.com/antonmedv/expr) expressions. This is the most flexible option for whitelisting patterns such as HTTP paths, user agents, status codes, or any mix of parsed fields.
-Since we are using data that is present from the parsing stage we can do this within `Parsing Whitelist` level. Please see [introduction](/log_processor/whitelist/introduction.md) for your OS specific paths.
+## What this achieves
-```yaml
-name: "my/whitelist" ## Must be unique
-description: "Whitelist events from private ipv4 addresses"
-whitelist:
- reason: "private ipv4 ranges"
- expression:
- - evt.Parsed.http_user_agent == 'MySecretUserAgent'
+A **parser whitelist** (enrich stage) drops matching **log lines** before they reach scenarios, so they do not create buckets or alerts. This is usually the cleanest way to cut false positives and resource usage.
+
+:::info
+
+If you need to centrally allowlist **IP/CIDR across all components**, use **AllowLists** (available since CrowdSec `1.6.8`). For event-pattern exceptions (URI/user-agent/etc.), use parser whitelists. See [LAPI AllowLists](/local_api/allowlists.md) for details.
+
+:::
+
+Because this uses data available at parse time, you can do it at the `Parsing Whitelist` level. See the [introduction](/log_processor/whitelist/introduction.md) for OS-specific paths.
+
+## Workflow: From an alert to a parser whitelist
+
+There are two main ways to create an expression-based whitelist:
+
+1. **Starting from an alert**: When you have a false positive alert and want to whitelist the pattern that triggered it
+2. **Starting from a log line**: When you know the log line pattern you want to whitelist
+
+### Path 1: Starting from an alert
+
+When you have a false-positive alert, inspect it to extract event details and build a whitelist.
+
+#### Step 1: Identify the alert and extract events
+
+1. List recent alerts:
+
+```bash
+sudo cscli alerts list
```
-```bash title="Reload CrowdSec"
-sudo systemctl reload crowdsec
+2. Inspect an alert with event details:
+
+```bash
+sudo cscli alerts inspect -d
```
-For the record, I edited nikto's configuration to use 'MySecretUserAgent' as user-agent, and thus :
+The `-d/--details` flag shows events associated with the alert. From the output, note:
+
+- The **log type** (e.g., `nginx`, `apache2`, `sshd`, etc.)
+- Any helpful **meta** fields (http path, status, verb, user-agent, etc.)
+- The **source** you want to exempt (endpoint, health-check path, internal scanner, etc.)
+
+:::important
+
+In the **Events** section, each key maps to a field in `evt.Meta.*`. For example, `http_path` becomes `evt.Meta.http_path` in your whitelist expression.
+
+:::
+
+
+ Example: Alert inspection output
```bash
-nikto -host myfqdn.com
+$ cscli alerts inspect 176012 -d
+
+################################################################################################
+
+ - ID : 176012
+ - Date : 2026-01-07T15:11:08Z
+ - Machine : testMachine
+ - Simulation : false
+ - Remediation : true
+ - Reason : crowdsecurity/http-crawl-non_statics
+ - Events Count : 44
+ - Scope:Value : Ip:192.168.1.100
+ - Country : US
+ - AS : EXAMPLE-AS-BLOCK
+ - Begin : 2026-01-07T15:11:05Z
+ - End : 2026-01-07T15:11:07Z
+ - UUID : 0061339c-f070-4859-8f2a-66249c709d73
+
+╭────────────────────────────────────────────────────────────────────────────╮
+│ Active Decisions │
+├───────────┬───────────────────┬────────┬────────────┬──────────────────────┤
+│ ID │ scope:value │ action │ expiration │ created_at │
+├───────────┼───────────────────┼────────┼────────────┼──────────────────────┤
+│ 905003939 │ Ip:192.168.1.100 │ ban │ 23h35m33s │ 2026-01-07T15:11:08Z │
+╰───────────┴───────────────────┴────────┴────────────┴──────────────────────╯
+
+ - Context :
+╭────────────┬────────────╮
+│ Key │ Value │
+├────────────┼────────────┤
+│ method │ GET │
+│ status │ 404 │
+│ target_uri │ /lanz.php │
+│ target_uri │ /xwpg.php │
+│ target_uri │ /slsqc.php │
+│ target_uri │ /fs8.php │
+│ target_uri │ /flap.php │
+│ target_uri │ /ws34.php │
+│ user_agent │ - │
+╰────────────┴────────────╯
+
+ - Events :
+
+- Date: 2026-01-07 15:11:07 +0000 UTC
+╭─────────────────┬─────────────────────────────╮
+│ Key │ Value │
+├─────────────────┼─────────────────────────────┤
+│ ASNNumber │ 64512 │
+│ ASNOrg │ EXAMPLE-AS-BLOCK │
+│ IsInEU │ false │
+│ IsoCode │ US │
+│ SourceRange │ 192.168.0.0/16 │
+│ datasource_path │ /var/log/nginx/access.log │
+│ datasource_type │ file │
+│ http_args_len │ 0 │
+│ http_path │ /lanz.php │
+│ http_status │ 404 │
+│ http_user_agent │ - │
+│ http_verb │ GET │
+│ log_type │ http_access-log │
+│ service │ http │
+│ source_ip │ 192.168.1.100 │
+│ target_fqdn │ example.com │
+│ timestamp │ 2026-01-07T15:11:07Z │
+╰─────────────────┴─────────────────────────────╯
+
+- Date: 2026-01-07 15:11:07 +0000 UTC
+╭─────────────────┬─────────────────────────────╮
+│ Key │ Value │
+├─────────────────┼─────────────────────────────┤
+│ ASNNumber │ 64512 │
+│ ASNOrg │ EXAMPLE-AS-BLOCK │
+│ IsInEU │ false │
+│ IsoCode │ US │
+│ SourceRange │ 192.168.0.0/16 │
+│ datasource_path │ /var/log/nginx/access.log │
+│ datasource_type │ file │
+│ http_args_len │ 0 │
+│ http_path │ /xwpg.php │
+│ http_status │ 404 │
+│ http_user_agent │ - │
+│ http_verb │ GET │
+│ log_type │ http_access-log │
+│ service │ http │
+│ source_ip │ 192.168.1.100 │
+│ target_fqdn │ example.com │
+│ timestamp │ 2026-01-07T15:11:07Z │
+╰─────────────────┴─────────────────────────────╯
```
+In this example, the events section lists keys such as `http_path`, `http_status`, `http_verb`, and `source_ip`. Those keys map to `evt.Meta.*` fields you can use in your whitelist expressions. For instance, `http_path` becomes `evt.Meta.http_path`.
+
+
+
+#### Step 2: Pick a representative log line
+
+From the alert details, pick one triggering log line. You will use the raw line with `cscli explain` in the next step.
+
+#### Step 3: Use `cscli explain` to reveal parsed fields
+
+To write a safe whitelist, use the exact field names and values available at parse/enrich time.
+
+Run `cscli explain` against the log line:
+
```bash
-tail -f /var/log/crowdsec.log
+sudo cscli explain \
+ --log '' \
+ --type \
+ -v
```
-CrowdSec will inform you some lines have been discarded because they are whitelisted by the expression.
+`cscli explain -v` shows which parsers ran and what they populated in `evt.Parsed.*`, `evt.Meta.*`, and related fields.
-### How can I find which data is present from parsing stage?
+**What to look for** in the explain output:
-You can use [cscli explain](/cscli/cscli_explain.md) to generate output from a given log line or log file.
+- The specific fields that uniquely identify the "good" traffic you want to ignore, for example:
+ - `evt.Parsed.http_user_agent`
+ - `evt.Meta.http_path`
+ - `evt.Meta.http_verb`
+ - `evt.Meta.http_status`
+- Anything stable that will not accidentally exempt real attacks
-For example:
+### Path 2: Starting from a log line
+
+When you already know the log line pattern you want to whitelist (e.g., health check endpoints, monitoring tools), you can use `cscli explain` directly.
+
+#### Step 1: Use `cscli explain` to reveal parsed fields
+
+Use [cscli explain](/cscli/cscli_explain.md) on a log line or a log file.
+
+For example, with a single log line:
```bash
-sudo cscli explain --log '5.5.8.5 - - [04/Jan/2020:07:25:02 +0000] "GET /.well-known/acme-challenge/FMuukC2JOJ5HKmLBujjE_BkDo HTTP/1.1" 404 522 "-" "MySecretUserAgent"' --type nginx -v
+sudo cscli explain \
+ --log '5.5.8.5 - - [04/Jan/2020:07:25:02 +0000] "GET /.well-known/acme-challenge/FMuukC2JOJ5HKmLBujjE_BkDo HTTP/1.1" 404 522 "-" "MySecretUserAgent"' \
+ --type nginx \
+ -v
+```
+
+Or with a file:
+
+```bash
+sudo cscli explain --file /path/to/logfile --type nginx -v
```
- Output:
+ Example output:
```bash
line: 5.5.8.5 - - [04/Jan/2020:07:25:02 +0000] "GET /.well-known/acme-challenge/FMuukC2JOJ5HKmLBujjE_BkDo HTTP/1.1" 404 522 "-" "MySecretUserAgent"
@@ -122,6 +283,129 @@ line: 5.5.8.5 - - [04/Jan/2020:07:25:02 +0000] "GET /.well-known/acme-challenge/
├ 🟢 crowdsecurity/http-crawl-non_statics
└ 🟢 crowdsecurity/http-probing
```
-You can see what data can be used from `s01-parse` stage.
+
+This output shows what data is available from the `s01-parse` stage. Look for fields in `evt.Parsed.*` and `evt.Meta.*` that you can use in your whitelist expression.
+
+## Create the parser whitelist file
+
+Once you have identified the fields you want to use, create a new YAML file in the appropriate directory. See the [introduction](/log_processor/whitelist/introduction.md) for OS-specific paths.
+
+For example:
+
+```bash
+sudo nano /etc/crowdsec/parsers/s02-enrich/zz-whitelist-myapp.yaml
+```
+
+### Example 1: Whitelist by user-agent
+
+```yaml
+name: "myorg/whitelist-healthcheck-ua"
+description: "Ignore our synthetic checks user-agent"
+whitelist:
+ reason: "synthetic monitoring"
+ expression:
+ - evt.Parsed.http_user_agent == 'MyHealthcheckBot/1.0'
+```
+
+### Example 2: Whitelist a specific endpoint (health check)
+
+Use values you confirmed via `cscli explain`:
+
+```yaml
+name: "myorg/whitelist-healthz"
+description: "Ignore health checks hitting /healthz"
+whitelist:
+ reason: "health endpoint"
+ expression:
+ - evt.Meta.http_path == '/healthz' and evt.Meta.http_verb == 'GET'
+```
+
+:::tip
+
+Keep whitelist expressions as narrow as possible (path + verb + optional user-agent) to avoid hiding real attacks.
+
+:::
+
+### Example 3: Whitelist by multiple conditions
+
+You can combine conditions:
+
+```yaml
+name: "myorg/whitelist-acme-challenge"
+description: "Ignore ACME challenge requests"
+whitelist:
+ reason: "legitimate certificate renewal"
+ expression:
+ - evt.Meta.http_path startsWith '/.well-known/acme-challenge/' and evt.Meta.http_verb == 'GET'
+```
+
+### Example 4: Whitelist by status code and path
+
+```yaml
+name: "myorg/whitelist-monitoring"
+description: "Ignore monitoring tool requests"
+whitelist:
+ reason: "internal monitoring"
+ expression:
+ - evt.Meta.http_path == '/metrics' and evt.Meta.http_status == '200'
+```
+
+### Real-world example: Nextcloud
+
+For a real-world example of expression-based whitelists, see the [Nextcloud whitelist example on the Hub](https://hub.crowdsec.net/author/crowdsecurity/configurations/nextcloud-whitelist), which shows how to whitelist common Nextcloud endpoints and patterns.
+
+## Reload CrowdSec and validate
+
+Reload CrowdSec to apply the new parser whitelist:
+
+```bash
+sudo systemctl reload crowdsec
+```
+
+Then validate in two ways:
+
+1. **Re-run `cscli explain`** on the same triggering line and confirm it is discarded/whitelisted. CrowdSec logs when lines are discarded because they match a whitelist.
+
+2. **Confirm new decisions are no longer created** for the same pattern/IP:
+
+```bash
+sudo cscli decisions list --ip
+```
+
+## Clean up any existing bans
+
+A whitelist prevents *future* triggers, but it does not remove decisions that already exist.
+
+If you need to remove an active decision immediately:
+
+```bash
+sudo cscli decisions delete -i
+```
+
+Or delete all decisions for a specific scenario:
+
+```bash
+sudo cscli decisions delete --scenario
+```
+
+## Verify whitelist is working
+
+You can verify that the whitelist is working by checking the CrowdSec logs:
+
+```bash
+tail -f /var/log/crowdsec.log
+```
+
+CrowdSec will log when lines are discarded because they match the whitelist expression.
+
+## Finding available fields
+
+The key to creating effective expression whitelists is knowing which fields are available. Use `cscli explain -v` to see the fields available at each stage:
+
+- **`evt.Parsed.*`**: Fields extracted by parsers
+- **`evt.Meta.*`**: Metadata fields (often normalized versions of parsed fields)
+- **`evt.Enriched.*`**: Fields added by enrichment parsers (geoip, rdns, etc.)
+
+For more information about available fields, see the [expr documentation](/expr/event.md).
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/format.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/format.md
index 2505a3ab1..c246565a4 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/format.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/format.md
@@ -9,7 +9,7 @@ sidebar_position: 2
```yaml
name: "my/whitelist" ## Must be unique
description: "Whitelist events from my ipv4 addresses"
-#it's a normal parser, so we can restrict its scope with filter
+# This is a normal parser, so you can restrict its scope with a filter
filter: "1 == 1"
whitelist:
reason: "my ipv4 ranges"
@@ -20,9 +20,9 @@ whitelist:
- "10.0.0.0/8"
- "172.16.0.0/12"
expression:
- #beware, this one will work *only* if you enabled the reverse dns (crowdsecurity/rdns) enrichment postoverflow parser
+ # Works only if reverse DNS enrichment (crowdsecurity/rdns) is enabled
- evt.Enriched.reverse_dns endsWith ".mycoolorg.com."
- #this one will work *only* if you enabled the geoip (crowdsecurity/geoip-enrich) enrichment parser
+ # Works only if geoip enrichment (crowdsecurity/geoip-enrich) is enabled
- evt.Enriched.IsoCode == 'FR'
```
@@ -35,9 +35,9 @@ whitelist:
name: my_author_name/my_whitelist_name
```
-The `name` is mandatory.
+The `name` is mandatory.
-It must be unique (and will define the scenario's name in the hub).
+It must be unique (it also defines the scenario name in the hub).
### `description`
@@ -48,7 +48,7 @@ description: whitelist office
The `description` is mandatory.
-It is a quick sentence describing what it detects.
+It is a short sentence describing what it detects.
### `filter`
@@ -59,13 +59,13 @@ filter: expression
`filter` must be a valid [expr](https://github.com/antonmedv/expr) expression that will be evaluated against the [event](/expr/event.md).
-If `filter` evaluation returns true or is absent, node will be processed.
+If `filter` evaluates to `true`, or is absent, the node is processed.
-If `filter` returns `false` or a non-boolean, node won't be processed.
+If `filter` evaluates to `false` or a non-boolean value, the node is not processed.
Here is the [expr documentation](https://github.com/antonmedv/expr/tree/master/docs).
-Examples :
+Examples:
- `filter: "evt.Enriched.foo == 'test'"`
- `filter: "evt.Enriched.bar == 'test' && evt.Enriched.foo == 'test2'`
@@ -83,9 +83,9 @@ whitelist:
- "10.0.0.0/8"
- "172.16.0.0/12"
expression:
- #beware, this one will work *only* if you enabled the reverse dns (crowdsecurity/rdns) enrichment postoverflow parser
+ # Works only if reverse DNS enrichment (crowdsecurity/rdns) is enabled
- evt.Enriched.reverse_dns endsWith ".mycoolorg.com."
- #this one will work *only* if you enabled the geoip (crowdsecurity/geoip-enrich) enrichment parser
+ # Works only if geoip enrichment (crowdsecurity/geoip-enrich) is enabled
- evt.Enriched.IsoCode == 'FR'
```
@@ -97,7 +97,7 @@ reason: whitelist for test
The `reason` is mandatory.
-It is a quick sentence describing the reason of the whitelist.
+It is a short sentence describing the reason for the whitelist.
#### `ip`
@@ -107,7 +107,7 @@ whitelist:
- "127.0.0.1"
```
-A valid [expr](/expr/intro.md) expression that return a string to apply the pattern on.
+List of IP addresses to whitelist.
#### `cidr`
@@ -120,7 +120,7 @@ whitelist:
- "172.16.0.0/12"
```
-A valid [expr](/expr/intro.md) expression that return a string to apply the pattern on.
+List of CIDR ranges to whitelist.
#### `expression`
@@ -128,13 +128,13 @@ A valid [expr](/expr/intro.md) expression that return a string to apply the patt
```yaml
whitelist:
expression:
- #beware, this one will work *only* if you enabled the reverse dns (crowdsecurity/rdns) enrichment postoverflow parser
+ # Works only if reverse DNS enrichment (crowdsecurity/rdns) is enabled
- evt.Enriched.reverse_dns endsWith ".mycoolorg.com."
- #this one will work *only* if you enabled the geoip (crowdsecurity/geoip-enrich) enrichment parser
+ # Works only if geoip enrichment (crowdsecurity/geoip-enrich) is enabled
- evt.Enriched.IsoCode == 'FR'
```
-A valid [expr](/expr/intro.md) expression that return a string to apply the pattern on.
+List of [expr](/expr/intro.md) expressions. If any expression evaluates to `true`, the event is whitelisted.
### `data`
@@ -146,7 +146,7 @@ data:
type: (regexp|string)
```
-`data` allows user to specify an external source of data.
+`data` lets you specify an external data source.
This section is only relevant when `cscli` is used to install parser from hub, as it will download the `source_url` and store it to `dest_file`. When the parser is not installed from the hub, CrowdSec won't download the URL, but the file must exist for the parser to be loaded correctly.
The `type` is mandatory if you want to evaluate the data in the file, and should be `regex` for valid (re2) regular expression per line or `string` for string per line.
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/fqdn_based_whitelist.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/fqdn_based_whitelist.md
index 7b911a0a8..f434cc5f4 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/fqdn_based_whitelist.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/fqdn_based_whitelist.md
@@ -4,14 +4,14 @@ title: FQDN
---
:::info
-FQDN lookups can potentially cause latency issues. We recommend using them only in the `Postoverflow whitelist` stage. See [introduction](/log_processor/whitelist/introduction.md) for your OS specific path.
+FQDN lookups can cause latency. We recommend using them only in the `Postoverflow whitelist` stage. See [introduction](/log_processor/whitelist/introduction.md) for your OS-specific path.
:::
### Create a whitelist by fully qualified domain name
-If you need to whitelist a fully qualified domain name (FQDN, for example `foo.com`), create a whitelist file like the one below.
+If you need to whitelist a fully qualified domain name (FQDN), for example `foo.com`, create a whitelist file like this:
-Create `FQDN-whitelists.yaml` in your whitelist directory (see [introduction](/log_processor/whitelist/introduction.md) for your OS specific path):
+Create `FQDN-whitelists.yaml` in your whitelist directory (see [introduction](/log_processor/whitelist/introduction.md) for your OS-specific path):
```yaml
name: "my/fqdn-whitelists" ## Must be unique
@@ -23,7 +23,7 @@ whitelist:
- evt.Overflow.Alert.Source.IP in LookupHost("foo.foo.org")
- evt.Overflow.Alert.Source.IP in LookupHost("12123564.org")
```
-Save the file, then reload CrowdSec to apply the change:
+Then reload CrowdSec:
```bash title="Reload CrowdSec"
sudo systemctl reload crowdsec
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/introduction.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/introduction.md
index 78f67b840..a641750f7 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/introduction.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/introduction.md
@@ -4,38 +4,40 @@ title: Introduction
sidebar_position: 1
---
+:::tip Recommended for IP/CIDR Allowlisting
-Whitelists are special parsers that allow you to "discard" events, and can exist at two different steps :
+For simple IP and CIDR-based allowlisting, we recommend using [**Centralized AllowLists**](/local_api/allowlists.md) instead of parser whitelists. AllowLists are easier to manage and also affect blocklist pulls. The parser whitelists documented below are best suited for complex expression-based rules that rely on log elements.
- - *Parser whitelists* : Allows you to discard an event at parse time, so that it never hits the buckets.
+:::
+
+Whitelists are special parsers that let you discard events. They can exist at different stages:
+
+- *Parser whitelists*: Discard an event at parse time, so it never reaches buckets.
- Linux: `/etc/crowdsec/parsers/s02-enrich/`
- Freebsd: `/usr/local/etc/crowdsec/parsers/s02-enrich/`
- Windows: `c:/programdata/crowdsec/config/parsers/s02-enrich/`
- - *LAPI AllowLists* : Centralized at the LAPI level, those allowlists allow to discard the decision and alert while still generating a log entry. They can be IP/Range (CIDR) based. See [LAPI AllowLists](/local_api/allowlists.md)
+- *LAPI AllowLists*: Centralized at the LAPI level. They discard decisions and alerts while still generating log entries. They support IP/range (CIDR) rules. See [LAPI AllowLists](/local_api/allowlists.md).
- - *PostOverflow whitelists* : Those are whitelists that are checked *after* the overflow happens. It is usually best for whitelisting process that can be expensive (such as performing reverse DNS on an IP address, or performing a `whois` of an IP address).
+- *PostOverflow whitelists*: Checked *after* overflow. Best for expensive checks (for example reverse DNS or `whois` lookups on IPs).
- Linux: `/etc/crowdsec/postoverflows/s01-whitelist/`
- Freebsd: `/usr/local/etc/crowdsec/postoverflows/s01-whitelist/`
- Windows: `c:/programdata/crowdsec/config/postoverflows/s01-whitelist/`
-*Postoverflow whitelist folders do not exist by default so you **MUST** manually create them*
+*Postoverflow whitelist folders do not exist by default, so you **MUST** create them manually.*
-**Parser Whitelists** and **PostOverflow Whitelists** offer more flexibility, but are harder to manage. If you stick to IP-based whitelists, [**Centralized AllowLists**](/local_api/allowlists.md) is the way to go.
+Whitelists can be based on:
-Otherwise, whitelist can be based on several criteria:
-
- - specific IP address : if the event/overflow IP is the same, event is whitelisted
- - IP ranges : if the event/overflow IP address belongs to this range, event is whitelisted
- - a list of [expr](https://github.com/antonmedv/expr) expressions : if any expression returns true, event is whitelisted
+- Specific IP addresses: if the event/overflow IP matches, the event is whitelisted.
+- IP ranges: if the event/overflow IP is in a range, the event is whitelisted.
+- A list of [expr](https://github.com/antonmedv/expr) expressions: if any expression returns true, the event is whitelisted.
:::info
-While the whitelists are the same for parser or postoverflows, beware that field names might change.
+Parser and postoverflow whitelists use the same format, but field names can differ.
-Source ip is usually in `evt.Meta.source_ip` when it's a log, but `evt.Overflow.Alert.Source.IP` when it's an overflow
+Source IP is usually `evt.Meta.source_ip` for logs, but `evt.Overflow.Alert.Source.IP` for overflows.
:::
-
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/ip_based_whitelist.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/ip_based_whitelist.md
index 13bc1d2f9..da8d43196 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/ip_based_whitelist.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/ip_based_whitelist.md
@@ -3,9 +3,15 @@ id: create_ip
title: IP / CIDR
---
-IP whitelists are best suited at `Parser whitelists` level because once the log line has been parsed we already know the IP address and can save resources by discarding it earlier in the pipeline.
+:::info Recommended: Use Centralized AllowLists
-We will create the file `mywhitelist.yaml` please see [introduction](/log_processor/whitelist/introduction.md) for your OS specific paths.
+For IP and CIDR-based allowlisting, we recommend using [Centralized AllowLists](/local_api/allowlists.md) instead. AllowLists are managed at the LAPI level, making them easier to maintain and they also affect blocklist pulls. The parser whitelists documented below are more suited for complex expressions based on log elements.
+
+:::
+
+IP whitelists are best suited for the `Parser whitelists` stage: once a log line is parsed, CrowdSec already knows the IP and can discard it early to save resources.
+
+Create `mywhitelist.yaml` in your parser whitelist directory (see [introduction](/log_processor/whitelist/introduction.md) for OS-specific paths):
```yaml
name: "my/whitelist" ## Must be unique
@@ -13,9 +19,9 @@ description: "Whitelist events from my ip addresses"
whitelist:
reason: "my ip ranges"
ip:
- - "192.168.1.1" # Replace with your WAN IP
+ - "192.168.1.1" # Replace with your public IP
cidr:
- - "192.168.1.0/24" # Replace with your WAN IP range
+ - "192.168.1.0/24" # Replace with your public IP range
```
```bash title="Reload CrowdSec"
@@ -24,22 +30,22 @@ sudo systemctl reload crowdsec
### Test the whitelist
-You can run a security tool such as `nikto` to test your whitelist
+Use a security tool such as `nikto` to test the whitelist:
```bash
nikto -host myfqdn.com
```
```bash
-sudo cscli decisions list --ip {your_whitelisted_ip}
+sudo cscli decisions list --ip
```
-Should show the result `No active decisions`
+The expected result is `No active decisions`.
### I still see an old decision?
-The whitelist will only prevent new decisions so you must remove any old decisions with
+Whitelisting only prevents new decisions. Remove old decisions with:
```bash
-sudo decisions delete --ip {your_whitelist_ip}
+sudo cscli decisions delete --ip
```
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/lapi_based_whitelist.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/lapi_based_whitelist.md
index a0e0be42b..430d0b529 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/lapi_based_whitelist.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/lapi_based_whitelist.md
@@ -3,9 +3,15 @@ id: create_lapi
title: LAPI
---
-LAPI based whitelist are not your traditional whitelists, as in they wont prevent an overflow from happening, but they will prevent a decision being made by the LAPI this means log processors that forward alerts to the LAPI will not need to be configured individually to ignore certain conditions.
+:::warning Deprecated
-You can create a LAPI based whitelist by prepending a profile to the `profiles.yaml` file:
+This approach is deprecated. Please use [Centralized AllowLists](/local_api/allowlists.md) instead.
+
+:::
+
+LAPI-based whitelists differ from parser whitelists: they do not prevent overflows, but they do prevent the LAPI from creating decisions. This means log processors forwarding alerts to the LAPI do not need per-agent ignore rules for those conditions.
+
+Create a LAPI-based whitelist by prepending a profile in `profiles.yaml`:
```yaml
name: whitelist
@@ -18,13 +24,13 @@ on_success: break
In this example, the LAPI will not make a decision if the source IP is `2.2.2.2` or `3.3.3.3`.
-The `profiles.yaml` file location differs based on the OS type here are the default locations:
+`profiles.yaml` location depends on the OS:
- Linux: `/etc/crowdsec/profiles.yaml`
- FreeBSD: `/usr/local/etc/crowdsec/profiles.yaml`
- Windows: `C:\ProgramData\CrowdSec\config\profiles.yaml`
-You can use our extensive [EXPR helpers](/expr/intro.md) to create more complex whitelists, for example, you can whitelist a range of IPs by using the following syntax:
+You can use [EXPR helpers](/expr/intro.md) for more complex whitelists. For example, to whitelist an IP range:
```yaml
name: whitelist
@@ -35,9 +41,8 @@ on_success: break
---
```
-If you have implemented a LAPI based whitelist then you must reload the CrowdSec service for the changes to take effect.
+After adding a LAPI-based whitelist, reload CrowdSec for changes to take effect:
```bash title="Reload CrowdSec"
sudo systemctl reload crowdsec
```
-
diff --git a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/postoverflow_based_whitelist.md b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/postoverflow_based_whitelist.md
index f7bf311b9..ce8f4b9e1 100644
--- a/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/postoverflow_based_whitelist.md
+++ b/crowdsec-docs/versioned_docs/version-v1.7/log_processor/whitelist/postoverflow_based_whitelist.md
@@ -5,31 +5,31 @@ title: Postoverflow
## Whitelist in PostOverflows
-Whitelists in PostOverflows are applied _after_ the bucket overflow happens. Please see [introduction](/log_processor/whitelist/introduction.md) for your OS specific paths.
+Whitelists in PostOverflows are applied _after_ bucket overflow. See [introduction](/log_processor/whitelist/introduction.md) for OS-specific paths.
:::warning
In PostOverflows, the `evt.Parsed` object will be empty at this stage.
-It means that you must work with the [`evt.Overflow`](/expr/event.md#event-object--overflow) object for your expression.
+This means you must use the [`evt.Overflow`](/expr/event.md#event-object--overflow) object in expressions.
:::
-The main advantage of postoveflow whitelists is they are only triggered once the bucket overflows meaning potentially expensive expressions are evaluated less often.
+The main advantage of postoverflow whitelists is that they run only when a bucket overflows, so potentially expensive expressions are evaluated less often.
A good example is the [crowdsecurity/whitelist-good-actors](https://hub.crowdsec.net/author/crowdsecurity/collections/whitelist-good-actors) collection.
-First of all, install the [crowdsecurity/rdns postoverflow](https://hub.crowdsec.net/author/crowdsecurity/configurations/rdns) : it will be in charge of enriching overflows with reverse dns information of the offending IP address.
+First, install [crowdsecurity/rdns postoverflow](https://hub.crowdsec.net/author/crowdsecurity/configurations/rdns). It enriches overflows with reverse DNS data for the offending IP.
-Let's create `mywhitelist.yaml` again but remember this is a postoverflow whitelist so the paths will be different to `Parsing whitelists` please see [introduction](/log_processor/whitelist/introduction.md) for your OS specific path.
+Then create `mywhitelist.yaml`. Because this is a postoverflow whitelist, use the postoverflow path (not the parser whitelist path). See [introduction](/log_processor/whitelist/introduction.md) for OS-specific paths.
```yaml
name: "my/po_whitelist" ## Must be unique
description: lets whitelist our own reverse dns
whitelist:
- reason: dont ban my ISP
+ reason: don't ban my ISP
expression:
- #this is the reverse of my ip, you can get it by performing a "host" command on your public IP for example
+ # Reverse DNS of your IP (you can get it with a "host" lookup on your public IP)
- evt.Enriched.reverse_dns endsWith '.asnieres.rev.numericable.fr.'
```
@@ -41,7 +41,7 @@ sudo systemctl reload crowdsec
nikto -host myfqdn.com
```
-Tail the crowdsec log
+Tail the CrowdSec log:
```bash
tail -f /var/log/crowdsec.log
@@ -55,13 +55,13 @@ time="07-07-2020 17:11:09" level=info msg="node warning : no remediation" bucket
time="07-07-2020 17:11:09" level=info msg="Processing Overflow with no decisions 192.168.1.1 performed 'crowdsecurity/http-probing' (11 events over 313.983994ms) at 2020-07-07 17:11:09.175068053 +0200 CEST m=+2308.040825320" bucket_id=blue-cloud event_time="2020-07-07 17:11:09.175068053 +0200 CEST m=+2308.040825320" scenario=crowdsecurity/http-probing source_ip=192.168.1.1
```
-This time, we can see that logs are being produced when the event is discarded.
+You should now see logs showing that the event was discarded.
## Allow event for a specific scenario
-It is possible to allow an event for a specific scenario.
+You can allow events only for a specific scenario.
-For example, if you want to allow all the HTTP requests starting with `/mywebapp` only for the scenario `crowdsecurity/http-crawl-non_statics`, you can create the following postoverflow:
+For example, to allow HTTP requests starting with `/mywebapp` only for `crowdsecurity/http-crawl-non_statics`, create this postoverflow whitelist:
```yaml
name: mywebapp_whitelist
@@ -72,10 +72,10 @@ whitelist:
- evt.Overflow.Alert.Scenario == "crowdsecurity/http-crawl-non_statics" and all(evt.Overflow.Alert.Events, {.GetMeta("http_path") startsWith "/mywebapp"})
```
-The allowlist expression checks that the triggered scenario is `crowdsecurity/http-crawl-non_statics`.
+The expression first checks that the triggered scenario is `crowdsecurity/http-crawl-non_statics`.
-It then checks that all the `http_path` of events that lead to trigger the scenario start with `/mywebapp`.
+It then checks that all `http_path` values in the triggering events start with `/mywebapp`.
-:warning: Since the `capacity` of the `crowdsecurity/http-crawl-non_statics` scenario is set to 40 and its `cache_size` to 5, the allowlist can only do this check on the last 5 events.
+Since `crowdsecurity/http-crawl-non_statics` has `capacity: 40` and `cache_size: 5`, the whitelist can check only the last 5 events.
If it matches both conditions, the overflow is allowed.
diff --git a/crowdsec-docs/versioned_sidebars/version-v1.7-sidebars.json b/crowdsec-docs/versioned_sidebars/version-v1.7-sidebars.json
index df49c6cd5..8e4ca2962 100644
--- a/crowdsec-docs/versioned_sidebars/version-v1.7-sidebars.json
+++ b/crowdsec-docs/versioned_sidebars/version-v1.7-sidebars.json
@@ -71,7 +71,8 @@
"items": [
"log_processor/scenarios/format",
"log_processor/scenarios/simulation",
- "log_processor/scenarios/create"
+ "log_processor/scenarios/create",
+ "log_processor/scenarios/deploy"
]
},
{
@@ -102,8 +103,7 @@
"log_processor/whitelist/create_expr",
"log_processor/whitelist/create_postoverflow",
"log_processor/whitelist/create_fqdn",
- "log_processor/whitelist/create_capi",
- "log_processor/whitelist/create_lapi"
+ "log_processor/whitelist/create_capi"
]
}
]
@@ -188,7 +188,8 @@
"local_api/notification_plugins/splunk",
"local_api/notification_plugins/file",
"local_api/notification_plugins/template_helpers",
- "local_api/notification_plugins/writing_your_own_plugin"
+ "local_api/notification_plugins/writing_your_own_plugin",
+ "local_api/notification_plugins/testing"
]
},
"local_api/database",
@@ -229,7 +230,8 @@
},
"items": [
"configuration/feature_flags",
- "configuration/network_management"
+ "configuration/network_management",
+ "configuration/values_parameters"
]
},
{
@@ -309,7 +311,7 @@
"sdkSideBar": [
{
"type": "doc",
- "label": "Introduction",
+ "label": "SDK Introduction",
"id": "getting_started/sdk_intro"
},
{
@@ -320,7 +322,12 @@
{
"type": "doc",
"label": "PHP",
- "id": "getting_started/install_softagent"
+ "id": "getting_started/install_php_softagent"
+ },
+ {
+ "type": "doc",
+ "label": "Drupal Plugin",
+ "id": "getting_started/install_drupal_plugin"
}
],
"cscliSidebar": [
@@ -357,7 +364,8 @@
"cscli/cscli_allowlists_check",
"cscli/cscli_allowlists_inspect",
"cscli/cscli_allowlists_list",
- "cscli/cscli_allowlists_remove"
+ "cscli/cscli_allowlists_remove",
+ "cscli/cscli_allowlists_import"
]
},
{
@@ -707,10 +715,22 @@
"type": "doc",
"id": "appsec/quickstart/general_setup"
},
+ {
+ "type": "doc",
+ "id": "appsec/quickstart/nginx-ingress"
+ },
{
"type": "doc",
"id": "appsec/quickstart/nginxopenresty"
},
+ {
+ "type": "doc",
+ "id": "appsec/quickstart/haproxy_spoa"
+ },
+ {
+ "type": "doc",
+ "id": "appsec/quickstart/npmplus"
+ },
{
"type": "doc",
"id": "appsec/quickstart/traefik"
@@ -731,11 +751,15 @@
},
{
"type": "doc",
- "id": "appsec/vpatch_and_crs"
+ "id": "appsec/configuration_creation_testing"
},
{
"type": "doc",
- "id": "appsec/alerts_and_scenarios"
+ "id": "appsec/configuration_rule_management"
+ },
+ {
+ "type": "doc",
+ "id": "appsec/hooks"
}
]
},
@@ -749,11 +773,15 @@
},
{
"type": "doc",
- "id": "appsec/hooks"
+ "id": "appsec/create_rules"
},
{
"type": "doc",
- "id": "appsec/create_rules"
+ "id": "appsec/rules_deploy"
+ },
+ {
+ "type": "doc",
+ "id": "appsec/rules_examples"
}
]
},
@@ -768,9 +796,44 @@
{
"type": "doc",
"id": "appsec/benchmark"
+ },
+ {
+ "type": "doc",
+ "id": "appsec/request_lifecycle"
+ }
+ ]
+ },
+ {
+ "type": "category",
+ "label": "CRS",
+ "link": {
+ "type": "doc",
+ "id": "appsec/crs/intro"
+ },
+ "items": [
+ {
+ "type": "doc",
+ "id": "appsec/crs/installation"
+ },
+ {
+ "type": "doc",
+ "id": "appsec/crs/plugin_support"
+ },
+ {
+ "type": "doc",
+ "id": "appsec/crs/crs_config"
}
]
},
+ {
+ "type": "doc",
+ "id": "appsec/alerts_and_scenarios",
+ "label": "WAF behavior analysis"
+ },
+ {
+ "type": "doc",
+ "id": "appsec/advanced_deployments"
+ },
{
"type": "doc",
"id": "appsec/troubleshooting"