|
| 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. |
0 commit comments