waf
БесплатноБез исполняемых скриптовНе проверенWeb Application Firewall configuration. Covers ModSecurity v3 with Nginx and Cloudflare WAF: managed rulesets, custom rules, rate limiting, and tuning. USE…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
WAF Core Knowledge
WAF Layers
Internet
│
▼
[ Cloudflare WAF ] ← Layer 1: Edge WAF (managed rulesets, rate limits, bot protection)
│
▼
[ Load Balancer / Nginx ]
│
▼
[ ModSecurity + CRS ] ← Layer 2: Host WAF (inline with web server)
│
▼
[ Application ]
Use both layers for defense in depth. Cloudflare is cheaper per request but Nginx + ModSecurity gives you more visibility on the host and works without Cloudflare.
ModSecurity v3 with Nginx
Install ModSecurity and Nginx Connector
# Ubuntu 22.04 / 24.04
sudo apt update
sudo apt install -y libmodsecurity3 libmodsecurity-dev
# Install Nginx ModSecurity connector
# Option A: compile Nginx with connector (recommended for full control)
# Get connector source, then compile as dynamic module
git clone --depth 1 https://github.com/owasp-modsecurity/ModSecurity-nginx.git /tmp/modsecurity-nginx
NGINX_VER=$(nginx -v 2>&1 | grep -oP '[\d.]+')
wget http://nginx.org/download/nginx-${NGINX_VER}.tar.gz -P /tmp
cd /tmp && tar -xzf nginx-${NGINX_VER}.tar.gz
cd nginx-${NGINX_VER} && ./configure --with-compat --add-dynamic-module=/tmp/modsecurity-nginx
make modules
sudo cp objs/ngx_http_modsecurity_module.so /etc/nginx/modules/
# Option B: use pre-built package (distro-specific)
# Ubuntu PPA often provides: nginx-extras with modsecurity bundled
# Load module in nginx.conf
echo 'load_module modules/ngx_http_modsecurity_module.so;' | sudo tee /etc/nginx/modules-enabled/50-mod-modsecurity.conf
Download OWASP Core Rule Set
CRS_VERSION=4.7.0
wget https://github.com/coreruleset/coreruleset/archive/refs/tags/v${CRS_VERSION}.tar.gz
sudo tar -xzf v${CRS_VERSION}.tar.gz -C /etc/modsecurity/
sudo ln -s /etc/modsecurity/coreruleset-${CRS_VERSION} /etc/modsecurity/crs
# Copy default configs
sudo cp /etc/modsecurity/crs/crs-setup.conf.example /etc/modsecurity/crs/crs-setup.conf
sudo cp /usr/share/modsecurity-crs/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf
Core modsecurity.conf Settings
# /etc/modsecurity/modsecurity.conf
# CRITICAL: Set to On in production, DetectionOnly to test
SecRuleEngine On
# SecRuleEngine DetectionOnly # Log but do not block — use during initial tuning
# Request body inspection
SecRequestBodyAccess On
SecRequestBodyLimit 13107200 # 12.5 MB max request body
SecRequestBodyNoFilesLimit 131072 # 128 KB for non-file content
SecRequestBodyLimitAction Reject # Reject requests exceeding body limit
# Response body inspection
SecResponseBodyAccess On
SecResponseBodyMimeType text/plain text/html text/xml application/json
SecResponseBodyLimit 524288 # 512 KB
# Audit log — CRITICAL for incident investigation
SecAuditEngine RelevantOnly # Log only blocked/suspicious requests
# SecAuditEngine On # Log everything (very verbose, use only for debugging)
SecAuditLog /var/log/modsecurity/audit.log
SecAuditLogParts ABCDEFHIJKZ # What to include in audit log
SecAuditLogType Serial
SecAuditLogStorageDir /var/log/modsecurity/data/
# Debug log (level 0-9, 0=off, 9=maximum verbosity)
SecDebugLog /var/log/modsecurity/debug.log
SecDebugLogLevel 0 # 0 in production; set 3-5 for debugging
# Temporary files
SecTmpDir /tmp/modsecurity/
SecDataDir /tmp/modsecurity/
# Upload handling
SecUploadDir /tmp/modsecurity/upload/
SecUploadKeepFiles Off
# Sensor ID (for cluster deployments)
SecSensorId nginx-waf-01
# Default action: log + pass (rules set block action explicitly)
SecDefaultAction "phase:1,log,auditlog,pass"
CRS Setup (crs-setup.conf Key Settings)
# /etc/modsecurity/crs/crs-setup.conf
# Paranoia Level (1-4):
# 1 = Baseline protection, very few false positives (recommended start)
# 2 = More rules, some FPs — good for APIs with known input patterns
# 3 = Strict, significant tuning required
# 4 = Maximum, expect many FPs — only for high-security apps after extensive tuning
SecAction \
"id:900000, \
phase:1, \
nolog, \
pass, \
t:none, \
setvar:tx.paranoia_level=1"
# Anomaly scoring threshold
# Requests accumulate a score; if score > threshold, block
# Default: 5 (inbound blocking score) / 4 (outbound)
SecAction \
"id:900110, \
phase:1, \
nolog, \
pass, \
t:none, \
setvar:tx.inbound_anomaly_score_threshold=5, \
setvar:tx.outbound_anomaly_score_threshold=4"
# Allowed HTTP methods
SecAction \
"id:900200, \
phase:1, \
nolog, \
pass, \
t:none, \
setvar:'tx.allowed_methods=GET HEAD POST PUT DELETE PATCH OPTIONS'"
# Allowed content types (tighten for APIs)
SecAction \
"id:900220, \
phase:1, \
nolog, \
pass, \
t:none, \
setvar:'tx.allowed_request_content_type=|application/json| |application/x-www-form-urlencoded| |multipart/form-data|'"
# Max argument count and name/value lengths
SecAction \
"id:900300, \
phase:1, \
nolog, \
pass, \
t:none, \
setvar:tx.max_num_args=255, \
setvar:tx.arg
Установить waf в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditBashFAQ
Что делает скилл waf?
Web Application Firewall configuration. Covers ModSecurity v3 with Nginx and Cloudflare WAF: managed rulesets, custom rules, rate limiting, and tuning. USE WHEN: user mentions "waf", "web application firewall", "modsecurity", "owasp crs", "core rule set", "cloudflare waf", "cloudflare firewall rules", "cloudflare rate limiting", "cloudflare custom rules", "modsecurity nginx", "secruleengine", "false positive waf", "waf exclusion", "waf bypass", "cloudflare bot fight mode", "cloudflare managed ruleset", "waf tuning" DO NOT USE FOR: Network-layer firewalls (iptables, nftables, ufw) — those are not WAF, DDoS volumetric protection at ISP level, API authentication / authorization — use `authentication` skill, Input validation in application code — use application-level validation
Как установить скилл waf?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл waf запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic