Jump to content
php.lv forumi

centos 5.5 firewall


Recommended Posts

Labvakar. Uz Centos 5.5 ir pieejams, kāds firewall, kurš spēj bloķēt dos uzbrukumus?

Caur iptables mēģināju kaut ko šādu

iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 10 -j DROP

bet tik un tā ļaunā dos programma sprut tiek klāt apachem un pilnībā paralizē tā darbību. Nepalīdz arī mod_evasive.

Ir vispār kāds software līmeņa variants? Vai vienīgā iespēja ir rūteris?

Link to comment
Share on other sites

Man ir šāds. Failā /etc/rc.d/ip.deny lieku IP vienā rindā kādā no formātiem:

 

139.133.133.133

139.133.0.0/16

139.133.133.133:<port>

 

Pielabo tik ceļus uz failiem.

 

#!/bin/csh -f

# CONFIG
set IPTABLES=/usr/sbin/iptables

# flush iptables
/etc/rc.d/rc.fflush

set ip_deny=`egrep '(^[^#])' < /etc/rc.d/ip.deny`
foreach ip_port ($ip_deny)
set ip=`echo "$ip_port" | cut -d':' -f1`
set port=`echo "$ip_port" | cut -d':' -f2`

if($ip == $port) then
$IPTABLES -I INPUT -s $ip -j DROP
else
$IPTABLES -I INPUT -p tcp -s $ip --dport $port -j DROP
endif

end

 

/etc/rc.d/rc.fflush

IPTABLES="/usr/sbin/iptables"

#
# reset the default policies in the filter table.
#
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT

#
# reset the default policies in the nat table.
#
$IPTABLES -t nat -P PREROUTING ACCEPT
$IPTABLES -t nat -P POSTROUTING ACCEPT
$IPTABLES -t nat -P OUTPUT ACCEPT

#
# reset the default policies in the mangle table.
#
$IPTABLES -t mangle -P PREROUTING ACCEPT
$IPTABLES -t mangle -P OUTPUT ACCEPT

#
# flush all the rules in the filter and nat tables.
#
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
#
# erase all chains that's not default in filter and nat table.
#
$IPTABLES -X
$IPTABLES -t nat -X
$IPTABLES -t mangle -X

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...