|
嚜
Linux撘瑕之iptables嚗銝槐pt_recentmodule嚗賡餅DDoS餅! S% V/ z Q) T4 S: ?2 r3 i& ?/ M
靘憒嚗雿臭誑啣銝chain嚗 iptables -N WEB_SRV_DOS ":WEB_SRV_DOS - [0:0]"' ?6 U: [% v0 O! \7 O% u4 u
嗅嚗其誑銝隞歹60蝘吩it port 80/443頞10甈∠IP餅銝西銝靘嚗+ T+ T: `7 ]6 w* @
- iptables -A INPUT -p tcp -m multiport dports 80,443 -j WEB_SRV_DOS
- iptables -A WEB_SRV_DOS -p tcp --syn -m multiport --dports 80,443 -m recent --rcheck --second 60 --hitcount 10 -j LOG --log-prefix "[Possible DOS Attack]"
- iptables -A WEB_SRV_DOS -p tcp --syn -m multiport --dports 80,443 -m recent --rcheck --second 60 --hitcount 10 -j REJECT
- iptables -A WEB_SRV_DOS -p tcp --syn -m multiport --dports 80,443 -m recent --set
- iptables -A WEB_SRV_DOS -p tcp -m multiport --dports 80,443 -j ACCEPT
銴鋆賭誨蝣
8 x- j/ n. C/ ~憒雿dmesg唬憿航炊嚗
. e4 S: `9 u3 Uhitcount (200) is larger than packets to be remembered (20) , ^7 X" _- t P4 ]4 j1 o! a
銵函內雿閮剖閬閮蝞甈⊥詨之履pt_recent閮剖銝嚗舫隤踵惺pt_recent moduleip_pkt_list_tot訾閫瘙箝
/ G# {* p1 x: [: z0 Q) I+ u$ H6 F0 a% `, S
皜祈岫銝銝:
g: V3 s/ \7 U) d w/ X8 ^1 J) j' x; ?撠皜祈岫site澆箏之 http request [size=13.376px](臭誑撖怎撘靘頝嚗冽雓撌乩犖箸 灸rowser憭TAB嚗銝瑞reload蝬脤); n9 l* }7 V5 w/ g& U0 o; V* t
臭誑潛曉/var/log/message銝剖箇曆閮荔
9 W4 ?- O2 @% OMay 17 07:12:00 localhost kernel: [Possible DOS Attack]IN=eth0 OUT= MAC=XX:XX:XX:XX:43:77:00:1f:YY:YY:YY:YY SRC=192.168.0.105 DST=192.168.0.102 LEN=64 TOS=0x00 PREC=0x00 TTL=64 ID=45026 DF PROTO=TCP SPT=59437 DPT=80 WINDOW=65535 RES=0x00 SYN URGP=0; r- i1 r5 Z; y$ D' J' A
甇斗隞半rowser皜祈岫蝬脤嚗箇遨onnection refused嚗⊥銝(箸閮剖rule爹EJECT)
, ?; @6 r/ @6 xOK嚗iptablesipt_recent module潭桐其$ |2 d: U. H$ J9 o) v
5 t6 q# K: E* X; k3 g$ ]
蝯隢嚗9 N5 S0 `$ V/ P$ a* g
(1) iptables函雯頝臬惜喲餅餅撠嚗撠serverloading敶梢輯撠& c9 i# A1 ~' W' @5 \5 C7 U
(2) iptables閮剖銝頛敶改舐其脰風80,443隞亙port
^. P8 z0 n. l8 m7 @(3) iptables航身摰潛函銝餅嚗箏究erver寥脰靽霅瘀臭誑摰其霈餅撠脣叫erver
+ d, P+ G. x: K; T C: y憒雿舐決S Windows + IIS嚗亙瑕嚗雿臭誑AQTRONIX WebKnight憟鞎餌web application firewall嚗鋆⊿W單脰風DDoS餅賬2 f3 ?( S9 K& q, {8 C, @
* b" |1 o- x% ^1 Y! z/ _
' k. L2 m" Y. c& W; R: http://blog.eztable.com/2011/05/17/how-to-prevent-ddos/
H# F8 `% O T5 ~
( G |6 y" m+ }9 m5 d; z: |9 J& O================================================
/ m, u! }5 {! r% h( ^菜葫舐IP 隞:
. H& j3 Y9 I* C4 f" d msed 's/ .*//' access.log | sort | uniq -c | sort -n
6 j- S* i6 P! n8 Cperl -ne 'print "$1*\n" if m#^((\d+\.){3})#' access.log | sort | uniq -c | sort -n
& i( |* ]% [3 F7 ]0 a |
|
|