An open API service indexing awesome lists of open source software.

https://github.com/m1chtv/mich-ddos-defense

secure your Ubuntu server against DDoS attacks
https://github.com/m1chtv/mich-ddos-defense

bash bash-script ddos ddos-defense ddos-protection

Last synced: about 1 month ago
JSON representation

secure your Ubuntu server against DDoS attacks

Awesome Lists containing this project

README

          

# ๐Ÿ›ก๏ธ Advanced DDoS Defense Script

A production-grade, systemd-compatible, error-handled Bash script to secure your Ubuntu server against DDoS attacks using multiple hardened layers: `iptables`, `ufw`, `nginx`, and `fail2ban`.

---

## โš™๏ธ Features

- ๐Ÿ” TCP/UDP port protection via `iptables`
- ๐ŸŒ HTTP rate-limiting via `nginx` with `limit_req_zone`
- ๐Ÿ”’ SSH & HTTP brute-force protection via `fail2ban`
- ๐Ÿ” Fully restart-safe: persistent firewall rules via `iptables-persistent`
- ๐Ÿง  Intelligent error handling with full output tracing
- ๐Ÿšซ Built-in `reset` command to remove all protections
- โšก Systemd-ready: no TTY dependencies or interactive blocking

---

## ๐Ÿ“ฆ What It Does

| Layer | Protection Type |
|---------------|---------------------------------------|
| iptables | SYN flood, UDP spam, connection limit |
| ufw | Global firewall rule hardening |
| nginx | HTTP request rate throttling (1 r/s) |
| fail2ban | Auto-ban on failed logins / flooding |
| persistent | All iptables rules survive reboots |

---

## ๐Ÿงช Usage Menu

When run, the script prompts you to choose:

1. Apply iptables Protection
2. Apply UFW Firewall Hardening
3. Enable Nginx HTTP Rate Limiting
4. Setup fail2ban
5. Apply ALL protections
6. Reset everything


---

## ๐Ÿง  Notes

- Compatible with Ubuntu 18.04+
- Assumes Nginx is installed and active
- `iptables-persistent` is installed automatically
- Port is prompted only for actions 1โ€“5
- Reset fully cleans up all firewall and rate-limiting rules

---

## ๐Ÿงฏ Reset Option

Option 6 allows a clean rollback:
- Flushes all iptables rules
- Disables and resets UFW
- Removes Nginx rate-limit config
- Stops `fail2ban`