Marcos do Vale escreveu:Olha só como eu faço:
#Cria a chain msnblock
iptables -X msnblock
iptables -N msnblock
iptables -F msnblock
#Insere a chain como alvo nas conexões do msn
iptables -I FORWARD -d 65.54.0.0/16 -j msnblock
...
Assim fica fácil de administrar a regras personalizadas.
É só criar uma chain nova e redirecionar e tráfego da chain padrão do iptables para a sua chain.
table class=maintable tr td class=row1
$Egf /td td class=row2 /b a href=$SCRIPT?ACTION=RELOAD u $Pau /u /a |
a href="editconf.cgi?CONFFILE=/etc/coyote/firewall&DESCFILE=Firewall Configuration" u $Pav /u /a |
Parte que alteramos a href="editconf.cgi?CONFFILE=/etc/coyote/firewall.local&DESCFILE=Custom Firewall Rules" u $Pdh /u /a |
a href="editconf.cgi?CONFFILE=/etc/ip.log&DESCFILE=Controle de Usuários" u Controle de Usuários /u /a ] /td /tr /table br
CLEOF
#rm -f /tmp/sfw_* 1> /dev/null 2> /dev/null
cl_footer2
Só para lhe informar: Está dando uns erros quando tento acessar o fórum. Será que o problema é no meu computador(tenho 99% de não)? Mostra uma mensagem dizendo que deu um erro na conexão com o banco de dados e as vezes diz assim: "
Claudio escreveu:Essa é uma ótima solução.
Exatamente o que eu iria sugerir que você fizesse.
Realmente a referencia aos chains personalizados não é apagada, mas isso não traz nenhum problema já que você esvaziou o chain.Só para lhe informar: Está dando uns erros quando tento acessar o fórum. Será que o problema é no meu computador(tenho 99% de não)? Mostra uma mensagem dizendo que deu um erro na conexão com o banco de dados e as vezes diz assim: "
Isso é um pequeno problema com nosso provedor. Felizmente o suporte deles é muito bom e já está sendo resolvido.
Essa idéia (de todos nós) poderia está presente no Bfw como default?
Claudio escreveu:Essa idéia (de todos nós) poderia está presente no Bfw como default?
Como assim???
mastigozinho escreveu:Claudio escreveu:Essa idéia (de todos nós) poderia está presente no Bfw como default?
Como assim???
Tipo assim: uma tela no webadmin para colocarmos o ip do usuário para ser redirecionado e o ip do webserver que pode ser o próprio bfw.
Essa tela poderia ser parecida com a do dhcp... nela teria um checkbox para dizermos se o usuário está redirecionado ou não... Poderia usar o arquivo do dhcp ou do qos como base para a configuração!
Falo isso porque têm muitos colegas que estão fazendo "gambiarras" com o bfw... Nós sabemos que ele pode fazer isso, falta organização!
Essa idéia irar beneficiar muitas pessoas! Temos certeza disso!
Uma informação relacionada a esse assunto: tem como através de um link efetuar log no bfw(cgi) e mandar ele recarregar o firewall(rc.firewall)?
Estou perguntando porque quero automatizar o bloqueio(redirecionamento) ou o desbloqueio sem depender de nenhum outro programa a não ser o navegador!
Obrigado pela atenção!
Se for possível, será "totalmente excelente"..
Ficaria muito mais amistoso, assim como o sistema se propõe e é....
Além disso, será possível algum dia redirecionar para uma página, ao invés de Ip e porta,
Além disso, será possível algum dia redirecionar para uma página, ao invés de Ip e porta,
luapufo1 escreveu:Mastigozinho,
Tentei fazer esta regra sua e quando mando regarregar o Firewall, ele me diz isso:
Configuring firewall rules...
Configuring custom firewall rules...
iptables: No chain/target/match by that name
iptables: No chain/target/match by that name
[H[JTry `iptables -h' or 'iptables --help' for more information.
Bad argument ` '
/etc/controle_usuario.sh: /etc/controle_usuario.sh: 20: -j: not found
iptables: No chain/target/match by that name
Configuring port forwarding for internal hosts...
Running Line UP Scripts...
Checking need for update...
Current IP...: x.x1.x2.x2
Old IP.......: x.x1.x2.x
The update of bqinvelox.no-ip.biz is not needed
uso BFW 2.30, tirei o tinyproxy e mesmo assim, não funciona
luapufo1 escreveu:meu arquivo controle_usuario.sh
#!/bin/sh
PATH=$PATH:/usr/sbin
# Arquivo com os ip's
arquivo=/etc/ip.log
# Limpa as regras anteriores! Segredinho...
iptables -t nat -F REDIRECIONAR
iptables -t nat -F BLOQUEAR
clear
if [ -r $arquivo ]; then
for lista in `cat $arquivo`; do
IP=`echo $lista`
iptables -t nat -A REDIRECIONAR -s $IP -d ! 192.168.0.1 -p tcp --dport 80 \
-j DNAT --to-destination 192.168.0.1:80
iptables -t nat -A BLOQUEAR -s $IP -d ! 192.168.0.1 -p tcp --dport ! 80:80 -j DROP
done
fi
1°
Editamos o arquivo /etc/rc.d/rc.inet e adicionamos:
# Criar regras para redirecionamento
iptables -t nat -N BLOQUEAR
iptables -t nat -N REDIRECIONAR
iptables -t nat -I PREROUTING -d ! 192.168.1.1 -p tcp --dport 80 -j REDIRECIONAR
iptables -t nat -I POSTROUTING -d ! 192.168.1.1 -p tcp --dport ! 80:81 -j BLOQUEAR
Configuring firewall rules...
Configuring custom firewall rules...
iptables: No chain/target/match by that name
iptables: No chain/target/match by that name
[H[JTry `iptables -h' or 'iptables --help' for more information.
Bad argument ` '
/etc/controle_usuario.sh: /etc/controle_usuario.sh: 20: -j: not found
iptables: No chain/target/match by that name
Configuring port forwarding for internal hosts...
Running Line UP Scripts...
Checking need for update...
Current IP...: x.x1.x2.x2
Old IP.......: x.x1.x2.x
The update of bqinvelox.no-ip.biz is not needed
bqinvelox# iptables -t nat -L -vnx
Chain PREROUTING (policy ACCEPT 57515 packets, 6288709 bytes)
pkts bytes target prot opt in out source destination
118131 14056754 nat-acl all -- * * 0.0.0.0/0 0.0.0.0/0
118131 14056754 dns-preroute all -- * * 0.0.0.0/0 0.0.0.0/0
118131 14056754 auto-forward all -- * * 0.0.0.0/0 0.0.0.0/0
57515 6288709 port-forward all -- * * 0.0.0.0/0 0.0.0.0/0
Chain POSTROUTING (policy ACCEPT 77761 packets, 9210398 bytes)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- * eth1 192.168.0.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.40.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.39.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.38.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.37.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.36.0/30 0.0.0.0/0
3897 186369 MASQUERADE all -- * ppp0 192.168.35.0/24 0.0.0.0/0
215 10304 MASQUERADE all -- * ppp0 192.168.34.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.33.0/30 0.0.0.0/0
1170 55237 MASQUERADE all -- * ppp0 192.168.32.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.31.0/30 0.0.0.0/0
1307 62300 MASQUERADE all -- * ppp0 192.168.30.0/30 0.0.0.0/0
183 8064 MASQUERADE all -- * ppp0 192.168.24.0/30 0.0.0.0/0
5 259 MASQUERADE all -- * ppp0 192.168.23.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.22.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.21.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.9.0/30 0.0.0.0/0
3143 228985 MASQUERADE all -- * ppp0 192.168.8.0/30 0.0.0.0/0
189 9055 MASQUERADE all -- * ppp0 192.168.7.0/30 0.0.0.0/0
6114 765628 MASQUERADE all -- * ppp0 192.168.6.0/30 0.0.0.0/0
226 10724 MASQUERADE all -- * ppp0 192.168.4.0/29 0.0.0.0/0
35061 4313209 MASQUERADE all -- * ppp0 192.168.1.0/29 0.0.0.0/0
77761 9210398 dns-postroute all -- * * 0.0.0.0/0 0.0.0.0/0
77761 9210398 nat-masks all -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 17137 packets, 1441985 bytes)
pkts bytes target prot opt in out source destination
Chain auto-forward (1 references)
pkts bytes target prot opt in out source destination
761 37125 DNAT tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:60000 to:192.168.1.2
59855 7730920 DNAT udp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:60000 to:192.168.1.2
Chain dns-postroute (1 references)
pkts bytes target prot opt in out source destination
Chain dns-preroute (1 references)
pkts bytes target prot opt in out source destination
Chain nat-acl (1 references)
pkts bytes target prot opt in out source destination
Chain nat-masks (1 references)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- * ppp0 192.168.0.0/30 0.0.0.0/0
Chain port-forward (1 references)
pkts bytes target prot opt in out source destination
bqinvelox# q
-sh: q: not found
bqinvelox# menu
BrazilFW Firewall and Router -- Configuration Menu
1) Edit main configuration file 2) Change system password
3) Edit rc.local script file 4) Custom firewall rules file
5) Edit firewall configuration 6) Edit port forward configuration
c) Show running configuration f) Reload firewall
r) Reboot system w) Write configuration to disk
q) Exit Menu l) Logout
----------------------------------------------------------------------------
Selection: q
Exiting menu. To return to the menu, simply type "menu" and
press enter from the command prompt.
bqinvelox# iptables -t nat -L -vnx
Chain PREROUTING (policy ACCEPT 57524 packets, 6290509 bytes)
pkts bytes target prot opt in out source destination
118234 14070711 nat-acl all -- * * 0.0.0.0/0 0.0.0.0/0
118234 14070711 dns-preroute all -- * * 0.0.0.0/0 0.0.0.0/0
118234 14070711 auto-forward all -- * * 0.0.0.0/0 0.0.0.0/0
57524 6290509 port-forward all -- * * 0.0.0.0/0 0.0.0.0/0
Chain POSTROUTING (policy ACCEPT 77889 packets, 9225411 bytes)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- * eth1 192.168.0.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.40.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.39.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.38.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.37.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.36.0/30 0.0.0.0/0
3897 186369 MASQUERADE all -- * ppp0 192.168.35.0/24 0.0.0.0/0
215 10304 MASQUERADE all -- * ppp0 192.168.34.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.33.0/30 0.0.0.0/0
1170 55237 MASQUERADE all -- * ppp0 192.168.32.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.31.0/30 0.0.0.0/0
1307 62300 MASQUERADE all -- * ppp0 192.168.30.0/30 0.0.0.0/0
183 8064 MASQUERADE all -- * ppp0 192.168.24.0/30 0.0.0.0/0
5 259 MASQUERADE all -- * ppp0 192.168.23.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.22.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.21.0/30 0.0.0.0/0
0 0 MASQUERADE all -- * ppp0 192.168.9.0/30 0.0.0.0/0
3143 228985 MASQUERADE all -- * ppp0 192.168.8.0/30 0.0.0.0/0
189 9055 MASQUERADE all -- * ppp0 192.168.7.0/30 0.0.0.0/0
6114 765628 MASQUERADE all -- * ppp0 192.168.6.0/30 0.0.0.0/0
226 10724 MASQUERADE all -- * ppp0 192.168.4.0/29 0.0.0.0/0
35064 4313353 MASQUERADE all -- * ppp0 192.168.1.0/29 0.0.0.0/0
77889 9225411 dns-postroute all -- * * 0.0.0.0/0 0.0.0.0/0
77889 9225411 nat-masks all -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 17171 packets, 1444841 bytes)
pkts bytes target prot opt in out source destination
Chain auto-forward (1 references)
pkts bytes target prot opt in out source destination
763 37237 DNAT tcp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:60000 to:192.168.1.2
59947 7742965 DNAT udp -- ppp0 * 0.0.0.0/0 0.0.0.0/0 udp dpt:60000 to:192.168.1.2
Chain dns-postroute (1 references)
pkts bytes target prot opt in out source destination
Chain dns-preroute (1 references)
pkts bytes target prot opt in out source destination
Chain nat-acl (1 references)
pkts bytes target prot opt in out source destination
Chain nat-masks (1 references)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- * ppp0 192.168.0.0/30 0.0.0.0/0
Chain port-forward (1 references)
pkts bytes target prot opt in out source destination
bqinvelox#
...
...
...
# Accept Established Connections
iptables -I INPUT -m state --state INVALID -j DROP
iptables -I INPUT -m state --state established,related -j ACCEPT
iptables -I FORWARD -m state --state INVALID -j DROP
iptables -I FORWARD -m state --state established,related -j ACCEPT
# Regras para redirecionamento
iptables -t nat -N BLOQUEAR
iptables -t nat -N REDIRECIONAR
iptables -t nat -I PREROUTING -d ! 192.168.0.1 -p tcp --dport 80 -j REDIRECIONAR
iptables -t nat -I POSTROUTING -d ! 192.168.0.1 -p tcp --dport ! 80 -j BLOQUEAR
# Bring up the loopback interface
ip link set lo up
ip addr add 127.0.0.1/8 dev lo
...
...
...
Voltar para BrazilFW 2.x - Ajuda em Geral (Todas as Línguas)
Usuários navegando neste fórum: Nenhum usuário registrado e 18 visitantes