LinuxのDDOSの攻撃を妨げる方法

によって Sukrit Dhandhania [[on]] 2009年4月13日

Linux 保証

私達は記事を動かした LinuxのiptablesのIPアドレスを妨げる方法 数日前に。 の場合には攻撃者のIPアドレスを検出する方法をショーが(またはDOS)サービス差し控え攻撃する無料の記事はここにある。

これをするためには私達は呼ばれたフリーソフトを使用する psad. psad iptablesが通常あなたのLinuxサーバーに壊れることを試みている誰かの印である他の疑った交通および左舷スキャンがあるように記録し、確認するモニターおよびiptablesと同期して仕事。

始まるためには、psadを取付けなさい。 走ればUbuntuまたはソフト帽のような豪華なパッケージの管理システムがあるLinuxの味はあなたのシステムのpsadを得る次の命令のどちらかを使用べきである:

# sudoは取付けるpsadをがち得る
または
# yumはpsadを取付ける

これがpsadにあなたのために頭部を働かせなければ ダウンロードのページ そしてあなたのために働くフォーマットをダウンロードしなさい。

私がUbuntuのLinuxサーバーを使用するのでこの個人指導の残りはUbuntuの細目である。 但し、未成年者とひねることはLinuxの他の味でそれに仕事をされるべきである。 開けなさい syslog.conf あなたの好みのテキスト・エディタが付いているファイル:

# vim /etc/syslog.conf

ファイルのの終わりに次のラインを加えなさい:

kern.info |/var/lib/psad/psadfifo

同じ事を達成する次の命令を使用できる:

#エコー- e 「kern.info \ t|/var/lib/psad/psadfifo」 >> /etc/syslog.conf

今度は再始動しなさい sysklogd そして klog 鬼:

/etc/init.d/sysklogd再始動
/etc/init.d/klogd再始動

方法psadの仕事はそれがiptablesを検出し、疑ったIPsを妨げるように指示することである。 時々これはあなたが使用するIPの妨害で起因するかもしれない。 この問題を克服するためには安全なIPアドレスのリストを含んでいるファイルを作成するべきである。 この1のようなファイルを作成しなさい:

# vim /home/calvin/safeiplist.cfg

whitelistにpsadを必要とすることIPアドレスを書き入れなさい:

127.0.0.0 /24
192.168.0.0 /24
122.164.34.240

使用無し1つに必要な規則とiptablesを形成するために続くことのような原稿。 ノート この原稿はあなたのiptablesの組み立てからすべての前の設定を取除くこと。 あなたのLinuxサーバーの次の原稿をコピーアンドペーストし、変数を取り替えなさい WORKDIR そして SAFEIPLIST あなたの組み立てからの正しい設定を使って。

WORKDIR= " /home/calvin/ 「
INTERVAL= " 5 "
HITCOUNT= " 5 "
SAFEIPLIST= " safeiplist.cfg "

CD $WORKDIR

iptables - F
[- f $SAFEIPLIST]; そして
IPS=$ (グレップ- Ev 「^#」 $SAFEIPLIST)
$IPSのiのため
[[do]]
iptables -入力- s $i - jは受け入れる
される
fi

iptables -入力- mの国家-新しい国家-最近のm -セット
iptables -A INPUT -m state –state NEW -m recent –update –seconds $INTERVAL –hitcount $HITCOUNT -j LOG

What the script does is that it logs an IP address if it makes five or more attempts at making a connection in the span of five seconds. I would suggest you use the script as is unless you know what you are doing while modifying it. One you are done, give it executable permissions and run it.

# chmod +x /home/calvin/ipblock.sh

# /home/calvin/ipblock.sh

Now back to psad. Open the psad configuration file and edit it. These are the changes I suggest you make. Feel free to go through the psad documentation and make other changes:

EMAIL_ADDRESSES you@yourdomain.com;

Set machine’s hostname:

HOSTNAME yourdomain.com;

If you have only one network interface on this server, set HOME_NET to:

HOME_NET NOT_USED;

You can also need to adjust danger levels for psad, and define a set of ports to ignore, for example to ask psad ignore udp ports 80 and 8080, make the following change:

IGNORE_PORTS udp/80, udp/8080;

Save and close the file. Then restart psad:

# /etc/init.d/psad restart

You are now good to go. To monitor psad’s reports run the following command:

# psad -S

To remove automatically clocked IPs run the following command:

# psad -F

psad is a very versatile and powerful tool. If you know how to use it it can do wonders for you, but if you don’t you can really mess up your computer. So please use psad with caution.

Related Posts:
  • How to block an IP address in IPTables in Linux
  • Comcast: Another chapter of lies, misdirection and ps. good luck using bittorrent
  • How to determine where all your hard drive space has gone in Windows
  • Getting started with iptables in Linux
  • An introduction to the sudo command and configuration file
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

    You can always opt out of this email subscription at any time.

    { 0 comments… add one now }

    Leave a Comment

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>