You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal of this quickstart is to set up the [AppSec Component](/appsec/intro.md#introduction) to safeguard web applications running on [Traefik](https://doc.traefik.io/traefik/) reverse proxy.
14
-
15
-
We'll deploy a [set of rules](https://app.crowdsec.net/hub/author/crowdsecurity/collections/appsec-virtual-patching) designed to block [well-known attacks](https://app.crowdsec.net/hub/author/crowdsecurity/collections/appsec-generic-rules) and [currently exploited vulnerabilities](https://app.crowdsec.net/hub/author/crowdsecurity/collections/appsec-virtual-patching).
16
-
17
-
Additionally, we'll show how to monitor these alerts through the [console](https://app.crowdsec.net/).
14
+
The goal of this quickstart is to set up the [AppSec
15
+
Component](/appsec/intro.md#introduction) to safeguard web applications running
16
+
on [Traefik](https://doc.traefik.io/traefik/) reverse proxy. We'll deploy a [set
Additionally, we'll show how to monitor these alerts through the
24
+
[console](https://app.crowdsec.net/).
18
25
19
26
## Pre-requisites
20
27
21
-
1. If you're new to the [AppSec Component](/appsec/intro.md#introduction) or **W**eb **A**pplication **F**irewalls, start with the [Introduction](/appsec/intro.md#introduction) for a better understanding.
28
+
1. If you're new to the [AppSec Component](/appsec/intro.md#introduction) or
29
+
**W**eb **A**pplication **F**irewalls, start with the
30
+
[Introduction](/appsec/intro.md#introduction) for a better understanding.
22
31
23
32
2. It's assumed that you have already installed:
24
33
-**CrowdSec [Security Engine](intro.mdx)**: for installation, refer to the [QuickStart guide](/u/getting_started/installation/linux). The AppSec Component, which analyzes HTTP requests, is included within the security engine as a <UnderlineTooltiptooltip="Acquisition files tell CrowdSec where to find logs and which application they belong to.">Acquisition</UnderlineTooltip>.
25
34
- Traefik Plugin **[Remediation Component](/u/bouncers/intro)**: Thanks to [maxlerebourg](https://github.com/maxlerebourg) and team they created a [Traefik Plugin](https://plugins.traefik.io/plugins/6335346ca4caa9ddeffda116/crowdsec-bouncer-traefik-plugin) that allows you to block requests directly from Traefik.
26
35
27
36
:::info
28
-
Prior to starting the guide ensure you are using the [Traefik Plugin](https://plugins.traefik.io/plugins/6335346ca4caa9ddeffda116/crowdsec-bouncer-traefik-plugin) and **NOT** the older [traefik-crowdsec-bouncer](https://app.crowdsec.net/hub/author/fbonalair/remediation-components/traefik-crowdsec-bouncer) as it hasnt received updates to use the new AppSec Component.
37
+
Prior to starting the guide ensure you are using the [Traefik
as it hasnt received updates to use the new AppSec Component.
29
42
:::
30
43
31
44
:::warning
32
-
This guide will assume you already have a working Traefik setup using the Traefik Plugin. If you need help setting up Traefik, refer to the [official documentation](https://doc.traefik.io/traefik/) and the [Traefik Plugin](https://plugins.traefik.io/plugins/6335346ca4caa9ddeffda116/crowdsec-bouncer-traefik-plugin) documentation.
45
+
This guide will assume you already have a working Traefik setup using the
46
+
Traefik Plugin. If you need help setting up Traefik, refer to the [official
47
+
documentation](https://doc.traefik.io/traefik/) and the [Traefik
To begin setting up the AppSec Component, the initial step is to install a relevant set of rules.
56
+
To begin setting up the AppSec Component, the initial step is to install a
57
+
relevant set of rules.
40
58
41
-
We will utilize the [crowdsecurity/appsec-virtual-patching](https://app.crowdsec.net/hub/author/crowdsecurity/collections/appsec-virtual-patching) collection, which offers a wide range of rules aimed at identifying and preventing the exploitation of known vulnerabilities.
collection, which offers a wide range of rules aimed at identifying and
62
+
preventing the exploitation of known vulnerabilities.
42
63
43
-
This <UnderlineTooltiptooltip="Collections are bundle of parsers, scenarios, postoverflows that form a coherent package.">collection</UnderlineTooltip> is regularly updated to include protection against newly discovered vulnerabilities. Upon installation, it receives automatic daily updates to ensure your protection is always current.
64
+
This <UnderlineTooltiptooltip="Collections are bundle of parsers, scenarios,
65
+
postoverflows that form a coherent package.">collection</UnderlineTooltip> is
66
+
regularly updated to include protection against newly discovered
67
+
vulnerabilities. Upon installation, it receives automatic daily updates to
68
+
ensure your protection is always current.
44
69
45
-
Furthermore we also install the [crowdsecurity/appsec-generic-rules](https://app.crowdsec.net/hub/author/crowdsecurity/collections/appsec-generic-rules) collection. This collection contains detection scenarios for generic attack vectors. It provides some protection in cases where specific scenarios for vulnerabilities do not exist (yet).
Please note the spaces between the collection names (hence why the quotes are needed).
112
+
:::
62
113
63
-
Executing this command or updating the compose will install the following items:
114
+
This compose configuration file will add some needed hub configuration items.
64
115
65
-
- The [*AppSec Rules*](/appsec/rules_syntax.md) contain the definition of malevolent requests to be matched and stopped.
66
-
- The [*AppSec Configuration*](/appsec/configuration.md#appsec-configuration-files) links together a set of rules to provide a coherent set.
67
-
- The <UnderlineTooltiptooltip="YAML files that extract relevant data from logs, such as IP addresses, timestamps, or request paths.">CrowdSec Parser</UnderlineTooltip> and <UnderlineTooltiptooltip="Behavioral rules written in a domain-specific language that define what malicious activity looks like, such as multiple failed logins in a short time.">CrowdSec Scenario(s)</UnderlineTooltip> are used to detect and remediate persistent attacks.
116
+
</TabItem>
117
+
<TabItem value="kubernetes">
68
118
69
-
Once you have updated your compose or installed via the command line, will we need to restart the container. However, before we do that, we need to setup the acquisition for the AppSec Component.
119
+
Please add this in your `values.yaml` for your CrowdSec release.
If you have a folder in which you are persisting the configuration files, you can create a `appsec.yaml` and mount it into the container.
178
+
<TabItem value="docker">
76
179
77
-
There steps will change depending on how you are running the Security Engine. If you are running via `docker run` then you should launch the container within the same directory as the `appsec.yaml` file. If you are using `docker-compose` you can use a relative file mount to mount the `appsec.yaml` file.
180
+
In the directory where you persist configuration files, create an `appsec.yaml` file and mount it into the container.
78
181
79
-
Steps:
80
-
1. Change to the location where you executed the `docker run` or `docker compose` command.
81
-
2. Create a `appsec.yaml` file at the base of the directory.
82
-
3. Add the following content to the `appsec.yaml` file.
182
+
**Steps**
183
+
184
+
1. Change to the directory where you ran the `docker run` or `docker compose` command.
185
+
2. Create a file named `appsec.yaml` in this directory.
186
+
3. Add the following content:
83
187
84
188
```yaml title="appsec.yaml"
85
-
appsec_config: crowdsecurity/appsec-default
189
+
appsec_config: crowdsecurity/appsec-desfault
86
190
labels:
87
-
type: appsec
191
+
type: appsec
88
192
listen_addr: 0.0.0.0:7422
89
193
source: appsec
90
194
```
91
-
:::note
92
-
Since CrowdSec is running inside a container you must set the `listen_addr` to `0.0.0.0` instead of the typical `127.0.0.1` as the container is running in a separate network.
93
-
:::
94
195
95
-
4. Edit the `docker run` or `docker-compose` command to include the `appsec.yaml` file.
196
+
Because CrowdSec runs inside a container, set listen_addr to 0.0.0.0 instead of
197
+
127.0.0.1 so it can accept connections from outside the container.
96
198
97
-
<FormattedTabs
98
-
docker={`# Note if you have a docker run already running you will need to stop it before running this command
99
-
docker run -d --name crowdsec -v /path/to/original:/etc/crowdsec -v ./appsec.yaml:/etc/crowdsec/acquis.d/appsec.yaml crowdsecurity/crowdsec`}
100
-
dockerCompose={`services:
101
-
crowdsec:
102
-
volumes:
103
-
- /path/to/original:/etc/crowdsec ## or named volumes
Once you have updated the compose file to include the volume mount and the updated environment variable, you can restart the container.
114
240
@@ -122,6 +248,27 @@ docker compose up -d crowdsec
122
248
The previous compose commands presume the container is named `crowdsec`. If you have named the container something else, you will need to replace `crowdsec` with the name of your container.
123
249
:::
124
250
251
+
</TabItem>
252
+
<TabItem value="kubernetes">
253
+
With kubernetes the acquisition setup is twofolds:
254
+
We have to add
255
+
```yaml title="values.yaml"
256
+
appsec:
257
+
acquisitions:
258
+
- appsec_config: crowdsecurity/appsec-default
259
+
labels:
260
+
type: appsec
261
+
listen_addr: 0.0.0.0:7422
262
+
path: /
263
+
source: appsec
264
+
enabled: true
265
+
```
266
+
267
+
268
+
</TabItem>
269
+
</Tabs>
270
+
271
+
125
272
## Remediation Component Setup
126
273
127
274
As stated previously this guide already presumes you have the Traefik Plugin installed. If you do not have the Traefik Plugin installed, please refer to the [official documentation](https://plugins.traefik.io/plugins/6335346ca4caa9ddeffda116/crowdsec-bouncer-traefik-plugin) for installation instructions.
@@ -134,6 +281,15 @@ Depending on how you configured the Traefik Plugin, you will need to update the
134
281
Currently AppSec does not support mTLS authentication for the AppSec Component. If you have mTLS enabled, and wish to use the AppSec Component, you can define seperate middlewares for the AppSec Component.
For more comprehensive documentation on the Traefik Plugin configuration, please refer to the [official documentation](https://plugins.traefik.io/plugins/6335346ca4caa9ddeffda116/crowdsec-bouncer-traefik-plugin).
374
+
For more comprehensive documentation on the Traefik Plugin configuration, please
We can't cover all the possible configurations for Traefik in this guide, so please refer to the [official documentation](https://doc.traefik.io/traefik/) for more information.
0 commit comments