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
This bouncer is a Lua remediation component for NGINX.
33
+
A lua Remediation Component for nginx.
50
34
51
35
:::tip Enable the WAF for optimal protection
52
36
After installing the bouncer, enable the [AppSec (WAF) Component](/docs/next/appsec/intro) to get virtual patching and defense against known CVEs, SQL injection, XSS, and other application-layer attacks.
53
37
54
38
Follow the dedicated [AppSec Quickstart for Nginx/OpenResty](/docs/next/appsec/quickstart/nginxopenresty) — it picks up right where this page ends.
55
39
:::
56
40
57
-
## Prerequisites
58
-
59
-
1. It is assumed that you already have:
60
-
- A working CrowdSec [Security Engine](/intro) installation. For a
Note: Don't run the script with `sudo` (the script already uses`sudo` to install dependencies).
112
+
Note: Don't run the script with `sudo` (the script already use`sudo` to install dependencies).
165
113
166
-
If you are on a mono-machine setup, the `crowdsec-nginx-bouncer` install script can register directly to the local CrowdSec LAPI. The safer operational pattern is still to manage the API key explicitly as shown below.
114
+
If you are on a mono-machine setup, the `crowdsec-nginx-bouncer` install script will register directly to the local crowdsec, so you're good to go !
167
115
168
116
:warning: the installation script will take care of dependencies for Debian/Ubuntu
169
117
@@ -178,82 +126,44 @@ If you are on a mono-machine setup, the `crowdsec-nginx-bouncer` install script
178
126
179
127
</details>
180
128
181
-
## Register the bouncer key and store it outside the base config
182
-
183
-
As with the Envoy and Traefik guides, the practical approach is to choose a
184
-
fixed key, register it in CrowdSec, and keep it in a dedicated secret location
over `/etc/crowdsec/bouncers/crowdsec-nginx-bouncer.conf`.
131
+
For real-time WAF protection — virtual patching, defense against known CVEs, SQLi, XSS, and other application-layer attacks — turn on the AppSec Component after installing the bouncer.
208
132
209
-
Use this `.local` file for secrets and local overrides. Avoid committing a real
210
-
`API_KEY=` value in automation, Git repositories, or image templates.
133
+
:::tip Recommended: enable the WAF for optimal protection
134
+
Follow the [AppSec Quickstart for Nginx/OpenResty](/docs/next/appsec/quickstart/nginxopenresty) to enable the WAF. It's a few copy-paste commands and picks up right where this installation ends.
211
135
:::
212
136
213
-
If your NGINX host does not talk to a local LAPI, also override `API_URL` in
The AppSec-related knobs in `/etc/crowdsec/bouncers/crowdsec-nginx-bouncer.conf` are documented in the [Configuration Reference](#configuration-reference) below (all `APPSEC_*` entries).
220
138
221
-
## Verify CrowdSec LAPI access
139
+
## Upgrade
222
140
223
-
Make sure the bouncer appears in CrowdSec and that NGINX can load the bouncer
224
-
configuration:
141
+
### From package
225
142
226
143
```bash
227
-
sudo cscli bouncers list
228
-
sudo nginx -t
229
-
sudo systemctl restart nginx
144
+
sudo apt-get update
145
+
sudo apt-get install crowdsec-nginx-bouncer
230
146
```
231
147
232
-
You should see:
233
-
234
-
- An `nginx-bouncer` entry in `cscli bouncers list`
235
-
-`nginx -t` returning a successful configuration test
236
-
- NGINX restarting cleanly
148
+
:::warning
149
+
Upgrade from v0 to v1 introduce many changes. Pick up the maintainer configuration to avoid anything breaking. Configuration migration might not be trivial.
150
+
:::
237
151
238
-
##Validate remediation
152
+
### Manual Upgrade
239
153
240
-
Create a temporary decision for your client IP and confirm NGINX enforces it:
154
+
If you already have `crowdsec-nginx-bouncer` installed, please download the [latest release](https://github.com/crowdsecurity/cs-nginx-bouncer/releases)and run the following commands:
241
155
242
156
```bash
243
-
sudo cscli decisions add -i <IP_TO_TEST> -t ban
244
-
curl -I http://<your-nginx-host>/
157
+
tar xzvf crowdsec-nginx-bouncer.tgz
158
+
cd crowdsec-nginx-bouncer-v*/
159
+
sudo ./upgrade.sh
160
+
sudo systemctl restart nginx
245
161
```
246
162
247
-
You should get a ban response, typically `403 Forbidden`, or your configured
@@ -379,42 +288,61 @@ You can also change this with a valid one :
379
288
- /etc/ssl/cert.pem (OpenBSD, Alpine)
380
289
```
381
290
382
-
## Enable the WAF (AppSec Component)
291
+
### Application Security Component Configuration
383
292
384
-
For real-time WAF protection — virtual patching, defense against known CVEs, SQLi, XSS, and other application-layer attacks — turn on the AppSec Component after installing the bouncer.
293
+
To turn on the WAF, follow the [AppSec Quickstart for Nginx/OpenResty](/docs/next/appsec/quickstart/nginxopenresty).
294
+
295
+
The AppSec-related options in`/etc/crowdsec/bouncers/crowdsec-nginx-bouncer.conf`:
Due to limitations in the underlying library used by the remediation component, by default, the body of any HTTP2/HTTP3 request without a Content-Length will not be analyzed.
314
+
To avoid potential bypasses of the WAF, you can set the option `APPSEC_DROP_UNREADABLE_BODY` to `true` to drop any request whose body cannot be inspected.
385
315
386
-
:::tip Recommended: enable the WAF for optimal protection
387
-
Follow the [AppSec Quickstart for Nginx/OpenResty](/docs/next/appsec/quickstart/nginxopenresty) to enable the WAF. It's a few copy-paste commands and picks up right where this installation ends.
388
316
:::
389
317
390
-
The AppSec-related knobs in `/etc/crowdsec/bouncers/crowdsec-nginx-bouncer.conf` are documented in the [Configuration Reference](#configuration-reference) below (all `APPSEC_*` entries).
318
+
### Setup captcha
391
319
392
-
## Upgrade
320
+
> Currently, we have support for 3 providers: recaptcha, hcaptcha or turnstile
393
321
394
-
### From package
322
+
If you want to use captcha with your Nginx, you must provide a Site key and Secret key in your component configuration. If you wish to use any other provider than recaptcha you must also provide a Captcha provider.
0 commit comments