DEV Community

Arina Cholee
Arina Cholee

Posted on

SafeLine: The Open-Source WAF That Actually Protects Your Web Apps

If you’ve ever hosted a web app, a personal homelab service, or even a simple dashboard exposed to the internet, you’ve probably felt that lingering anxiety:

“Is someone trying to break into this right now?”

And honestly… they probably are.

From SQL injection and XSS to brute-force login attempts and automated bots scanning for weak points, the modern web is full of constant, noisy, and increasingly sophisticated attacks. A single exposed service — whether it's your NAS, media server, or production API — can quickly become an attacker’s entry point.

This is where a reliable Web Application Firewall (WAF) becomes essential.

Today, let’s take a closer look at SafeLine, a powerful and production-ready open-source WAF that’s easy to deploy, actively maintained, and built to help you secure anything from small personal projects to large-scale services.

What Is SafeLine?

SafeLine is a self-hosted Web Application Firewall designed to protect web applications by analyzing, filtering, and blocking malicious HTTP traffic in real time. Acting as a reverse proxy, it sits in front of your application and intercepts incoming requests before they hit your server.

What SafeLine Protects You From

SafeLine is capable of detecting and blocking a wide range of attacks, including:

  • SQL Injection
  • Cross-Site Scripting (XSS)
  • Code Injection
  • Command Injection
  • Path Traversal
  • Remote Code Execution (RCE)
  • XXE, SSRF, LDAP, XPath injections
  • Brute-force attacks
  • HTTP floods
  • Bot abuse

Whether you're defending a public dashboard, a company API, or a homelab service, SafeLine acts like a hardened gateway that filters out malicious traffic while letting legitimate users through.

Production-Ready by Design

SafeLine isn’t just a hobby project — it’s battle-tested.

  • 180,000+ installations worldwide
  • 1,000,000+ protected sites
  • 30+ billion HTTP requests processed per day

Its architecture is built for both reliability and performance, making it suitable for enterprise use while remaining accessible for individuals.

Key Features

1. Attack Blocking

Automatically detects and blocks common web attacks using advanced detection engines and signature-based rules.

2. Rate Limiting (Anti-DoS / Anti-Bruteforce)

Define thresholds to control abusive traffic:

  • Too many requests → blocked
  • Too many errors → blocked
  • Too many attacks → blocked

Great for protecting login pages, APIs, and public endpoints.

3. Anti-Bot Challenges

Challenge suspicious clients while allowing normal users to access without friction. Helps prevent:

  • Crawlers
  • Attack scripts
  • Traffic scrapers
  • Automated scanners

4. Access Authentication

Add an authorization layer in front of any service. Options include:

  • Password protection
  • Two-factor authentication
  • Temporary challenges

Perfect for protecting exposed admin panels or sensitive endpoints.

5. Dynamic Protection

SafeLine can dynamically obfuscate HTML and JavaScript responses to make exploitation significantly harder.

6. Blacklist/Whitelist Controls

Allow or block specific:

  • IP addresses
  • User-Agents
  • Countries
  • Crawlers
  • Custom patterns

Fully customizable.

Installation

SafeLine supports multiple installation methods. Here are the two simplest ways:

Option 1: One-Click Automatic Install

bash -c "$(curl -fsSLk https://waf-ce.chaitin.cn/release/latest/manager.sh)"
Enter fullscreen mode Exit fullscreen mode

This script sets up the entire environment automatically.

Option 2: Docker Installation

If you prefer containerized deployments:

mkdir -p /data/safeline
cd /data/safeline

wget https://waf-ce.chaitin.cn/release/latest/compose.yaml
touch .env
Enter fullscreen mode Exit fullscreen mode

Example .env file:

SAFELINE_DIR=/data/safeline
IMAGE_TAG=latest
MGT_PORT=9443
POSTGRES_PASSWORD=yourpassword
SUBNET_PREFIX=172.22.222
IMAGE_PREFIX=swr.cn-east-3.myhuaweicloud.com/chaitin-safeline
ARCH_SUFFIX=
RELEASE=
REGION=
Enter fullscreen mode Exit fullscreen mode

ARM users should set:

ARCH_SUFFIX=-arm
Enter fullscreen mode Exit fullscreen mode

Then start it:

docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Retrieve initial admin password:

docker exec safeline-mgt resetadmin
Enter fullscreen mode Exit fullscreen mode

Using SafeLine

After installation, open:

https://<your-server-ip>:9443
Enter fullscreen mode Exit fullscreen mode

You'll get a dashboard that lets you:

  • Add protected applications
  • Configure reverse proxy rules
  • Monitor attacks
  • View traffic analytics
  • Adjust protection policies

Example: Protecting Jellyfin (or any web app)

If your internal service runs at:

App: 192.168.1.50:8096
Enter fullscreen mode Exit fullscreen mode

You can expose it safely through SafeLine, e.g.:

Proxy: 192.168.1.10:3333
Enter fullscreen mode Exit fullscreen mode

Add the application in SafeLine → set upstream target → save → done.

Traffic Monitoring & Analytics

SafeLine includes built-in analytics:

  • Request count
  • Unique visitors
  • Attack attempts
  • Blocked requests
  • Real-time QPS
  • Geographic distribution

Perfect for understanding how your services are being accessed — and attacked.

Advanced Protections

Rate-Limit Enforcement

Protects APIs or login pages from brute-force attempts.

Human Verification

Challenge suspicious clients to prevent bot abuse.

Identity Authentication

Add optional login layers to internal apps.

Custom Rules

Define your own rules for niche scenarios.

SafeLine is a surprisingly powerful open-source WAF that brings enterprise-grade protection to developers, homelab users, and businesses alike.

✔ Robust attack defense
✔ Flexible deployment
✔ Easy configuration
✔ Rich traffic analytics
✔ Strong community support

If you’re exposing any service to the internet — even in your homelab — SafeLine can add a much-needed layer of security and peace of mind.


Give it a try, experiment with the protections, and see how it helps you secure your applications.

GitHub Repository: https://ly.safepoint.cloud/rZGPJRF
Official Website: https://ly.safepoint.cloud/eGtfrcF
Live Demo: https://ly.safepoint.cloud/DQywpL7

Top comments (0)