How to install (D)DoS Deflate on Debian 7 (Wheezy) / Ubuntu

weixin_33866037發表於2015-04-21

http://bestbg.com/blog/how-to-install-ddos-deflate-on-debian-7-wheezy-ubuntu/

just back up in here:

There are many guides about how to install (D)DoS Deflate on Linux server (or VPS) and in most cases there shouldn’t be a problem with it but I faced some small issues installing (D)DoS Deflate on Debian 7 (Wheezy) so I decided to share how I managed to install and configure it successfully on my machine.I guess the same fix (see below) would work on Ubuntu as well.
Install (D)DoS Deflate the way it is advised on their official website or follow these steps:
1 cd /usr/local/src/2 sudo mkdir ddos3 4 cd ddos5 6 sudo wget http://www.inetbase.com/scripts/ddos/install.sh7 8 sudo sh install.sh

(* If you have root access you don’t need to use sudo)

When the installation is done you will see something like this:
1 Installation has completed. Config file is at /usr/local/ddos/ddos.conf2 Please send in your comments and/or suggestions to email@vsnl.com

Edit the configuration file depending on your requirements:
1 sudo nano /usr/local/ddos/ddos.conf

You may also want to white list your IP address:
1 sudo nano /usr/local/ddos/ignore.ip.list

Now it is a time to run (D)DoS Deflate:
1 sudo /usr/local/ddos/ddos.sh -c

Unfortunately I got this:
1 /usr/local/ddos/ddos.sh: 13: [: /usr/local/ddos/ddos.conf: unexpected operator DDoS-Deflate version 0.62 Copyright (C) 2005, Zaf email@vsnl.com3 $CONF not found.

To fix this open ddos.sh:
1 sudo nano /usr/local/ddos/ddos.sh

and change the first line of the file from
1 !/bin/sh

to
1 !/bin/bash

There are at least two more instances of the same path in ddos.sh, so find them and change to /bin/bashSave and close ddos.sh.
Start the service again:
1 sudo /usr/local/ddos/ddos.sh -c

If you get the following error message:
1 crond: unrecognized service

Open ddos.sh again:
1 sudo nano /usr/local/ddos/ddos.sh

Find “add to cron” part and change service crond restartto service cron restart
(I found two instances that need to be changed).
Save, exit and start the service again:
1 sudo /usr/local/ddos/ddos.sh -c

If you did everything correct you should see the following message:
1 [ ok ] Restarting periodic command scheduler: cron [....] Stopping periodic command scheduler: cron.

We are done.

Note: I read in few forums/blogs that there is a bug with (D)DoS Deflate version 6.0 and to fix it you need to open /usr/local/ddos/ddos.sh and replace:
1 netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

with
1 netstat -ntu | grep ‘:’ | awk ‘{print $5}’ | sed ‘s/::ffff://’ | cut -f1 -d ‘:’ | sort | uniq -c | sort -nr > $BAD_IP_LIST

I didn’t have possibility to test it so it is up to you to make this change or not.
Hope the article was helpful to some of you.If you have something to add or find mistakes please let me know by commenting.

相關文章