feat(waf): CRS-App-Exclusion-Plugins (Nextcloud/WordPress/Drupal) pro Domain — v1.3.12
Statt manueller SecRuleRemoveById-IDs kann man pro Domain offizielle OWASP-CRS- Exclusion-Plugins aktivieren — pfad-genaue, upstream-gepflegte App-Ausnahmen. - Migration 0046: waf_configs.crs_plugins text[]. - Engine (engine.go): je gewähltem Plugin werden config/before VOR den CRS-Rules und after DANACH inkludiert (exakt nach OWASP-CRS-Plugin-Spec); nur die für DIESE Domain gewählten, nur wenn die Datei existiert. Whitelist KnownCRSPlugins. - Handler: crs_plugins im Upsert-Body + Whitelist-Validierung (Include-Pfad- Injection-Schutz). - Packaging (postinst): lädt die Plugins (coreruleset/<name>-plugin) nach <crs>/plugins/ — self-healing auf jedem configure, nur fehlende. - UI: Multi-Select „App-Profile (CRS-Plugins)" im WAF-Config-Drawer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -937,6 +937,37 @@ KEEPALIVEDDROPIN
|
||||
rm -rf "${CRS_TMP}"
|
||||
fi
|
||||
|
||||
# ── CRS App-Exclusion-Plugins (Nextcloud / WordPress / Drupal) ──────
|
||||
# Offizielle OWASP-CRS-Plugins (separate Repos coreruleset/<name>-plugin).
|
||||
# Ihre plugins/*.conf landen in <crs>/plugins/; der WAF-Renderer bindet
|
||||
# je Domain die GEWÄHLTEN ein (waf_configs.crs_plugins). Läuft auf JEDEM
|
||||
# configure (self-healing für Bestandsinstalls), aber nur wenn das
|
||||
# jeweilige Plugin noch fehlt — admin-Anpassungen bleiben unangetastet.
|
||||
if [ -d "$WAF_CRS_DIR/rules" ]; then
|
||||
install -d -m 0755 "$WAF_CRS_DIR/plugins"
|
||||
for plugin in nextcloud-rule-exclusions wordpress-rule-exclusions drupal-rule-exclusions; do
|
||||
if [ -f "$WAF_CRS_DIR/plugins/${plugin}-before.conf" ] \
|
||||
|| [ -f "$WAF_CRS_DIR/plugins/${plugin}-config.conf" ]; then
|
||||
continue
|
||||
fi
|
||||
P_TMP="$(mktemp -d)"
|
||||
if curl -sL --max-time 45 \
|
||||
"https://github.com/coreruleset/${plugin}-plugin/archive/refs/heads/main.tar.gz" \
|
||||
-o "${P_TMP}/p.tgz" 2>/dev/null; then
|
||||
tar xzf "${P_TMP}/p.tgz" -C "${P_TMP}" 2>/dev/null || true
|
||||
if ls "${P_TMP}"/*/plugins/${plugin}-*.conf >/dev/null 2>&1; then
|
||||
install -m 0644 "${P_TMP}"/*/plugins/${plugin}-*.conf \
|
||||
"$WAF_CRS_DIR/plugins/" 2>/dev/null \
|
||||
&& echo "postinst: CRS-Plugin ${plugin} installiert"
|
||||
fi
|
||||
else
|
||||
echo "postinst: CRS-Plugin ${plugin} Download fehlgeschlagen (kein Internet?)" >&2
|
||||
fi
|
||||
rm -rf "${P_TMP}"
|
||||
done
|
||||
chown -R "$EG_USER":"$EG_USER" "$WAF_CRS_DIR/plugins" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# ── systemd: pick up new units + restart haproxy with our cfg
|
||||
systemctl daemon-reload
|
||||
systemctl restart haproxy.service || true
|
||||
|
||||
Reference in New Issue
Block a user