joseslei
(usa Ubuntu)
Enviado em 26/05/2008 - 23:42h
Quando executo o firewall da um erro.
iptables no chain/target/match by that name.
Esse é o meu firewall
#!/bin/bash
#Configuracoes do Firewall
echo "Configuracao das Interfaces-----------------------------"
Externa=eth0
RedeRanger=172.16.1.0/24
Interna=eth1
#-----------------------------------------------------------------------------------
#Limpando Todas as Regras-----------------------------------------------------------
#-----------------------------------------------------------------------------------
iptables -F
iptables -X
iptables -F -t nat
iptables -X -t nat
iptables -F -t mangle
iptables -X -t mangle
iptables -F -t filter
#-----------------------------------------------------------------------------------
#Zera Contadores das cadeias--------------------------------------------------------
iptables -Z -t nat
iptables -Z -t mangle
iptables -Z -t filter
#Ativando Modulos-------------------------------------------------------------------
#-----------------------------------------------------------------------------------
modprobe iptable_nat
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ipt_MASQUERADE
modprobe ipt_LOG
modprobe ipt_REJECT
modprobe ip_nat_ftp
#-----------------------------------------------------------------------------------
#Ativando IP FORWARD, redirecionamento----------------------------------------------
echo "1" > /proc/sys/net/ipv4/ip_forward
#-----------------------------------------------------------------------------------
#=======================================
echo 0 > /proc/sys/net/ipv4/tcp_ecn
echo 0 > /proc/sys/net/ipv4/tcp_timestamps
#Anti Spoofing----------------------------------------------------------------------
for spoofing in /proc/sys/net/ipv4/conf/*/rp_filter; do
echo "0" > $spoofing
done
#-----------------------------------------------------------------------------------
#Anti-Redirects---------------------------------------------------------------------
echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
#-----------------------------------------------------------------------------------
#Anti Source Route------------------------------------------------------------------
echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
#-----------------------------------------------------------------------------------
#Anti Bugus Response----------------------------------------------------------------
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
#-----------------------------------------------------------------------------------
#Anti Synflood Protection-----------------------------------------------------------
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
#-----------------------------------------------------------------------------------
#Ping Ignore------------------------------------------------------------------------
echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_all
#-----------------------------------------------------------------------------------
#Protecao Contra Trino--------------------------------------------------------------
iptables -N TRINOO
iptables -A TRINOO -m limit --limit 15/m -j LOG --log-level 6 --log-prefix "FIREWALL: trinoo: "
iptables -A TRINOO -j DROP
iptables -A INPUT -p tcp -i $Externa --dport 27444 -j TRINOO
iptables -A INPUT -p tcp -i $Externa --dport 27665 -j TRINOO
iptables -A INPUT -p tcp -i $Externa --dport 31335 -j TRINOO
iptables -A INPUT -p tcp -i $Externa --dport 34555 -j TRINOO
iptables -A INPUT -p tcp -i $Externa --dport 35555 -j TRINOO
#-----------------------------------------------------------------------------------
#Protecao Contra Trojans------------------------------------------------------------
iptables -N TROJAN
iptables -A TROJAN -m limit --limit 15/m -j LOG --log-level 6 --log-prefix "FIREWALL: trojan: "
iptables -A TROJAN -j DROP
iptables -A INPUT -p tcp -i $Externa --dport 666 -j TROJAN
iptables -A INPUT -p tcp -i $Externa --dport 4000 -j TROJAN
iptables -A INPUT -p tcp -i $Externa --dport 6000 -j TROJAN
iptables -A INPUT -p tcp -i $Externa --dport 6006 -j TROJAN
iptables -A INPUT -p tcp -i $Externa --dport 16660 -j TROJAN
#------------------------------------------------------------------------------------
#Protecao Contra Worms---------------------------------------------------------------
iptables -A FORWARD -p tcp --dport 135 -i $Externa -j REJECT
#------------------------------------------------------------------------------------
#Protecao Contra syn-flood
#------------------------------------------------------------------------------------
iptables -A FORWARD -p tcp --syn -m limit --limit 2/s -j ACCEPT
#------------------------------------------------------------------------------------
#Protecao Contra Ping da morte
#------------------------------------------------------------------------------------
iptables -A FORWARD -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
#------------------------------------------------------------------------------------
#Protecao Contra port scanners
#------------------------------------------------------------------------------------
iptables -N SCANNER
iptables -A SCANNER -m limit --limit 15/m -j LOG --log-level 6 --log-prefix "FIREWALL: port scanner: "
iptables -A SCANNER -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -i $Externa -j SCANNER
iptables -A INPUT -p tcp --tcp-flags ALL NONE -i $Externa -j SCANNER
iptables -A INPUT -p tcp --tcp-flags ALL ALL -i $Externa -j SCANNER
iptables -A INPUT -p tcp --tcp-flags ALL FIN,SYN -i $Externa -j SCANNER
iptables -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -i $Externa -j SCANNER
iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -i $Externa -j SCANNER
iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -i $Externa -j SCANNER
#-------------------------------------------------------------------------------------
#Regras PREROUTING-Redicionamento de Portas-------------------------------------------
iptables -t nat -A PREROUTING -s $RedeRanger -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -s $RedeRanger -p tcp --dport 8080 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -i $Externa -p tcp --dport 5900 -j DNAT --to 172.16.1.254
# iptables -t nat -A PREROUTING -p tcp -i $Interna -d ! 172.16.1.0 -s 172.16.1.0/24 --dport 80 -j REDIRECT --to-port 3128 # Proxy Transparente
#-------------------------------------------------------------------------------------
#Regras INPUT-------------------------------------------------------------------------
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT # SSH
iptables -A INPUT -p tcp --dport 21 -j ACCEPT # FTP
iptables -A INPUT -p tcp --dport 20 -j ACCEPT # FTP
iptables -A INPUT -p tcp --dport 40000 -j ACCEPT #FTP
iptables -A INPUT -p tcp --dport 1194 -j ACCEPT
iptables -A INPUT -p tcp --dport 2631 -j ACCEPT # Conectividade Social
iptables -A INPUT -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp --dport 3128 -j ACCEPT
#--------------------------------------------------------------------------------------
#Regras FORWARD------------------------------------------------------------------------
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p icmp -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 25 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 22 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 21 -j ACCEPT #FTP
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 20 -j ACCEPT #FTP
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 110 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 443 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 3389 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 80 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 8080 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 80:8080 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 15779 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 1042 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 30606 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 2130:2680 -j ACCEPT
iptables -A FORWARD -i $Interna -o $Externa -p tcp --dport 44405 -j ACCEPT
iptables -A FORWARD -i $Externa -o $Interna -p tcp --dport 5900 -j ACCEPT
#----------------------------------------------------------------------------------------
#Regras OUTPUT---------------------------------------------------------------------------
iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
#----------------------------------------------------------------------------------------
#Regras POSTROUTING, Mascamento Saida----------------------------------------------------
iptables -t nat -A POSTROUTING -o $Externa -j MASQUERADE
iptables -t nat -A POSTROUTING -o $Interna -j MASQUERADE
#----------------------------------------------------------------------------------------
# MSN ===================================================================================
iptables -A FORWARD -s $RedeRanger -p tcp --dport 1863 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 1024:5999 --dport 1863 -m state --state NEW -j ACCEPT
iptables -A FORWARD -s $RedeRanger -d loginnet.passport.com -j ACCEPT
iptables -A FORWARD -s $RedeRanger -d 200.152.32.174 -j ACCEPT
iptables -A FORWARD -i $Externa -d 200.152.32.174 -j ACCEPT
iptables -A FORWARD -s $RedeRanger -d 201.76.37.243 -j ACCEPT
iptables -A FORWARD -i $Externa -d 201.76.37.243 -j ACCEPT
# Conectividade Social ===================================================================
iptables -A FORWARD -s $RedeRanger -d 200.201.174.204 -j ACCEPT
iptables -A FORwARD -i $Externa -d 200.201.174.204 -j ACCEPT
iptables -A INPUT -i $Externa -p tcp --dport 2631 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 2631 -j ACCEPT
iptables -A FORWARD -i $Interna -p tcp --dport 2631 -j ACCEPT
echo "========================================================"
echo " --------> Firewall Ativo <---------- "
echo "========================================================"