[Open-source] A Smart Traffic Protection System for Websites, Business Interfaces, and Web Applications
![[Open-source] A Smart Traffic Protection System for Websites, Business Interfaces, and Web Applications](https://yy123.ink/api/img/1796372563133-aeii1d.png)
1. Project Overview
Flow Shield WAF (Flow Shield Web Application Firewall)
Flow Shield WAF is a web application firewall (WAF) designed for websites, business interfaces, and web applications.It is a smart traffic protection system, focusing on CC attack protection, malicious access identification, automated attack interception, and website security reinforcement.Based on OpenResty reverse proxyConstruction: After adding a site, traffic first enters the Flow Shield engine and then forwards to the source site; with "domain name + IP + request characteristics" as the dimension, each request is matched and protected by rules, and a visual management panel is provided.Supports one-click deployment with Docker Compose and is compatible with Baibuta control panels.
2. Open Source License
Not using mainstream open-source licenses
3. Screenshots
4. Feature Overview
Flow Shield WAF is a smart traffic protection system for websites, business interfaces, and web applications, focusing on CC attack protection, malicious access identification, automated attack interception, and website security reinforcement.
Core concept is not "blocking all traffic", butIdentification → Interception → Cleaning → Guardianship:
| Stage |
Description |
| Identification |
Understand the risk behind each access (IP, UA, URL, Body, Geo, etc.) |
| Interception |
Block CC, crawlers, scanners, SQL injection, and malicious requests |
| Cleaning |
Filter abnormal traffic and retain real users |
| Guardianship |
Continuously protect website stability, supporting observation mode and gradual online |
Flow Shield core advantages
1. Extremely high performance, sub-millisecond level
Engine based onLuaConstruction, combined withRedisfor rule and counting: a single request completes the entire protection process, usuallyless than 1 millisecond.Protection must block attacks while trying to minimize delays for real users.
2. AI-driven self-protection
When encountering difficult attacks, AI can be called to assist in generating more accurate strategies; also supportsAI automatic protection: after triggering conditions, the background automatically analyzes recent logs, extracts attack characteristics, and creates rules, striving to achieve zero-managed continuous defense.
3. Super Rich Rule Strategy
Not just common URL, IP, request header, region, etc., but also covers Cookie, Bot management, etc.30+ Matching Items, Supports include / exclude / equal / not equal / regular expression, etc. multiple conditions. Break down attack features more finely, and strategies can be both accurate and useful.
4. Rich Log Filtering
This point is deeply inspired by Tencent EdgeOne: Find attack commonalities from logs, which is the most critical step in defense.When attack methods keep changing, FlowShield provides multi-dimensional ranking and analysis, helping you quickly lock down "this batch of requests look like", and then feed back to make more perfect rules.
5. Functionally Complete
In addition to blacklists, whitelists, protection exceptions, rate protection, and custom rules, there are also overall statistics, site management, certificate management, Bot Library, IP groups, and AI capabilities - truly collect the necessary capabilities for daily protection into one panel, rather than piecing together.
Product Features
Reverse Proxy Type WAF
-
Traffic Path: Client → FlowShield Engine (:80/:443) → Source Site -
After adding a site and configuring the backsource address and certificate in the panel, the domain name can be resolved to the local machine and take effect. -
Rule and Rate Limit Strategy through RedisHot Synchronization, No need to restart the engine to modify the configuration (only trigger Nginx reload when the site topology changes)
Unified Rule Engine
-
Black and White Lists, Protection Exceptions, Rate Protection, Custom Rules Share the SameMatching Field Directoryand Condition DSL -
Supports AND/OR Condition Groups, IP Group References, Traffic Baseline Comparisons (traffic.global), etc. Advanced Matching -
Custom Rules are Executed in Priority Order; First Installation will Seed Internal IP Groups, Black and White Lists, Exceptions, Rate Limits, Custom Rules, and Bot Library (Can be Turned On/Off or Modified)
Five Protection Methods
| Mode |
Description |
| Observation |
Only Record Logs, Do Not Block Requests, Suitable for Pre-Online Verification of Rules |
| Interception |
Return Custom Interception Page and Terminate Request |
| Arithmetic Verification |
Pop-up Simple Arithmetic CAPTCHA (Available for Development/Testing, Recommended to Use Sliding or JS Challenge in Production) |
| JS Challenge |
Browser-side PoW Challenge, Resist Automation Scripts |
| Sliding Verification |
Sliding Human Verification, Suitable for Form/API Rate Limiting Scenarios |
CC and Access Control
-
Multi-dimensional Rate Protection: IP, URI, Cookie, etc. Combination Key Limiting -
Global Black and White Lists, Protection Exceptions (Can Skip All/Only Rules/Only Rate Limit) -
IP Group Management, Supports in_ip_group / not_in_ip_group Conditions -
Rate Limit Counter Abnormality DefaultFail-open Pass-through(Can be Closed in System Settings, Recommended to Keep Open in Production)
Logs and Observability
-
Engine Asynchronous Write to Redis Stream → Worker Consumption →ClickHousePersistence -
Supports Multi-dimensional Log Query, Statistical Aggregation, and Detail Traceback -
Can Configure Log Sampling, Sudden Traffic Automatic Down-sampling, and Retention Days TTL -
Debug Mode Can Attach Rule Hit Information to Response Headers (Recommended to Enable Only in Test Environment)
Warning and AI Protection
- Warning Notification
Triggered by Conditions, Supports Email/Webhook Channels, with Cooling Time - AI Protection
Dialogue-style Auxiliary Log Analysis, Generate/Optimize Rules (Requires LLM Configuration)
Production-level Security Baseline
-
Login Interface Redis Rate Limit, Refresh Token Check User Status in Database -
Blacklist, Global Exception, Non-Observation Rate LimitProhibit Empty Conditions, Avoid Mis-blocking the Entire Site -
Engine Startup and Decoupling from Backend: Backend Temporarily Unavailable Does Not Block WAF Proxy Service -
Health Check Simultaneously Detects Management Panel and WAF Engine
Management Panel Function Overview
| Module |
Function |
| Overview |
Request Volume, Interception Statistics, Configuration Version, Site Overview |
| Site management |
Domain, Backsource, HTTP/HTTPS, Certificate, Client IP Acquisition Method (CDN), Custom Interception Page |
| Certificate Management |
SSL Certificate Upload and Management |
| Custom Rules |
SQL Injection, Scanner, etc. Protection Rules, Supporting Priority and Five Modes |
| Blacklist / Whitelist |
Global Access Control (Blacklist Must Configure Matching Conditions) |
| IP Group |
IP/CIDR Collection, for Rule Reference |
| Protection Exceptions |
Skip All/Rule/Rate Detection by Condition |
| Rate Protection |
CC Protection, Multi-Dimensional Key + Time Window + Threshold |
| Protection Logs |
Query, Statistics, Detail Trace |
| Warning Notification |
Condition Trigger + Notification Channel |
| AI Protection |
Dialogue Rule Assistant |
| System Settings |
Challenge TTL, Log Strategy, Interception Page, Time Zone, Debug Mode, Rate Limit Fail-Open |
5. Tech Stack
Tech Stack
| Not the 'scaffolding self-bundled': |
Technology |
| Interception Engine |
OpenResty(Nginx + Lua) |
| Management Backend |
Python FastAPI + SQLAlchemy 2.0 + Pydantic v2 |
| Configuration and Counting |
SQLite + Redis 7 (Compose Default TCP) |
| Log Storage |
ClickHouse 24 |
| Frontend Panel |
Vue 3 + Vite + TypeScript + Ant Design Vue |
| Deployment |
Docker Compose (3 Services + SQLite Embedded in App) |
Directory Structure
flow-shield-waf/├── install.sh # One-Click Installation / Update (Official Website and GitHub Dual Link)├── docker-compose.yml # Redis + Clickhouse + App (SQLite in App Volume)├── .env.example # Environment Variable Template (Copy to Start, Suggest Modify Key)├── engine/ # OpenResty WAF Engine (Lua)├── backend/ # FastAPI Management Backend + Worker├── frontend/ # Vue 3 Management Panel├── slide_captcha/ # Sliding Verification Materials (Customizable)├── deploy/│ ├── app/ # Application Image (Backend + Worker + Engine + Panel)│ ├── clickhouse/ # ClickHouse Initialization SQL│ ├── geoip/ # MaxMind .mmdb (Attached, see deploy/geoip/README.md)│ ├── baota/ # Taobao Deployment Instructions│ └── smoke_test.sh # Integrated Regression Scripts├── scripts/│ ├── fresh-start.sh # Clear Data Volumes and Rebuild (Development/Test)│ └── stress_test.py # Defense Stage QPS Stress Testing└── docs/ # Architecture / Rule DSL / API / Stress Testing Documents
6. Source Code Repository
Open-source project address:
https://github.com/Qinver-china/flow-shield-waf
Next steps