crowdsec-local-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. crowdsec_local_mcp-0.1.0/LICENSE +21 -0
  2. crowdsec_local_mcp-0.1.0/MANIFEST.in +3 -0
  3. crowdsec_local_mcp-0.1.0/PKG-INFO +93 -0
  4. crowdsec_local_mcp-0.1.0/README.md +80 -0
  5. crowdsec_local_mcp-0.1.0/pyproject.toml +28 -0
  6. crowdsec_local_mcp-0.1.0/setup.cfg +4 -0
  7. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/__init__.py +5 -0
  8. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/__main__.py +22 -0
  9. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/.gitignore +3 -0
  10. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/crowdsec/acquis.d/appsec.yaml +8 -0
  11. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/crowdsec/appsec-configs/mcp-appsec.yaml.template +8 -0
  12. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/crowdsec/init-bouncer.sh +29 -0
  13. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/docker-compose.yml +68 -0
  14. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/nginx/Dockerfile +67 -0
  15. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/nginx/crowdsec/crowdsec-openresty-bouncer.conf +25 -0
  16. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/nginx/nginx.conf +25 -0
  17. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/nginx/site-enabled/default-site.conf +15 -0
  18. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/rules/.gitkeep +0 -0
  19. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/compose/waf-test/rules/base-config.yaml +11 -0
  20. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/mcp_core.py +150 -0
  21. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/mcp_scenarios.py +380 -0
  22. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/mcp_waf.py +1170 -0
  23. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/prompts/prompt-scenario-deploy.txt +27 -0
  24. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/prompts/prompt-scenario-examples.txt +237 -0
  25. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/prompts/prompt-scenario.txt +84 -0
  26. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/prompts/prompt-waf-deploy.txt +118 -0
  27. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/prompts/prompt-waf-examples.txt +401 -0
  28. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/prompts/prompt-waf.txt +343 -0
  29. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/yaml-schemas/appsec_rules_schema.yaml +343 -0
  30. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp/yaml-schemas/scenario_schema.yaml +591 -0
  31. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp.egg-info/PKG-INFO +93 -0
  32. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp.egg-info/SOURCES.txt +34 -0
  33. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp.egg-info/dependency_links.txt +1 -0
  34. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp.egg-info/entry_points.txt +2 -0
  35. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp.egg-info/requires.txt +4 -0
  36. crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 crowdsec
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ recursive-include src/crowdsec_local_mcp/prompts *.txt
2
+ recursive-include src/crowdsec_local_mcp/compose *
3
+ recursive-include src/crowdsec_local_mcp/yaml-schemas *.yaml
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: crowdsec-local-mcp
3
+ Version: 0.1.0
4
+ Summary: An MCP exposing prompts and tools to help users write WAF rules, scenarios etc.
5
+ Requires-Python: >=3.12
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: jsonschema>=4.25.1
9
+ Requires-Dist: mcp>=1.15.0
10
+ Requires-Dist: pyyaml>=6.0.3
11
+ Requires-Dist: requests>=2.32.5
12
+ Dynamic: license-file
13
+
14
+ <p align="center">
15
+ <img src="https://github.com/crowdsecurity/crowdsec-docs/blob/main/crowdsec-docs/static/img/crowdsec_logo.png" alt="CrowdSec" title="CrowdSec" width="400" height="260"/>
16
+ </p>
17
+
18
+
19
+ **Life is too short to write YAML, just ask nicely!**
20
+
21
+ > A Model Context Protocol (MCP) server to generate, validate, and deploy CrowdSec WAF rules & Scenarios.
22
+
23
+
24
+ ## Features
25
+
26
+ ### WAF Rules Features
27
+
28
+ - **WAF Rule Generation**: Generate CrowdSec WAF rules from user input or a CVE reference
29
+ - **Validation**: Validate syntaxical correctness of WAF rules
30
+ - **Linting**: Get warnings and hints to improve your WAF rules
31
+ - **Deployment Guide**: Step-by-step deployment instructions
32
+ - **Docker Test Harness**: Spin up CrowdSec + nginx + bouncer to exercise rules for false positives/negatives
33
+ - **Nuclei Lookup**: Quickly jump to existing templates in the official `projectdiscovery/nuclei-templates` repository for a given CVE
34
+
35
+ ### Scenarios Features
36
+
37
+ - **CrowdSec Scenarios Generation**: Generate CrowdSec scenarios
38
+ - **Validation**: Validate syntaxical correctness of scenarios
39
+ - **Linting**: Get warnings and hints to improve your scenarios
40
+ - **Deployment Guide**: Step-by-step deployment instructions
41
+ - **Docker Test Harness**: Spin up CrowdSec to test scenario behavior
42
+
43
+ ## Demo
44
+
45
+ ### WAF Rules Creation and testing
46
+
47
+ - [Rule creation from natural language with Claude Desktop](https://claude.ai/share/f0f246b2-6b20-4d70-a16c-c6b627ab2d80)
48
+ - [Rule creation from CVE reference](https://claude.ai/share/b6599407-82dd-443c-a12d-9a9825ed99df)
49
+
50
+ ### Scenario Creation and testing
51
+
52
+ - XX
53
+ - XX
54
+
55
+ ## Installation
56
+
57
+ ### Setup
58
+
59
+ Install dependencies using `uv`:
60
+ ```bash
61
+ uv sync
62
+ ```
63
+
64
+ ## Configuration for Claude Desktop
65
+
66
+ ### macOS/Linux
67
+
68
+ 1. Find your Claude Desktop config file:
69
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
70
+ - Linux: `~/.config/Claude/claude_desktop_config.json`
71
+
72
+ 2. Add the MCP server configuration:
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "crowdsec-prompt-server": {
77
+ "command": "/path/to/crowdsec-mcp-rule-helper/.venv/bin/python",
78
+ "args": [
79
+ "/path/to/crowdsec-mcp-rule-helper/mcp-prompt.py"
80
+ ],
81
+ "cwd": "/path/to/crowdsec-mcp-rule-helper"
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ **Important**: Replace `/path/to/crowdsec-mcp-rule-helper` with the actual absolute path to your cloned repository.
88
+
89
+ ## Pre Requisites
90
+
91
+ - Docker + Docker Compose
92
+
93
+ - Python
@@ -0,0 +1,80 @@
1
+ <p align="center">
2
+ <img src="https://github.com/crowdsecurity/crowdsec-docs/blob/main/crowdsec-docs/static/img/crowdsec_logo.png" alt="CrowdSec" title="CrowdSec" width="400" height="260"/>
3
+ </p>
4
+
5
+
6
+ **Life is too short to write YAML, just ask nicely!**
7
+
8
+ > A Model Context Protocol (MCP) server to generate, validate, and deploy CrowdSec WAF rules & Scenarios.
9
+
10
+
11
+ ## Features
12
+
13
+ ### WAF Rules Features
14
+
15
+ - **WAF Rule Generation**: Generate CrowdSec WAF rules from user input or a CVE reference
16
+ - **Validation**: Validate syntaxical correctness of WAF rules
17
+ - **Linting**: Get warnings and hints to improve your WAF rules
18
+ - **Deployment Guide**: Step-by-step deployment instructions
19
+ - **Docker Test Harness**: Spin up CrowdSec + nginx + bouncer to exercise rules for false positives/negatives
20
+ - **Nuclei Lookup**: Quickly jump to existing templates in the official `projectdiscovery/nuclei-templates` repository for a given CVE
21
+
22
+ ### Scenarios Features
23
+
24
+ - **CrowdSec Scenarios Generation**: Generate CrowdSec scenarios
25
+ - **Validation**: Validate syntaxical correctness of scenarios
26
+ - **Linting**: Get warnings and hints to improve your scenarios
27
+ - **Deployment Guide**: Step-by-step deployment instructions
28
+ - **Docker Test Harness**: Spin up CrowdSec to test scenario behavior
29
+
30
+ ## Demo
31
+
32
+ ### WAF Rules Creation and testing
33
+
34
+ - [Rule creation from natural language with Claude Desktop](https://claude.ai/share/f0f246b2-6b20-4d70-a16c-c6b627ab2d80)
35
+ - [Rule creation from CVE reference](https://claude.ai/share/b6599407-82dd-443c-a12d-9a9825ed99df)
36
+
37
+ ### Scenario Creation and testing
38
+
39
+ - XX
40
+ - XX
41
+
42
+ ## Installation
43
+
44
+ ### Setup
45
+
46
+ Install dependencies using `uv`:
47
+ ```bash
48
+ uv sync
49
+ ```
50
+
51
+ ## Configuration for Claude Desktop
52
+
53
+ ### macOS/Linux
54
+
55
+ 1. Find your Claude Desktop config file:
56
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
57
+ - Linux: `~/.config/Claude/claude_desktop_config.json`
58
+
59
+ 2. Add the MCP server configuration:
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "crowdsec-prompt-server": {
64
+ "command": "/path/to/crowdsec-mcp-rule-helper/.venv/bin/python",
65
+ "args": [
66
+ "/path/to/crowdsec-mcp-rule-helper/mcp-prompt.py"
67
+ ],
68
+ "cwd": "/path/to/crowdsec-mcp-rule-helper"
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ **Important**: Replace `/path/to/crowdsec-mcp-rule-helper` with the actual absolute path to your cloned repository.
75
+
76
+ ## Pre Requisites
77
+
78
+ - Docker + Docker Compose
79
+
80
+ - Python
@@ -0,0 +1,28 @@
1
+ [project]
2
+ name = "crowdsec-local-mcp"
3
+ version = "0.1.0"
4
+ description = "An MCP exposing prompts and tools to help users write WAF rules, scenarios etc."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = [
8
+ "jsonschema>=4.25.1",
9
+ "mcp>=1.15.0",
10
+ "pyyaml>=6.0.3",
11
+ "requests>=2.32.5",
12
+ ]
13
+
14
+ [project.scripts]
15
+ crowdsec-mcp = "crowdsec_local_mcp.__main__:run"
16
+
17
+ [build-system]
18
+ requires = ["setuptools>=69", "wheel"]
19
+ build-backend = "setuptools.build_meta"
20
+
21
+ [tool.setuptools]
22
+ include-package-data = true
23
+
24
+ [tool.setuptools.package-dir]
25
+ "" = "src"
26
+
27
+ [tool.setuptools.packages.find]
28
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """CrowdSec MCP package."""
2
+
3
+ from .mcp_core import main
4
+
5
+ __all__ = ["main"]
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import asyncio
4
+
5
+ from .mcp_core import LOGGER, main
6
+
7
+ # Import modules for their registration side effects.
8
+ from . import mcp_waf # noqa: F401
9
+
10
+ try:
11
+ from . import mcp_scenarios # noqa: F401
12
+ except ModuleNotFoundError:
13
+ LOGGER.warning("Scenario module not available; scenario tools disabled")
14
+
15
+
16
+ def run() -> None:
17
+ """Entry-point used by console scripts."""
18
+ asyncio.run(main())
19
+
20
+
21
+ if __name__ == "__main__":
22
+ run()
@@ -0,0 +1,3 @@
1
+ # Generated at runtime by the MCP integration.
2
+ rules/current-rule.yaml
3
+ crowdsec/appsec-configs/mcp-appsec.yaml
@@ -0,0 +1,8 @@
1
+ # Acquisition file registering the MCP-generated AppSec configuration.
2
+ appsec_configs:
3
+ - mcp-appsec
4
+ labels:
5
+ type: appsec
6
+ listen_addr: 0.0.0.0:7422
7
+ source: appsec
8
+ name: myAppSecComponent
@@ -0,0 +1,8 @@
1
+ name: mcp-appsec
2
+ default_remediation: ban
3
+ inband_rules:
4
+ # Keep the CrowdSec base config to ensure essential protections remain active.
5
+ - crowdsecurity/base-config
6
+ # The MCP tooling copies the user rule into the custom directory as current-rule.yaml
7
+ ## XXX FIXME : make this a variable :)
8
+ - __PLACEHOLDER_FOR_USER_RULE__
@@ -0,0 +1,29 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ API_KEY="mcp-nginx-bouncer-test-key"
5
+ BOUNCER_NAME="mcp-nginx-bouncer"
6
+
7
+ /bin/bash /docker_start.sh "$@" &
8
+ PID=$!
9
+ trap 'kill "$PID" 2>/dev/null || true' EXIT
10
+
11
+ for _ in $(seq 1 90); do
12
+ if cscli lapi status >/dev/null 2>&1; then
13
+ break
14
+ fi
15
+ sleep 2;
16
+ done
17
+
18
+ if ! cscli lapi status >/dev/null 2>&1; then
19
+ echo "CrowdSec LAPI did not become ready in time" >&2
20
+ wait "$PID"
21
+ exit 1
22
+ fi
23
+
24
+ cscli bouncers delete "$BOUNCER_NAME" >/dev/null 2>&1 || true
25
+ cscli bouncers add "$BOUNCER_NAME" -k "$API_KEY"
26
+
27
+ trap - EXIT
28
+ wait "$PID"
29
+ exit $?
@@ -0,0 +1,68 @@
1
+ version: "3.9"
2
+
3
+ services:
4
+ crowdsec:
5
+ image: crowdsecurity/crowdsec:latest
6
+ hostname: crowdsec
7
+ container_name: crowdsec-appsec
8
+ restart: "no"
9
+ entrypoint:
10
+ - /bin/bash
11
+ - /usr/local/bin/init-bouncer.sh
12
+ environment:
13
+ # Ensure the local API stays accessible for the nginx bouncer.
14
+ - DISABLE_LOCAL_API=0
15
+ - DISABLE_ONLINE_API=1
16
+ # Turn on AppSec mode inside the CrowdSec container.
17
+ - ENABLE_APPSEC=1
18
+ volumes:
19
+ # Persist CrowdSec data (buckets, alerts, etc.) between restarts.
20
+ - crowdsec-data:/var/lib/crowdsec/data
21
+ # Allow templated acquisition and AppSec config overrides without replacing the whole /etc/crowdsec tree.
22
+ - ./crowdsec/acquis.d/appsec.yaml:/etc/crowdsec/acquis.d/appsec-mcp.yaml:ro
23
+ - ./crowdsec/appsec-configs/mcp-appsec.yaml:/etc/crowdsec/appsec-configs/mcp-appsec.yaml:ro
24
+ - ./crowdsec/init-bouncer.sh:/usr/local/bin/init-bouncer.sh:ro
25
+ # The MCP tooling will drop the user-provided rule in this folder as current-rule.yaml
26
+ - ./rules:/etc/crowdsec/appsec-rules/custom
27
+ ports:
28
+ - "18080:8080" # LAPI (use non-default host port to avoid conflicts)
29
+ - "17422:7422" # AppSec Live mode (non-default host port)
30
+ networks:
31
+ - waf-net
32
+
33
+ nginx:
34
+ build:
35
+ context: ./nginx
36
+ container_name: nginx-appsec
37
+ restart: "no"
38
+ depends_on:
39
+ - crowdsec
40
+ - backend
41
+ ports:
42
+ - "8081:80"
43
+ command:
44
+ - openresty
45
+ - -g
46
+ - 'daemon off;'
47
+ volumes:
48
+ - ./nginx/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro
49
+ # Site config enabling the CrowdSec module and proxying to the backend.
50
+ - ./nginx/site-enabled:/usr/local/openresty/nginx/conf/site-enabled:ro
51
+ # Override the bouncer configuration shipped in the image with the harness version.
52
+ - ./nginx/crowdsec/crowdsec-openresty-bouncer.conf:/etc/crowdsec/bouncers/crowdsec-openresty-bouncer.conf:ro
53
+ networks:
54
+ - waf-net
55
+
56
+ backend:
57
+ image: nginxdemos/hello:latest
58
+ container_name: app-backend
59
+ restart: unless-stopped
60
+ networks:
61
+ - waf-net
62
+
63
+ volumes:
64
+ crowdsec-data:
65
+
66
+ networks:
67
+ waf-net:
68
+ driver: bridge
@@ -0,0 +1,67 @@
1
+
2
+ FROM ubuntu:24.04
3
+
4
+ # Install dependencies
5
+ RUN apt-get update && apt-get install -y \
6
+ git \
7
+ make \
8
+ software-properties-common \
9
+ wget \
10
+ gnupg \
11
+ ca-certificates \
12
+ gettext \
13
+ curl
14
+
15
+ RUN wget -O - https://openresty.org/package/pubkey.gpg | apt-key add -
16
+ RUN echo "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"| tee /etc/apt/sources.list.d/openresty.list
17
+ RUN curl -s https://install.crowdsec.net | bash
18
+
19
+ RUN apt update
20
+
21
+ RUN apt install -y openresty openresty-opm gettext-base
22
+
23
+ RUN apt install -y crowdsec-openresty-bouncer
24
+
25
+
26
+
27
+ EXPOSE 80
28
+
29
+
30
+ # # Install the bouncer
31
+ # COPY build.sh /build.sh
32
+ # COPY start.sh /start.sh
33
+
34
+ # RUN chmod +x /build.sh && /build.sh
35
+ # RUN chmod +x /start.sh
36
+
37
+ # # Set the script as the entrypoint
38
+ # ENTRYPOINT ["/start.sh"]
39
+
40
+
41
+
42
+ # FROM debian:bookworm
43
+
44
+ # ENV DEBIAN_FRONTEND=noninteractive
45
+
46
+ # # Install nginx with Lua module support and prerequisites for the CrowdSec nginx bouncer.
47
+ # RUN set -eux; \
48
+ # apt-get update; \
49
+ # apt-get install -y --no-install-recommends \
50
+ # ca-certificates \
51
+ # curl \
52
+ # gnupg2 \
53
+ # iproute2 \
54
+ # libnginx-mod-http-lua \
55
+ # lsb-release \
56
+ # nginx \
57
+ # procps; \
58
+ # curl -s https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.deb.sh | bash; \
59
+ # apt-get install -y --no-install-recommends crowdsec-nginx-bouncer; \
60
+ # rm -rf /var/lib/apt/lists/*
61
+
62
+ # # Prepare directories that will receive bind mounts at runtime.
63
+ # RUN mkdir -p /etc/nginx/conf.d /etc/nginx/crowdsec
64
+
65
+ # EXPOSE 80
66
+
67
+ # CMD ["nginx", "-g", "daemon off;"]
@@ -0,0 +1,25 @@
1
+ API_URL=http://crowdsec:8080
2
+ API_KEY=mcp-nginx-bouncer-test-key
3
+ BOUNCING_ON_TYPE=all
4
+ FALLBACK_REMEDIATION=ban
5
+ MODE=stream
6
+ REQUEST_TIMEOUT=1000
7
+ EXCLUDE_LOCATION=
8
+ ENABLE_INTERNAL=false
9
+ CACHE_EXPIRATION=1
10
+ UPDATE_FREQUENCY=10
11
+ BAN_TEMPLATE_PATH=/var/lib/crowdsec/lua/templates/ban.html
12
+ REDIRECT_LOCATION=
13
+ RET_CODE=
14
+ CAPTCHA_PROVIDER=
15
+ SECRET_KEY=
16
+ SITE_KEY=
17
+ CAPTCHA_TEMPLATE_PATH=/var/lib/crowdsec/lua/templates/captcha.html
18
+ CAPTCHA_EXPIRATION=3600
19
+ APPSEC_URL=http://crowdsec:7422
20
+ APPSEC_FAILURE_ACTION=passthrough
21
+ APPSEC_CONNECT_TIMEOUT=100
22
+ APPSEC_SEND_TIMEOUT=100
23
+ APPSEC_PROCESS_TIMEOUT=1000
24
+ ALWAYS_SEND_TO_APPSEC=false
25
+ SSL_VERIFY=true
@@ -0,0 +1,25 @@
1
+
2
+ worker_processes auto;
3
+
4
+ error_log /dev/stderr info;
5
+ pid /tmp/nginx.pid;
6
+
7
+
8
+ events {
9
+ worker_connections 1024;
10
+ }
11
+
12
+ http {
13
+ resolver 127.0.0.11;
14
+
15
+ include /usr/local/openresty/nginx/conf/mime.types;
16
+ default_type application/octet-stream;
17
+
18
+ sendfile on;
19
+ keepalive_timeout 65;
20
+
21
+ access_log /dev/stdout;
22
+
23
+ include /usr/local/openresty/nginx/conf/conf.d/*.conf;
24
+ include /usr/local/openresty/nginx/conf/site-enabled/*.conf;
25
+ }
@@ -0,0 +1,15 @@
1
+ # Auto-generated by MCP test harness. Route requests through AppSec and the CrowdSec bouncer.
2
+ upstream backend_app {
3
+ server backend:80;
4
+ }
5
+
6
+ server {
7
+ listen 80;
8
+ server_name _;
9
+
10
+ location / {
11
+ proxy_pass http://backend_app;
12
+ proxy_set_header Host $host;
13
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14
+ }
15
+ }
@@ -0,0 +1,11 @@
1
+ name: crowdsecurity/base-config
2
+ #### This file is intended to provide a basic configuration for coraza:
3
+ #### - Set the body processors based on the content-type
4
+
5
+ seclang_rules:
6
+ - Secrule REQUEST_HEADERS:Content-Type "@rx ^application/x-www-form-urlencoded" "id:100,phase:1,pass,nolog,noauditlog,ctl:requestBodyProcessor=URLENCODED"
7
+ - Secrule REQUEST_HEADERS:Content-Type "@rx ^multipart/form-data" "id:101,phase:1,pass,nolog,noauditlog,ctl:requestBodyProcessor=MULTIPART"
8
+ - Secrule REQUEST_HEADERS:Content-Type "@rx ^application/xml" "id:102,phase:1,pass,nolog,noauditlog,ctl:requestBodyProcessor=XML"
9
+ - Secrule REQUEST_HEADERS:Content-Type "@rx ^application/json" "id:103,phase:1,pass,nolog,noauditlog,ctl:requestBodyProcessor=JSON"
10
+ - Secrule REQUEST_HEADERS:Content-Type "@rx ^text/xml" "id:104,phase:1,pass,nolog,noauditlog,ctl:requestBodyProcessor=XML"
11
+ - SecRule REQBODY_PROCESSOR "!@rx (?:URLENCODED|MULTIPART|XML|JSON)" "id:105,phase:1,pass,nolog,noauditlog,ctl:requestBodyProcessor=RAW" #Use our custom RAW body processor, just to have REQUEST_BODY set