Skip to content

SomeBlackMagic/WebApplicationFirewall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Web Application Firewall (WAF) πŸ›‘οΈ

Build App codecov Github Repo Size GitHub License GitHub Release

Modular and configurable Web Application Firewall (WAF) server written in TypeScript using Express.js. Protect your web applications from attacks with flexible filtering, IP banning, geolocation-based rules, and bot detection.

✨ Key Features

  • βš–οΈ Flexible Blocking Rules - Static IP lists, behavioral filters, and request rate limiting
  • β›” Jail System - Temporary IP banning with progressive escalation for repeat offenders
  • βœ‰οΈ Whitelist/Blacklist - Allow or block by IP, subnet, country, or city
  • 🌍 GeoIP Detection - Country and city-based filtering using MaxMind databases
  • πŸ€– Bot Detection - Advanced bot detection and browser fingerprinting (Under Attack mode)
  • πŸ›‘οΈ REST API - Manage bans and monitor status via HTTP API
  • πŸ“Š Prometheus Metrics - Export metrics for monitoring and alerting
  • πŸ’Ύ Flexible Storage - In-memory or file-based ban storage
  • πŸ”Ž Audit Mode - Test rules safely without blocking traffic
  • βš™οΈ Reverse Proxy - Proxy validated requests to your backend

πŸš€ Quick Start

Using Docker (Recommended)

# Download GeoIP databases
mkdir -p geoip_data && cd geoip_data
wget https://github.com/P3TERX/GeoLite.mmdb/releases/latest/download/GeoLite2-Country.mmdb
wget https://github.com/P3TERX/GeoLite.mmdb/releases/latest/download/GeoLite2-City.mmdb
cd ..

# Create minimal config.yaml (see docs for full examples)
cat > config.yaml <<'EOF'
proxy:
  host: "http://host.docker.internal:8080"  # Your backend URL

api:
  auth:
    enabled: false
    username: 'admin'
    password: 'admin'

metrics:
  enabled: true
  auth:
    enabled: false
    username: 'admin'
    password: 'admin'

wafMiddleware:
  mode: audit  # Use 'normal' for production

  detectClientIp:
    headers: ["x-forwarded-for"]

  detectClientCountry:
    method: geoip

  detectClientCity:
    method: geoip

jailManager:
  enabled: true
  storage:
    driver: memory
  filterRules:
    - name: "rate-limit"
      type: "composite"
      uniqueClientKey: ["ip"]
      conditions: []
      period: 60
      limit: 1000
      duration: 300
      escalationRate: 1.5

sentry:
  enabled: false
  dsn: ''
  debug: false
EOF

# Run WAF
docker run -d \
  --name waf \
  -p 3000:3000 \
  -v $(pwd)/config.yaml:/app/config.yaml:ro \
  -v $(pwd)/geoip_data:/app/geoip_data:ro \
  ghcr.io/someblackmagic/web-application-firewall:latest

# Check logs
docker logs -f waf

Access at: http://localhost:3000

Alternative: Binary from Releases

# Download latest binary
wget https://github.com/SomeBlackMagic/WebApplicationFirewall/releases/latest/download/waf-linux-x64
chmod +x waf-linux-x64

# Run
./waf-linux-x64

See Quick Start Guide for detailed instructions.

πŸ“š Documentation

Complete documentation is available in the docs/ directory.

Getting Started

Configuration

Architecture & Concepts

API & Monitoring

Guides

Deployment

Development

🐳 Docker

# Pull latest image
docker pull ghcr.io/someblackmagic/web-application-firewall:latest

# Run
docker run -d \
  -p 3000:3000 \
  -v $(pwd)/config.yaml:/app/config.yaml \
  -v $(pwd)/geoip_data:/app/geoip_data \
  ghcr.io/someblackmagic/web-application-firewall:latest

See Docker Guide for details.

🀝 Contributing

We welcome contributions! Please see:

πŸ“„ License

This project is licensed under the GNU License.

πŸ”— Links

πŸ’‘ Support


Made with ❀️ by the WAF community