Skip to content

TCP Warden FAQ & Comparisons ​

Simple answers to common questions about TCP Warden, CrowdSec, and protecting non-HTTP servers.


The 30-Second Analogy ​

Think of your server like a popular venue:

  • 🚪 TCP Warden is the Bouncer at the front door: It physically stands at the entrance (:22, :25, :587, :993). It checks IDs (GeoIP/CIDRs), limits how fast people can enter (rate limits), kicks troublemakers out on the spot, or makes bots wait in a ridiculously slow line (tarpit).
  • 📡 CrowdSec is the Global Security Network: It collects intel from thousands of other venues worldwide. If someone starts trouble across town, CrowdSec adds them to the blacklist and gives your bouncer a heads-up before the troublemaker even reaches your sidewalk.

Bottom line: They don't compete—they work together. TCP Warden enforces rules live on the wire; CrowdSec provides global threat intelligence.


Comparison at a Glance ​

FeatureTCP WardenCrowdSecFail2baniptables / UFW
What is it?L4 Reverse Proxy & Protocol ShieldSmart Threat Detector & Global IntelOld-school Log ScannerRaw Linux Firewall
Where does it sit?In-line: Traffic passes through itBeside your apps: Watches logsBeside your apps: Watches logsIn the Linux kernel
When does it act?Instant: Before the app even sees the connectionAfter the fact: Once bad actions are loggedAfter the fact: Minutes after logs are writtenInstant: But only checks IP/port numbers
Understands Protocols?Yes: Knows SMTP, SSH, IMAP, Postgres, MySQL, RedisPartially: Reads text logs via regexPartially: Reads text logs via regexNo: Only sees blind packets
What can it do to attackers?Drop connection, send error code, or Tarpit (stall them)Decides to ban, throttle, or captchaBlocks IP in firewallDrops or rejects packets
Community Blocklist?Uses CrowdSec's list or local listsYes: Millions of shared IPsNo: Knows only your own machineNo: Static rules only
Speed & Resource UsageLightweight single Go binaryLow-to-moderate Go daemonHigh CPU when logs get largeZero overhead

How TCP Warden Makes CrowdSec Better ​

Running CrowdSec alone is good. Running CrowdSec with TCP Warden gives you enterprise-grade protection:

⚡ 1. Stops Attackers on the Doorstep

Normally, CrowdSec has to wait for an attacker to connect, guess passwords, and leave log messages before taking action. With TCP Warden, known malicious IPs are dropped on the very first packet—your real mail or database servers never even know they were there.

📋 2. Zero Broken Log Parsers

Traditional tools break whenever software updates change log formats. TCP Warden emits clean, structured jsonl events with exact client IPs, protocols, and reasons, meaning CrowdSec parsers never miss an attack.

🪤 3. Wastes Attackers' Time (Tarpitting)

Instead of just closing the door and letting scanners move on to another victim, TCP Warden can tarpit them—holding their sockets open and drip-feeding bytes so slow that their scanning tools lock up and run out of memory.

🛡️ 4. Saves Server CPU & Memory

Heavy services like OpenSSH or Dovecot spin up separate system processes for every incoming connection. When a botnet hits you with thousands of requests, your CPU spikes. TCP Warden absorbs the storm and keeps your server fast.

🔍 5. Catches Wire-Level Tricks

Scanners often probe servers with broken protocol handshakes or attempt to strip STARTTLS encryption. These attacks often don't show up in normal server logs, but TCP Warden catches them directly on the wire.

💾 6. Survives Restarts & Network Drops

TCP Warden keeps an internal database (bans.db). If your server reboots or loses internet access to CrowdSec's cloud, your active bans and security rules stay active without missing a beat.


The Complete Flow ​

Incoming Traffic (SSH, Mail, DBs, Redis) TCP Warden (The L4 Bouncer) High-throughput proxying & real-time protocol-level security enforcement 1. CrowdSec Decision Cache • In-memory local cache synced every 10s via LAPI • Millions of banned IPs shared by servers worldwide Known Bad IP Clean IP Drop / Tarpit Connection dropped or resources tarpitted Pass to App Forwards to SSH, DB, Postfix, or Redis 2. Real-Time Behavioral Checks • GeoIP rules & connection bursts per client IP • Auth monitoring: 3 password failures = trigger Suspicious Activity Structured JSONL Audit Log Written to /var/log/routewarden/tcp-warden.jsonl CrowdSec (Intelligence & Remediation) • Parses JSONL events with RouteWarden scenario parser • Emits automated remediation decision to LAPI • Pushes ban decision into TCP Warden cache in next poll

Frequently Asked Questions ​

Does TCP Warden replace Fail2ban? ​

Yes. Fail2ban is an older tool written in Python that constantly scans text log files using regular expressions. It is slow, uses significant CPU during high-traffic attacks, easily breaks when log formats change, and has no global intelligence.

TCP Warden + CrowdSec gives you instant in-line blocking with global community lists, with none of Fail2ban's weaknesses.


Does TCP Warden replace CrowdSec? ​

No. They are teammates.

  • TCP Warden is the muscle (the proxy that handles real traffic and drops bad packets).
  • CrowdSec is the brain (the global network that identifies attackers and shares threat intelligence).

Can I run TCP Warden without CrowdSec? ​

Yes, absolutely. You don't need CrowdSec to use TCP Warden. Even on its own, TCP Warden provides:

  • Automatic brute-force login protection (ban_after_failures).
  • Rate limiting (preventing connection floods).
  • Country blocking (GeoIP allow/deny lists).
  • IP & subnet whitelists (Docker, Tailscale, NetBird, office networks).
  • Tarpits and custom rejection messages.

Can I run both on the same server? ​

Yes, this is the recommended setup.

  1. TCP Warden runs as a Docker container or systemd service on your public ports (:22, :25, :587, :993).
  2. It checks CrowdSec's local API (http://127.0.0.1:8080) in memory before allowing any connection.
  3. It writes events to /var/log/routewarden/tcp-warden.jsonl, which CrowdSec reads.

Why can't TCP Warden protect UDP ports (like 3478 for STUN/TURN)? ​

TCP Warden is designed specifically for TCP streams (connections with handshakes, byte flows, and session states).

UDP is connectionless—it just sends loose packets without a stream. Services like STUN/TURN (Coturn / Nextcloud Talk on port 3478), WireGuard (51820), or DNS (53) should remain open directly on your system firewall:

bash
sudo ufw allow 3478/udp

How does TCP Warden handle IPv6 and VPNs (Tailscale / NetBird)? ​

It supports them seamlessly out of the box:

  • Dual-Stack: Binding to :25 automatically protects both IPv4 (0.0.0.0) and IPv6 (::).
  • VPN Friendly: You can whitelist entire VPN ranges so your team can always connect (e.g. 100.64.0.0/10 for Tailscale or NetBird).
  • GeoIP: Country lookups work on both IPv4 and IPv6 addresses.

What does an attacker see when they are blocked? ​

You choose what happens when an attacker is denied:

  • drop (default): The connection is silently closed. To the attacker's port scanner, the port looks dead, filtered, or non-existent.
  • reject: Immediately sends a TCP Reset (RST) packet, telling them the connection was refused.
  • tarpit: Accepts the connection, but stalls and drip-feeds bytes so slowly that the attacker's bot runs out of threads and hangs.
  • reject_message: Sends a clean protocol error message before closing (for example, replying to spammers with 421 4.7.0 Connection rate limit exceeded\r\n on SMTP).

Released under the MIT License.