DDoS-Deflate is a couple of bash scripts, that is run every X minutes, analyze the total number of connections to your server from every IP address using netstats command and temporarily blacklist IPs, that have more than Y active connections to your server at the moment, script runs. Blacklisting is done using either iptables or APF whichever you have installed. Simple!

To install ddos protection scripts just execute the following commands from console:
cd /usr/local
mkdir mytmp
wget http://underhost.com/pub/install.sh
chmod 0700 install.sh


To configure DDOS-Deflate (that’s the name of this script) do the following:
cd /usr/local/ddos
edit ddos.conf

Last line opens ddos.conf file in editor. You can use vi if you like. I chose edit because I am a Windows user and Edit has an interface familiar to me.
Let’s consider all available settings one by one:


These above are about various software locations. I recommend you leave them as is. They should suite the majority of systems. BTW, if your system doesn’t have APF, it is ok. Script can work with iptables also.


This setting affects how often (in minutes) you need to execute ddos protection script. After changing this param, please execute command
ddos –cron
to update cron sheduler.


This is the maximum number of connections acceptable for your server. I recommend to set this value to about 20-40 depending on your server.
BTW, don’t repeat my mistake Should you decide to use softwares, that open really many connections to your server, like FileZilla FTP client (it spawns many FTP connections to upload your folder ASAP), you will get blocked


If you have AFP, then set this to 1. If you have not, script will use iptables. To check if you have AFP or not, just execute command
If you want to use IPTables, don’t forget to start service by
service iptables start
and to have it autoloading at system startup by\
chkconfig iptables on


If you just testing your script, set this to 0. In this case, IPs will not get banned.


This email address will have messages about blacklisted IPs. Leave it to root to skip emailing.


Set this to a number of seconds, for how long to block entruder. I recommend to set this to 1800-3600 (30-60 minutes).
You can also add IPs to /usr/local/ddos/ignore.ip.list to whitelist them.
You can always uninstall DDoS-Deflate by executing
cd /usr/local/mytmp
wget http://underhost.com/pub/uninstall.ddos
chmod 0700 uninstall.ddos

That’s all!