- MAC + IP com problema
+ Responder ao Tópico
-
MAC + IP com problema
Uso debian 3.1r2, atualiza com upgrade todos os dias... bem é o seguinte minhas politicas de firewall é DROP, e tenho um script que faz o seguinte:
# Libera acesso pelas demais portas.
if [ $TRANS = "sim" ] && [ -x $NOPROXY ] && [ -x $NOARP ]; then
$IPTABLES -A INPUT -p UDP -s $IP -m mac --mac-source $MAC -j udpin_packets
$IPTABLES -A INPUT -p ICMP -s $IP -m mac --mac-source $MAC -j icmp_packets
$IPTABLES -A INPUT -p TCP -s $IP -m mac --mac-source $MAC -m ttl --ttl 32 -j tcp_packets_in
$IPTABLES -A INPUT -p TCP -s $IP -m mac --mac-source $MAC -m ttl --ttl 64 -j tcp_packets_in
$IPTABLES -A INPUT -p TCP -s $IP -m mac --mac-source $MAC -m ttl --ttl 128 -j tcp_packets_in
$IPTABLES -A INPUT -p TCP -s $IP -m mac --mac-source $MAC -m ttl --ttl 255 -j tcp_packets_in
$IPTABLES -A FORWARD -p UDP -s $IP -m mac --mac-source $MAC -m limit --limit $BAND_UP/second -j ACCEPT
$IPTABLES -A FORWARD -p ICMP -s $IP -m mac --mac-source $MAC -m limit --limit $BAND_UP/second -j icmp_packets
$IPTABLES -A FORWARD -p TCP -s $IP -m mac --mac-source $MAC -m limit --limit $BAND_UP/second -m ttl --ttl 31 -j allowed
$IPTABLES -A FORWARD -p TCP -s $IP -m mac --mac-source $MAC -m limit --limit $BAND_UP/second -m ttl --ttl 63 -j allowed
$IPTABLES -A FORWARD -p TCP -s $IP -m mac --mac-source $MAC -m limit --limit $BAND_UP/second -m ttl --ttl 127 -j allowed
$IPTABLES -A FORWARD -p TCP -s $IP -m mac --mac-source $MAC -m limit --limit $BAND_UP/second -m ttl --ttl 254 -j allowed
printf " \033[40;32m [OK] \033[m\n"
elif [ $TRANS = "sim" ] && [ -x $NOPROXY ] && [ ! -x $NOARP ]; then
$IPTABLES -A INPUT -p UDP -s $IP -j udpin_packets
$IPTABLES -A INPUT -p ICMP -s $IP -j icmp_packets
$IPTABLES -A INPUT -p TCP -s $IP -m ttl --ttl 32 -j tcp_packets_in
$IPTABLES -A INPUT -p TCP -s $IP -m ttl --ttl 64 -j tcp_packets_in
$IPTABLES -A INPUT -p TCP -s $IP -m ttl --ttl 128 -j tcp_packets_in
$IPTABLES -A INPUT -p TCP -s $IP -m ttl --ttl 255 -j tcp_packets_in
$IPTABLES -A FORWARD -p UDP -s $IP -m limit --limit $BAND_UP/second -j ACCEPT
$IPTABLES -A FORWARD -p ICMP -s $IP -m limit --limit $BAND_UP/second -j icmp_packets
$IPTABLES -A FORWARD -p TCP -s $IP -m limit --limit $BAND_UP/second -m ttl --ttl 31 -j allowed
$IPTABLES -A FORWARD -p TCP -s $IP -m limit --limit $BAND_UP/second -m ttl --ttl 63 -j allowed
$IPTABLES -A FORWARD -p TCP -s $IP -m limit --limit $BAND_UP/second -m ttl --ttl 127 -j allowed
$IPTABLES -A FORWARD -p TCP -s $IP -m limit --limit $BAND_UP/second -m ttl --ttl 254 -j allowed
printf " \033[40;32m [OK] \033[m\n"
elif [ $TRANS = "sim" ] && [ ! -x $NOPROXY ]; then
#$IPTABLES -A PREROUTING -t nat -i eth0 -p TCP -m multiport --dport 3128,80 -j DNAT --to 192.168.30.1:8082
#$IPTABLES -A PREROUTING -t nat -m mac --mac-souce $MAC -p TCP -m multiport --dport 3128,80 -j DNAT --to 192.168.30.1:8082
$IPTABLES -A INPUT -p TCP -m mac --mac-source $MAC -j tcp_packets_in
$IPTABLES -A INPUT -p UDP -m mac --mac-source $MAC -j udpin_packets
$IPTABLES -A INPUT -p ICMP -m mac --mac-source $MAC -j icmp_packets
$IPTABLES -A FORWARD -p ICMP -m mac --mac-source $MAC -j icmp_packets
$IPTABLES -A FORWARD -p TCP -m mac --mac-source $MAC -j allowed
$IPTABLES -A FORWARD -p UDP -m mac --mac-source $MAC -j ACCEPT
else
echo " *** total acesso NEGADO !!! ***"
printf " \033[40;32m [OK] \033[m\n"
fi
mas se eu trocar o ip e o mac ja estiver liberado navega normal, posso usar qualquer ip que navego dentro da minha rede claro...
Tenho que carregar quais módulos pra que isso funcione 100%??
Desde ja agradeço....
-
Kra eu faço assim:
#Aceita requisicoes vindas da eth0 desde que tenham o IP e MAC OK
iptables -A FORWARD -i eth0 -s 172.16.3.1 -m mac --mac-soruce 00:02:3F:CF:25:5B -o eth1 -d 0/0 -j ACCEPT
#Volta dos pacotes
iptables -A FORWARD -o eth0 -m state --state STABLISHED,RELATED -j ACCEPT
#Nega tudo
iptables -A FORWARD -i eth0 -j DROP
#Mascara
iptables -t nat -A POSTROUTING -s 172.16.0.0/16 -o eth1 -j MASQUERADE
Aki ta funfano legal
-
quais módulos tenho que ativar pra que isso funcione? assim tambem não funcionou...
-
ola pessoal nem mais uma idéia??
-
Kra muito estranho pq aki funciona perfeito, qual o erro q da?
-
não da erro simplesmente troco o ip da maquina do cliente e ele continua navegando... o que esta acontecendo é que se liberar o mac posso colocar qualquer ip que navega...