Skip to content

Commit 4297945

Browse files
authored
Centralized allowlists (#745)
1 parent 004698f commit 4297945

File tree

12 files changed

+181
-1
lines changed

12 files changed

+181
-1
lines changed

crowdsec-docs/docs/configuration/crowdsec_configuration.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,13 @@ This option will disable the registration of remote agents using `cscli lapi reg
912912
##### `capi_whitelists_path`
913913
> string
914914

915+
:::warning
916+
917+
This option is deprecated.
918+
You should use [centralized allowlists](local_api/allowlists.md) instead.
919+
920+
:::
921+
915922
The path to whitelists file for community and 3rd party blocklists.
916923
Those IPs/CIDR whitelists apply on all the IPs received from community blocklist or 3rd party lists subscriptions.
917924

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
id: centralized_allowlists
3+
title: Allowlists
4+
sidebar_position: 7
5+
---
6+
7+
# AllowLists
8+
9+
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.
10+
11+
12+
The AllowLists affect local decision and blocklist pulls in different ways:
13+
14+
| Area | Action | Real Time |
15+
|-------|------|------|
16+
| Local alerts | Alert is dropped, action logged. ||
17+
| Blocklists | IP is removed before database insertion ||
18+
| WAF (AppSec) | Request not blocked, action logged. | Refreshed every minute |
19+
| cscli | Decision is blocked unless special flag is provided ||
20+
21+
22+
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.
23+
24+
25+
### Creating an allowlist
26+
27+
Allowlists creation is done with `cscli allowlists create`, for example: `cscli allowlists create my_allowlistd -d safe_ips`.
28+
29+
The `-d` parameter is mandatory, it's a description for the allowlist for future reference:
30+
```bash
31+
$ cscli allowlists create my_allowlist --description "test allowlist"
32+
allowlist 'my_allowlist' created successfully
33+
```
34+
35+
This command must be run on the LAPI.
36+
37+
### Adding entries to an allowlist
38+
39+
Adding new entries to an allowlist is done with `cscli allowlists add <allowlist_name> value_1 value_2 ...`.
40+
41+
The allowlist must exist.
42+
43+
By default, allowlist entries have no expiration, but you can specify one with the `-e` flag:
44+
45+
```bash
46+
$ cscli allowlist add my_allowlist 1.2.3.4 -e 7d
47+
added 1 values to allowlist my_allowlist
48+
```
49+
50+
Values can be either IPs or ranges.
51+
52+
You can add an optional description for each entry with the `-d` flag:
53+
54+
```bash
55+
$ cscli allowlists add my_allowlist 1.2.3.4 -e 7d -d "pentest IPs"
56+
added 1 values to allowlist my_allowlist
57+
```
58+
59+
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.
60+
61+
This command must be run on the LAPI.
62+
63+
64+
### Removing entries from an allowlist
65+
66+
Removing entries from an allowlist is done with `cscli allowlists remove <allowlist_name> value_1 value_2 ...`:
67+
```bash
68+
$ cscli allowlists remove my_allowlist 1.2.3.4
69+
removed 1 values from allowlist my_allowlist
70+
```
71+
72+
This command must be run on the LAPI.
73+
74+
75+
### Viewing the content of an allowlist
76+
77+
Allowlists can be inspected with `cscli allowlists inspect <allowlist_name>`:
78+
79+
```bash
80+
$ cscli allowlist inspect my_allowlist
81+
82+
──────────────────────────────────────────────
83+
Allowlist: my_allowlist
84+
──────────────────────────────────────────────
85+
Name my_allowlist
86+
Description test allowlist
87+
Created at 2025-03-06T13:14:42.957Z
88+
Updated at 2025-03-06T13:15:13.684Z
89+
Managed by Console no
90+
──────────────────────────────────────────────
91+
92+
──────────────────────────────────────────────────────────────────────────────────
93+
Value Comment Expiration Created at
94+
──────────────────────────────────────────────────────────────────────────────────
95+
1.2.3.4 example description 2025-03-13T13:15:05.046Z 2025-03-06T13:14:42.957Z
96+
5.4.3.2 never 2025-03-06T13:14:42.957Z
97+
──────────────────────────────────────────────────────────────────────────────────
98+
```
99+
100+
This command can be run on the LAPI or any log processor machine.
101+
102+
### Deleting an allowlist
103+
104+
Allowlists can be deleted with `cscli allowlists delete <allowlist_name>`:
105+
106+
```bash
107+
$ cscli allowlists delete my_allowlist
108+
allowlist 'my_allowlist' deleted successfully
109+
```
110+
111+
The allowlist and all of its content will be deleted.
112+
113+
This command must be run on the LAPI.

crowdsec-docs/docs/log_processor/whitelist/capi_based_whitelist.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ id: create_capi
33
title: CAPI
44
---
55

6+
:::warning
7+
8+
This option is deprecated.
9+
You should use [centralized allowlists](local_api/allowlists.md) instead.
10+
11+
:::
12+
613
## Whitelists from CAPI (Central API) community blocklist or third party blocklist
714

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

crowdsec-docs/docs/log_processor/whitelist/introduction.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Whitelists are special parsers that allow you to "discard" events, and can exist
1212
- Freebsd: `/usr/local/etc/crowdsec/parsers/s02-enrich/`
1313
- Windows: `c:/programdata/crowdsec/config/parsers/s02-enrich/`
1414

15+
- *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)
1516

1617
- *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).
1718
- Linux: `/etc/crowdsec/postoverflows/s01-whitelist/`
@@ -20,7 +21,9 @@ Whitelists are special parsers that allow you to "discard" events, and can exist
2021

2122
*Postoverflow whitelist folders do not exist by default so you **MUST** manually create them*
2223

23-
The whitelist can be based on several criteria:
24+
**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.
25+
26+
Otherwise, whitelist can be based on several criteria:
2427

2528
- specific IP address : if the event/overflow IP is the same, event is whitelisted
2629
- IP ranges : if the event/overflow IP address belongs to this range, event is whitelisted

crowdsec-docs/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ module.exports = {
263263
"local_api/configuration",
264264
"local_api/authentication",
265265
"local_api/tls_auth",
266+
"local_api/centralized_allowlists",
266267
{
267268
type: "link",
268269
label: "Swagger",

crowdsec-docs/sidebarsUnversioned.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,15 @@ module.exports = {
219219
label: "Decisions Management 🏅"
220220
}],
221221
},
222+
{
223+
type: "category",
224+
label: "Centralized Allowlists 🏅",
225+
link: {
226+
type: "doc",
227+
id: "console/allowlists",
228+
},
229+
items: [],
230+
},
222231
{
223232
type: "category",
224233
label : "Enterprise plan 🏅",
48.9 KB
Loading
28.5 KB
Loading
35.2 KB
Loading
40.6 KB
Loading

0 commit comments

Comments
 (0)