@@ -166,6 +166,113 @@ helm upgrade --install ingress-nginx ingress-nginx/ingress-nginx \
166166 -f crowdsec-ingress-values.yaml
167167` ` `
168168
169+ <details>
170+ <summary>CrowdSec Ingress-NGINX Remediation Configuration Explained</summary>
171+
172+ This `values.yaml` snippet integrates the CrowdSec remediation (Lua bouncer)
173+ into the `ingress-nginx` controller by injecting the Lua plugin, generating its
174+ configuration, and enabling it inside NGINX.
175+
176+ # ## Controller Image Override
177+ ` ` ` yaml
178+ controller:
179+ image:
180+ registry: docker.io
181+ image: crowdsecurity/controller
182+ tag: v1.13.2
183+ digest: sha256:...
184+ ` ` `
185+
186+ The controller image is replaced with a CrowdSec-enabled build that includes the
187+ required Lua integration points.
188+
189+ # ## Shared Volume for the Plugin
190+
191+ ` ` ` yaml
192+ extraVolumes:
193+ - name: crowdsec-bouncer-plugin
194+ emptyDir: {}
195+ ` ` `
196+
197+ An emptyDir volume is used to hold the Lua bouncer plugin. It will be filled by
198+ an initContainer and mounted into the main controller.
199+
200+ # ## InitContainer: Plugin Fetch and Configuration
201+
202+ extraInitContainers :
203+ - name : init-clone-crowdsec-bouncer
204+ image : crowdsecurity/lua-bouncer-plugin:latest
205+ env :
206+ - name : API_URL
207+ value : " http://crowdsec-service.crowdsec.svc.cluster.local:8080"
208+ - name : API_KEY
209+ value : privateKey-foo
210+ - name : BOUNCER_CONFIG
211+ value : " /crowdsec/crowdsec-bouncer.conf"
212+ - name : APPSEC_URL
213+ value : " http://crowdsec-appsec-service.crowdsec.svc.cluster.local:7422"
214+ - name : APPSEC_FAILURE_ACTION
215+ value : " ban"
216+ - name : APPSEC_CONNECT_TIMEOUT
217+ value : " 100"
218+ - name : APPSEC_SEND_TIMEOUT
219+ value : " 100"
220+ - name : APPSEC_PROCESS_TIMEOUT
221+ value : " 1000"
222+ - name : ALWAYS_SEND_TO_APPSEC
223+ value : " false"
224+ command :
225+ - sh
226+ - -c
227+ - |
228+ sh /docker_start.sh
229+ mkdir -p /lua_plugins/crowdsec/
230+ cp -R /crowdsec/* /lua_plugins/crowdsec/
231+ volumeMounts :
232+ - name : crowdsec-bouncer-plugin
233+ mountPath : /lua_plugins
234+
235+ The initContainer generates the plugin configuration (crowdsec-bouncer.conf)
236+ from environment variables and copies the Lua plugin files into the shared
237+ volume so the main controller can load them.
238+
239+ # ## Mounting the Plugin in NGINX
240+
241+ ` ` ` yaml
242+ extraVolumeMounts:
243+ - name: crowdsec-bouncer-plugin
244+ mountPath: /etc/nginx/lua/plugins/crowdsec
245+ subPath: crowdsec
246+ ` ` `
247+
248+ This mounts the plugin files inside the directory where ingress-nginx expects
249+ Lua plugins.
250+
251+ # ## NGINX Configuration to Enable the Plugin
252+
253+ ```
254+ config:
255+ plugins: "crowdsec"
256+ lua-shared-dicts: "crowdsec_cache: 50m"
257+ server-snippet: |
258+ lua_ssl_trusted_certificate "/etc/ssl/certs/ca-certificates.crt"
259+ resolver local=on ipv6=off;
260+ ```
261+
262+ This snippet enables the crowdsec Lua plugin, aAllocates shared memory for
263+ caching LAPI/AppSec results and ensures Lua HTTPS validation and DNS resolution
264+ work properly.
265+
266+ ### Summary
267+
268+ This configuration:
269+ * Injects the CrowdSec Lua bouncer plugin into ingress-nginx.
270+ * Generates its configuration via an initContainer.
271+ * Mounts it into NGINX so it is executed during request processing.
272+ * Enables both LAPI enforcement and optional AppSec forwarding depending on settings.
273+ </details>
274+
275+
169276::: note
170277After the rollout, you can optionally check that the right container is deployed
171278:::
@@ -175,7 +282,7 @@ kubectl -n ingress-nginx exec -ti <ingress-pod-name> -- find /etc/nginx/lua/plug
175282```
176283This should give you a bunch of crowdsec lua files.
177284
178- :: :
285+
179286## Next steps
180287
181288- Add the [ OWASP CRS] ( /appsec/advanced_deployments.mdx ) to extend detection coverage.
0 commit comments