🛡️ Protecting Validator from DDoS Attacks

Understanding the DDoS Threat

What is a DDoS attack? A Distributed Denial of Service (DDoS) attack floods your server with excessive traffic, making it unavailable.

Types of DDoS attacks:

  • Network-layer attacks (L3-L4, volumetric attacks) – Overloading bandwidth (UDP flood, SYN flood).

  • Transport-layer attacks (L4) – Exhausting connections (TCP flood, Slowloris).

  • Application-layer attacks (L7, HTTP flood) – Overloading APIs and RPC endpoints.

Network-Level Protection (L3-L4)

At the network level, you need to limit malicious traffic.

Configuring Firewalls (UFW, iptables)

UFW (Uncomplicated Firewall)

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 26656/tcp  # Open port for P2P (example for Cosmos SDK)
sudo ufw enable

iptables (Advanced option)

Rate Limiting (Restricting Requests)

Fail2Ban can automatically ban suspicious IPs.

Add:

Apply changes:


Protecting Network Infrastructure

Using Cloudflare or Another CDN

Cloudflare or Radware helps filter malicious traffic.

How to set up Cloudflare?

  1. Add your domain.

  2. Enable "Under Attack Mode".

  3. Restrict API access to trusted IPs only.

Setting Up Reverse Proxy (NGINX)

Why use it? NGINX can hide your real IP and limit requests.

Example config for L7 attack protection:

Apply the config:


Monitoring and Automated Response

Installing CrowdSec

CrowdSec detects and blocks attacks.

Monitoring Load (Prometheus + Grafana)

  1. Install Prometheus:

  1. Install Grafana and set up dashboards.


Additional Security Measures

  • Restrict access by IP – Allow access only from trusted IPs.

  • Use VPN (WireGuard, OpenVPN) – Hide your validator’s real IP.

  • Separate RPC and P2P networks – Don’t run everything on a single server.

Last updated