Files
caddy-proxy-manager/drizzle/0010_waf.sql
fuomag9 0dad675c6d feat: integrate Coraza WAF with full UI and event logging
- Add coraza-caddy/v2 to Caddy Docker build
- Add waf_events + waf_log_parse_state DB tables (migration 0010)
- Add WafSettings type and get/save functions to settings
- Add WafHostConfig/WafMode types to proxy-hosts model
- Add resolveEffectiveWaf + buildWafHandler to caddy config generation
- Create waf-log-parser.ts: parse Coraza JSON audit log → waf_events
- Add WafFields.tsx per-host WAF UI (accordion, mode, CRS, directives)
- Add global WAF settings card to SettingsClient
- Add WAF Events dashboard page with search, pagination, severity chips
- Add WAF Events nav link to sidebar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 22:16:34 +01:00

24 lines
701 B
SQL

-- Custom SQL migration file, put your code below! --
CREATE TABLE `waf_events` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`ts` integer NOT NULL,
`host` text NOT NULL DEFAULT '',
`client_ip` text NOT NULL,
`country_code` text,
`method` text NOT NULL DEFAULT '',
`uri` text NOT NULL DEFAULT '',
`rule_id` integer,
`rule_message` text,
`severity` text,
`raw_data` text
);
--> statement-breakpoint
CREATE INDEX `idx_waf_events_ts` ON `waf_events` (`ts`);
--> statement-breakpoint
CREATE INDEX `idx_waf_events_host_ts` ON `waf_events` (`host`, `ts`);
--> statement-breakpoint
CREATE TABLE `waf_log_parse_state` (
`key` text PRIMARY KEY NOT NULL,
`value` text NOT NULL
);