Skip to main content
Status: Deprecated - This project has reached End-of-Life (EOL) and End-of-Support (EOS). No longer supported or updated.

Overview

DDoS Deflate is a lightweight script designed to mitigate distributed denial of service (DDoS) attacks on Linux servers by monitoring the number of active connections per IP address. IP addresses that exceed a predefined threshold will be blocked, reducing the load caused by malicious traffic.

Original Project

System Requirements

Operating System

Ubuntu 20.04/22.04/24.04 x64

Dependencies

bash, iptables, dnsutils, net-tools

Installation

Download Project

First, download the project using the gitfolder utility:

Install DDoS Deflate

Run the installation script:
The script automatically configures a cron job to run every minute and monitor active connections.

Configuration

Default Settings

The script runs every minute with these default settings:
  • Ban Limit: 150 simultaneous active connections
  • Ban Period: 600 seconds (10 minutes)
  • Excluded IPs: System IPs running DDoS-Deflate

Customize Configuration

Edit the configuration file to adjust thresholds:

Key Configuration Options

Configuration Files

Usage

Add IPs to Whitelist

Prevent specific IPs from being banned:
Always whitelist your own management IPs and trusted servers to avoid locking yourself out.

Monitor Banned IPs

Check which IPs have been banned:
Example output:

View System Logs

Check cron execution logs:
Example output:

How It Works

Detection Process

  1. Connection Monitoring: Script runs every minute via cron
  2. Count Active Connections: Uses netstat to count connections per IP
  3. Threshold Check: Compares connection count against BAN_LIMIT
  4. Whitelist Verification: Checks if IP is in ignore list
  5. Apply Ban: Adds iptables rule to block traffic from offending IP
  6. Logging: Records ban event with timestamp and hostname resolution
  7. Automatic Unban: Removes block after BAN_PERIOD expires

Uninstallation

To completely remove DDoS Deflate:
Uninstallation will remove all configuration files and the cron job. Existing iptables rules may need manual cleanup.

Limitations

This project is no longer maintained. The last update was in 2012. Consider using modern alternatives like fail2ban, CSF (ConfigServer Security & Firewall), or cloud-based DDoS protection services.
DDoS Deflate uses basic connection counting which may not detect sophisticated distributed attacks or application-layer attacks.
Legitimate users behind NAT or shared IPs might trigger bans if multiple users access your service simultaneously.
Bans are temporary (10 minutes by default). Determined attackers can resume attacks after the ban period expires.
Only protects against connection-based attacks. Does not analyze HTTP requests or application-layer threats.

Alternatives

Since DDoS Deflate is deprecated, consider these modern alternatives:

Fail2Ban

Active project with comprehensive attack detection and flexible ban rules

CSF Firewall

ConfigServer Security & Firewall with advanced DDoS protection

ModSecurity

Web application firewall for Apache/Nginx with OWASP rules

Cloudflare

Cloud-based DDoS protection with CDN and WAF capabilities

Troubleshooting

  • Check cron service: systemctl status cron
  • Verify cron entry: sudo crontab -l | grep ddos
  • Check script permissions: ls -l /usr/local/ddos/ddos.sh
  • Review syslog for errors: grep ddos /var/log/syslog
  • Verify BAN_LIMIT threshold in /usr/local/ddos/ddos.conf
  • Check if IP is whitelisted in /usr/local/ddos/ignore
  • Ensure iptables is running: sudo iptables -L
  • Monitor connection counts: netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
  • Add their IPs to /usr/local/ddos/ignore
  • Increase BAN_LIMIT threshold
  • Check for NAT/proxy scenarios
  • Review ban logs: cat /usr/local/ddos/ddos.log
Remove iptables rule manually:

Best Practices

1

Configure Whitelist

Add all trusted IPs (management, monitoring, APIs) to /usr/local/ddos/ignore before enabling
2

Set Appropriate Thresholds

Adjust BAN_LIMIT based on your typical traffic patterns. Too low causes false positives, too high reduces effectiveness
3

Monitor Logs Regularly

Review /usr/local/ddos/ddos.log to identify attack patterns and adjust configuration
4

Combine with Other Tools

Use alongside fail2ban, proper firewall rules, and rate limiting for comprehensive protection
5

Consider Migration

Given EOL status, plan migration to actively maintained alternatives like fail2ban or cloud-based solutions

License

Artistic License 1.0

Original code licensed under Artistic License 1.0

CC BY-SA 4.0

Documentation under Creative Commons Attribution-ShareAlike 4.0

Disclaimer

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.