Overview
Discover what makes SafeLine powerful
SafeLine is a self‑hosted **Web Application Firewall (WAF)** that sits as a reverse proxy in front of any HTTP/S service. By intercepting every request, it can parse, analyze, and modify traffic before it reaches the origin server. The core objective is to block malicious payloads—SQLi, XSS, SSRF, RCE, and more—while allowing legitimate traffic to flow unimpeded. Its defensive posture is driven by a combination of rule‑based filters, machine‑learning inference, and dynamic challenge mechanisms (CAPTCHA, password prompts, bot detection). The result is a low‑latency shield that protects against both known exploits and emerging zero‑day vectors.
Reverse‑proxy engine
Intelligent engine
Data store
API layer
Overview
SafeLine is a self‑hosted Web Application Firewall (WAF) that sits as a reverse proxy in front of any HTTP/S service. By intercepting every request, it can parse, analyze, and modify traffic before it reaches the origin server. The core objective is to block malicious payloads—SQLi, XSS, SSRF, RCE, and more—while allowing legitimate traffic to flow unimpeded. Its defensive posture is driven by a combination of rule‑based filters, machine‑learning inference, and dynamic challenge mechanisms (CAPTCHA, password prompts, bot detection). The result is a low‑latency shield that protects against both known exploits and emerging zero‑day vectors.
Architecture
- Reverse‑proxy engine: Built on an Nginx core, SafeLine leverages the event‑driven model of Nginx to handle high request volumes with minimal overhead. The WAF runs as an Nginx module, enabling seamless integration into existing reverse‑proxy stacks.
- Intelligent engine: A separate microservice, written in Go and Rust for speed, performs semantic parsing of HTTP payloads. It uses a neural‑network model trained on millions of attack patterns, delivering a 99.995 % detection rate with <0.007 % false positives.
- Data store: PostgreSQL is used for persistent configuration (policies, rate‑limit tables, user accounts). Redis provides in‑memory caching for session state and rate‑limit counters.
- API layer: A RESTful API (JSON over HTTPS) exposes configuration endpoints, policy CRUD operations, and real‑time analytics. Webhooks can be registered to notify external SIEM or incident‑response systems.
- Container support: The entire stack is packaged as a Docker image. Kubernetes manifests (Helm chart) are available for rolling upgrades, autoscaling, and zero‑downtime deployments.
Core Capabilities
- Rule‑based filtering: A comprehensive rule set covering OWASP Top 10, CRLF, LDAP injection, and path traversal. Rules are expressed in a declarative JSON format that can be extended or overridden per application.
- Dynamic protection: When enabled, SafeLine rewrites HTML/JS on the fly to obfuscate scripts and thwart code injection attacks that rely on client‑side execution.
- Rate limiting & DoS mitigation: IP‑based sliding window counters, per‑endpoint quotas, and adaptive throttling protect against brute‑force and HTTP flood attacks.
- Bot & authentication challenges: CAPTCHA or password gates can be applied globally or per route. The challenge engine uses a lightweight JavaScript token that validates the client’s interaction before granting access.
- Web ACL: Fine‑grained access control lists allow whitelisting/blacklisting of IP ranges, user agents, and request patterns.
- Logging & analytics: Structured logs are shipped to Loki/ELK stacks, and a built‑in dashboard exposes real‑time threat metrics (attack types, source IPs, response codes).
Deployment & Infrastructure
SafeLine is designed for self‑hosting on any Linux distribution. Minimum requirements are 2 CPU cores, 4 GB RAM, and a persistent disk for PostgreSQL. For production environments:
- Deploy behind an external TLS terminator (e.g., HAProxy or Cloudflare) to offload HTTPS.
- Use Docker Compose for single‑node setups; Kubernetes is recommended for multi‑replica, high‑availability clusters.
- The application supports horizontal scaling; each instance shares a Redis cluster for synchronized rate limits and a PostgreSQL replica set for read‑scaling.
Integration & Extensibility
- Plugin SDK: A Go‑based plugin API allows custom rule engines or third‑party threat intelligence feeds to hook into the request pipeline.
- Webhooks: Triggered on policy violations, login attempts, or rate‑limit breaches; can be consumed by PagerDuty, Slack, or custom microservices.
- OAuth2 & SAML: For authentication challenges, SafeLine can delegate to existing identity providers via standard protocols.
- CLI & SDK: A Go/Node SDK is available for automating policy deployment in CI/CD pipelines.
Developer Experience
SafeLine’s configuration is declarative and version‑controlled. The UI exposes a wizard for common use cases, while advanced users can edit JSON files directly or call the REST API. Documentation is extensive (docs site, example policies, API reference) and includes a sandbox environment for testing. The community is active on Discord; the open‑source repository receives regular security patches and feature updates, ensuring developers can stay ahead of emerging threats.
Use Cases
- Enterprise web services: Protect internal APIs and public portals from injection, DDoS, and bot abuse without modifying application code.
- Microservices architectures: Deploy SafeLine as a sidecar in Kubernetes, shielding each service with minimal latency.
- Compliance‑heavy environments: Use the WAF’s logging and audit trails to satisfy PCI DSS, HIPAA, or GDPR requirements.
- Multi‑tenant SaaS platforms: Leverage per‑tenant policy isolation to enforce tenant‑specific security rules.
Advantages
- Performance: Nginx core + lightweight Go engine keeps request latency below 5 ms on average, even under high load.
- Zero‑day resilience: The ML engine detects previously unseen patterns, reducing reliance on rule updates.
- Open‑source & self‑hosted: No vendor lock‑in; full control over data, compliance, and custom logic.
- Scalable: Built
Open SourceReady to get started?
Join the community and start self-hosting SafeLine today
Related Apps in cloud-platforms
Home Assistant
Open-source smart home hub for automation and integration
Caddy
Secure, auto‑TLS web server for every site
Traefik
Dynamic reverse proxy and load balancer for microservices
Pi‑hole
Network‑wide ad blocking with your own DNS server
CasaOS
Your Personal Cloud OS for Docker-based home servers
AdGuard Home
Network‑wide ad and tracker blocker
Weekly Views
Repository Health
Information
Tags
Explore More Apps
DOMjudge
Automated programming contest management system
piqueserver
Self-hosted other
YOURLS
Self-hosted URL shortener with full data control
Opik
Open-source LLM evaluation platform for tracing, metrics, and guardrails
AnonAddy
Anonymous email forwarding with custom aliases for privacy.
Buku
Portable, privacy‑first bookmark manager with CLI and web UI