Skip to content

Commit aa5cadd

Browse files
committed
update
1 parent 2d8fab6 commit aa5cadd

2 files changed

Lines changed: 122 additions & 9 deletions

File tree

crowdsec-docs/unversioned/getting_started/installation/kubernetes.mdx

Lines changed: 117 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,19 @@ crowdsec-agent-kf9fr 1/1 Running 0 34s
148148
crowdsec-lapi-777c469947-jbk9q 1/1 Running 0 34s
149149
```
150150

151-
### Adding custom parsers and scenarios
151+
### Adding custom parsers, scenarios, postoverflows, and AppSec files
152152

153-
You can ship your own parser and scenario files through Helm by using:
153+
You can ship your own parser, scenario, postoverflow, AppSec configuration, AppSec rule, AppSec scenario, and AppSec postoverflow files through Helm by using:
154154

155155
- `config.parsers`
156156
- `config.scenarios`
157+
- `config.postoverflows`
158+
- `appsec.configs`
159+
- `appsec.rules`
160+
- `appsec.scenarios`
161+
- `appsec.postoverflows`
157162

158-
Those values are mounted into the agent pods as files and passed to CrowdSec as-is.
163+
Those values are mounted into the relevant pods as files and passed to CrowdSec as-is.
159164

160165
`config.parsers` is split by parser stage:
161166

@@ -165,19 +170,38 @@ Those values are mounted into the agent pods as files and passed to CrowdSec as-
165170

166171
`config.scenarios` is a flat map of scenario files.
167172

173+
`config.postoverflows` is split by postoverflow stage:
174+
175+
- `config.postoverflows.s00-enrich`
176+
- `config.postoverflows.s01-whitelist`
177+
178+
`appsec.configs`, `appsec.rules`, and `appsec.scenarios` are flat maps of AppSec files.
179+
180+
`appsec.postoverflows` is split by postoverflow stage:
181+
182+
- `appsec.postoverflows.s00-enrich`
183+
- `appsec.postoverflows.s01-whitelist`
184+
168185
What is allowed:
169186

170187
- `config.parsers.<stage>.<fileName>: |` with a string value
171188
- `config.scenarios.<fileName>: |` with a string value
189+
- `config.postoverflows.<stage>.<fileName>: |` with a string value
190+
- `appsec.configs.<fileName>: |` with a string value
191+
- `appsec.rules.<fileName>: |` with a string value
192+
- `appsec.scenarios.<fileName>: |` with a string value
193+
- `appsec.postoverflows.<stage>.<fileName>: |` with a string value
172194
- file names with or without a `.yaml` / `.yml` suffix
173-
- keys such as `my-parser`, `my-parser.yaml`, `test_scenario`, `custom.rule.yaml`
195+
- keys such as `my-parser`, `my-parser.yaml`, `test_scenario`, `custom.rule.yaml`, `my-appsec-config`, `my-rule.yml`, `my-postoverflow`, `my-appsec-scenario.yaml`
174196

175197
What is not allowed:
176198

177199
- nested objects below the file name
178200
- using a non-string value for a file entry
179201
- adding custom stages under `config.parsers`
202+
- adding custom stages under `config.postoverflows` or `appsec.postoverflows`
180203
- forgetting to escape dots when using `--set` or `--set-file`
204+
- enabling `appsec.configs`, `appsec.rules`, `appsec.scenarios`, or `appsec.postoverflows` without also enabling the AppSec component
181205

182206
This is valid in a values file:
183207

@@ -218,6 +242,55 @@ config:
218242
description: "Raise an alert on a specific event"
219243
filter: "evt.Meta.log_type == 'special_event'"
220244
blackhole: 10m
245+
246+
postoverflows:
247+
s01-whitelist:
248+
trusted-ip.yaml: |
249+
name: mycorp/trusted-ip
250+
description: "Whitelist a known source after overflow"
251+
whitelist:
252+
reason: "trusted source"
253+
expression:
254+
- evt.Overflow.Source_ip == "203.0.113.10"
255+
256+
appsec:
257+
enabled: true
258+
configs:
259+
my-appsec-config: |
260+
name: mycorp/my-appsec-config
261+
default_remediation: ban
262+
inband_rules:
263+
- mycorp/my-rule
264+
265+
rules:
266+
my-rule.yaml: |
267+
name: mycorp/my-rule
268+
zones:
269+
- URI
270+
transform:
271+
- lowercase
272+
match:
273+
type: contains
274+
value: /admin
275+
action: ban
276+
277+
scenarios:
278+
my-appsec-scenario: |
279+
type: trigger
280+
name: mycorp/my-appsec-scenario
281+
description: "Generate an alert when the custom AppSec rule matches"
282+
filter: evt.Meta.log_type == 'appsec'
283+
blackhole: 2m
284+
285+
postoverflows:
286+
s01-whitelist:
287+
my-appsec-whitelist.yaml: |
288+
name: mycorp/my-appsec-whitelist
289+
description: "Whitelist a trusted source for AppSec alerts"
290+
whitelist:
291+
reason: "trusted appsec source"
292+
expression:
293+
- evt.Overflow.Source_ip == "203.0.113.11"
221294
```
222295

223296
Minimal valid parser file example:
@@ -269,6 +342,18 @@ config:
269342

270343
The example above is invalid because `test-parser` becomes an object with a `yaml` field. Each file entry must be a single string.
271344

345+
The same rule applies to AppSec files. For example, this is not valid either:
346+
347+
```yaml
348+
appsec:
349+
configs:
350+
my-appsec-config:
351+
yaml: |
352+
name: mycorp/my-appsec-config
353+
```
354+
355+
Like parser and scenario files, AppSec file names can include `.yaml` or `.yml`, uppercase characters, underscores, or dots. The chart normalizes those keys into Kubernetes-safe volume names before mounting them, so the same filename flexibility is available for `config.postoverflows`, `appsec.configs`, `appsec.rules`, `appsec.scenarios`, and `appsec.postoverflows`.
356+
272357
#### Using a dedicated values file
273358

274359
If you have several custom items, the simplest approach is to keep them in a dedicated values file and pass it with `-f`:
@@ -282,7 +367,7 @@ helm upgrade --install crowdsec crowdsec/crowdsec \
282367

283368
This works well when:
284369

285-
- you manage several parsers and scenarios together
370+
- you manage several parsers, scenarios, or AppSec files together
286371
- you want everything in Git
287372
- you do not want shell escaping issues in the command line
288373

@@ -295,7 +380,13 @@ helm upgrade --install crowdsec crowdsec/crowdsec \
295380
-n crowdsec \
296381
-f crowdsec-values.yaml \
297382
--set-file "config.parsers.s01-parse.test-parser=/tmp/crowdsec-custom-items/parser.yaml" \
298-
--set-file "config.scenarios.test-scenario=/tmp/crowdsec-custom-items/scenario.yaml"
383+
--set-file "config.scenarios.test-scenario=/tmp/crowdsec-custom-items/scenario.yaml" \
384+
--set-file "config.postoverflows.s01-whitelist.my-whitelist=/tmp/crowdsec-custom-items/postoverflow.yaml" \
385+
--set 'appsec.enabled=true' \
386+
--set-file "appsec.configs.my-appsec-config=/tmp/crowdsec-custom-items/appsec-config.yaml" \
387+
--set-file "appsec.rules.my-rule=/tmp/crowdsec-custom-items/appsec-rule.yaml" \
388+
--set-file "appsec.scenarios.my-appsec-scenario=/tmp/crowdsec-custom-items/appsec-scenario.yaml" \
389+
--set-file "appsec.postoverflows.s01-whitelist.my-appsec-whitelist=/tmp/crowdsec-custom-items/appsec-postoverflow.yaml"
299390
```
300391

301392
If you want the key itself to contain `.yaml`, you must escape the dot in the Helm path:
@@ -305,7 +396,13 @@ helm upgrade --install crowdsec crowdsec/crowdsec \
305396
-n crowdsec \
306397
-f crowdsec-values.yaml \
307398
--set-file "config.parsers.s01-parse.test-parser\.yaml=/tmp/crowdsec-custom-items/parser.yaml" \
308-
--set-file "config.scenarios.test-scenario\.yaml=/tmp/crowdsec-custom-items/scenario.yaml"
399+
--set-file "config.scenarios.test-scenario\.yaml=/tmp/crowdsec-custom-items/scenario.yaml" \
400+
--set-file "config.postoverflows.s01-whitelist.my-whitelist\.yaml=/tmp/crowdsec-custom-items/postoverflow.yaml" \
401+
--set 'appsec.enabled=true' \
402+
--set-file "appsec.configs.my-appsec-config\.yaml=/tmp/crowdsec-custom-items/appsec-config.yaml" \
403+
--set-file "appsec.rules.my-rule\.yaml=/tmp/crowdsec-custom-items/appsec-rule.yaml" \
404+
--set-file "appsec.scenarios.my-appsec-scenario\.yaml=/tmp/crowdsec-custom-items/appsec-scenario.yaml" \
405+
--set-file "appsec.postoverflows.s01-whitelist.my-appsec-whitelist\.yaml=/tmp/crowdsec-custom-items/appsec-postoverflow.yaml"
309406
```
310407

311408
This is important because Helm uses dots as path separators. Without escaping, this:
@@ -332,8 +429,21 @@ Practical rules:
332429
- `config.parsers.s01-parse.test-parser\.yaml` is valid
333430
- `config.scenarios.test-scenario` is valid
334431
- `config.scenarios.test-scenario\.yaml` is valid
432+
- `config.postoverflows.s01-whitelist.my-whitelist` is valid
433+
- `config.postoverflows.s01-whitelist.my-whitelist\.yaml` is valid
434+
- `appsec.configs.my-appsec-config` is valid
435+
- `appsec.configs.my-appsec-config\.yaml` is valid
436+
- `appsec.rules.my-rule` is valid
437+
- `appsec.rules.my-rule\.yaml` is valid
438+
- `appsec.scenarios.my-appsec-scenario` is valid
439+
- `appsec.scenarios.my-appsec-scenario\.yaml` is valid
440+
- `appsec.postoverflows.s01-whitelist.my-appsec-whitelist` is valid
441+
- `appsec.postoverflows.s01-whitelist.my-appsec-whitelist\.yaml` is valid
335442
- `config.parsers.s03-custom.test-parser` is not valid
443+
- `config.postoverflows.s02-custom.my-whitelist` is not valid
336444
- `config.parsers.s01-parse.test-parser.yaml` without escaping is not valid
445+
- `appsec.scenarios.my-appsec-scenario.yaml` without escaping is not valid
446+
- `appsec.rules.my-rule.yaml` without escaping is not valid
337447

338448
### A word about source IPs
339449

crowdsec-docs/versioned_docs/version-v1.7/configuration/values_parameters.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,11 @@ configuration values, their defaults, and their purpose.
366366
| `appsec.replicas`<a id="appsec-replicas"></a> | Number of replicas for the AppSec Deployment | `1` |
367367
| `appsec.strategy`<a id="appsec-strategy"></a> | Deployment strategy for AppSec | `{}` |
368368
| `appsec.acquisitions`<a id="appsec-acquisitions"></a> | AppSec acquisitions (datasource listeners), e.g. appsec listener on 7422 | `[]` |
369-
| `appsec.configs`<a id="appsec-configs"></a> | AppSec configs (key = filename, value = file content) | `{}` |
370-
| `appsec.rules`<a id="appsec-rules"></a> | AppSec rule files (key = filename, value = file content) | `{}` |
369+
| `appsec.scenarios`<a id="appsec-scenarios"></a> | AppSec scenario files (key = filename, value = file content; `.yaml` / `.yml` suffix optional, chart normalizes keys to Kubernetes-safe volume names) | `{}` |
370+
| `appsec.postoverflows.s00-enrich`<a id="appsec-postoverflows-s00-enrich"></a> | AppSec postoverflow enrichment files (key = filename, value = file content; chart normalizes keys to Kubernetes-safe volume names) | `{}` |
371+
| `appsec.postoverflows.s01-whitelist`<a id="appsec-postoverflows-s01-whitelist"></a> | AppSec postoverflow whitelist files (key = filename, value = file content; chart normalizes keys to Kubernetes-safe volume names) | `{}` |
372+
| `appsec.configs`<a id="appsec-configs"></a> | AppSec configs (key = filename, value = file content; `.yaml` / `.yml` suffix optional, chart normalizes keys to Kubernetes-safe volume names) | `{}` |
373+
| `appsec.rules`<a id="appsec-rules"></a> | AppSec rule files (key = filename, value = file content; `.yaml` / `.yml` suffix optional, chart normalizes keys to Kubernetes-safe volume names) | `{}` |
371374
| `appsec.priorityClassName`<a id="appsec-priorityclassname"></a> | Priority class name for AppSec pods | `""` |
372375
| `appsec.deployAnnotations`<a id="appsec-deployannotations"></a> | Annotations added to the AppSec Deployment | `{}` |
373376
| `appsec.podAnnotations`<a id="appsec-podannotations"></a> | Annotations added to AppSec pods | `{}` |

0 commit comments

Comments
 (0)