[FUG-BR] ipfw

Celso Viana celso.vianna em gmail.com
Segunda Janeiro 14 22:23:16 BRST 2008


Em 14/01/08, Daemon br<unix.list at gmail.com> escreveu:
> Ok, obrigado Marcelo.
>
> é só uma máquina de teste, 3 pcs aqui...
>
> Peguei um exemplo legal, agora da para começar a se virar. (Com o tempo).
>
> IPF="ipfw -q add"
> ipfw -q -f flush
>
> #loopback
> $IPF 10 allow all from any to any via lo0
> $IPF 20 deny all from any to 127.0.0.0/8
> $IPF 30 deny all from 127.0.0.0/8 to any
> $IPF 40 deny tcp from any to any frag
>
> # statefull
> $IPF 50 check-state
> $IPF 60 allow tcp from any to any established
> $IPF 70 allow all from any to any out keep-state
> $IPF 80 allow icmp from any to any
>
> # open port ftp (20,21), ssh (22), mail (25)
> # http (80), dns (53) etc
> $IPF 130 allow tcp from any to any 22 in
> $IPF 140 allow tcp from any to any 22 out
> $IPF 150 allow tcp from any to any 25 in
> $IPF 160 allow tcp from any to any 25 out
> $IPF 170 allow udp from any to any 53 in
> $IPF 175 allow tcp from any to any 53 in
> $IPF 180 allow udp from any to any 53 out
> $IPF 185 allow tcp from any to any 53 out
> $IPF 200 allow tcp from any to any 80 in
> $IPF 210 allow tcp from any to any 80 out
>
> # deny and log everything
> $IPF 500 deny log all from any to any
>
> Não está navegando, mas faz parte... agora eu me viro.
>
> abraço
>
>
>
> Em 14/01/08, Marcelo de Souza Sant'Anna <marcelo.santanna at gmail.com>
> escreveu:
> >
> > Aconselho a mudar o seu esquema para o seguinte:
> >
> > 1 - Bloqueie tudo.
> > 2 - Defina uma macro com a sua rede interna.
> > 3 - Libere tudo o que vier pela sua interface interna através desta
> > macro.
> > 4 - Libere o que vier de qualquer um através da sua interface externa
> > para as portas 25 e 80.
> >
> > Se seguir esta ordem acho que resolverá seu problema.
> >
> > PS.: Não esqueça que tem que criar regras para o DNS também!!!
> >
> >
> > Marcelo de Souza Sant'Anna
> >
> > On Mon, 2008-01-14 at 18:49 -0200, Daemon br wrote:
> >
> > > Achei uns exemplos, já da para se virar.
> > >
> > > valeu..
> > >
> > >
> > > Em 14/01/08, Daemon br <unix.list at gmail.com> escreveu:
> > > >
> > > > isso...
> > > >
> > > > Em 14/01/08, Marcelo de Souza Sant'Anna <marcelo.santanna at gmail.com>
> > > > escreveu:
> > > >
> > > > > Pelo o que eu entendi você quer que seus usuários internos tenham
> > acesso
> > > > > a tudo do lado de fora, e os externos tenham acesso somente às
> > portas 25
> > > > >
> > > > > e 80. É isso?
> > > > >
> > > > >
> > > > > On Mon, 2008-01-14 at 18:23 -0200, Daemon br wrote:
> > > > >
> > > > > > Rede local, política fechada, rl0 = internet.
> > > > > >
> > > > > > Coisa simples, queria liberar somente a 25/80 (INPUT/rl0) na
> > internet,
> > > > > e na
> > > > > > rede local tudo.
> > > > > >
> > > > > > Em 14/01/08, Celso Viana <celso.vianna at gmail.com> escreveu:
> > > > > > >
> > > > > > > Em 14/01/08, Daemon br< unix.list at gmail.com> escreveu:
> > > > > > > > Pessoal estou engatinhando com o ipfw (coisa simples) ...
> > > > > > > >
> > > > > > > > Um exemplo:
> > > > > > > >
> > > > > > > > /sbin/ipfw -f flush
> > > > > > > > /sbin/ipfw add divert natd all from any to any via rl0
> > > > > > > > /sbin/ipfw add pass all from any to any
> > > > > > > >
> > > > > > > >
> > > > > > > > libera tudo (2 placas de rede), e navega normalmente mas um
> > > > > exemplo:
> > > > > > > >
> > > > > > > > /sbin/ipfw add pass all from any to any via rl1 (rede interna)
> > > > > > > >
> > > > > > > > Trava tudo (e para de navegar).. pq ?
> > > > > > > >
> > > > > > > >
> > > > > > > > Como funciona 2 interfaces no ipfw ? (INPUT)
> > > > > > > >
> > > > > > > > Como ficaria uma regra simples para liberar tudo na rede
> > interna e
> > > > > > > somente
> > > > > > > > algumas portas na rede externa, sem travar tudo...
> > > > > > > > Algo do tipo:
> > > > > > > >
> > > > > > > > Internet:
> > > > > > > > iptables -A INPUT -i eth0 -p tcp --dport 25 -j ACCEPT
> > > > > > > > iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
> > > > > > > >
> > > > > > > > local
> > > > > > > > iptables -A INPUT -i eth1 -j ACCEPT
> > > > > > > >
> > > > > > > > eu sei que é simples, mas é o primeiro empurrão..
> > > > > > > >
> > > > > > > > Estou um pouco perdido, com o "FORWARD" tb, e os números das
> > > > > regras.
> > > > > > > >
> > > > > > > > Fica complicado pq toda vez que altero uma regra trava tudo, e
> > > > > preciso
> > > > > > > fazer
> > > > > > > > uma ginástica para arrumar o monitor na máquina de testes...
> > > > > > > >
> > > > > > > > é até engraçado.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Att.
> > > > > > > > -------------------------
> > > > > > > > Histórico: http://www.fug.com.br/historico/html/freebsd/
> > > > > > > > Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
> > > > > > > >
> > > > > > >
> > > > > > > Quando você fala liberar/bloquear está se referindo à internet?
> > A
> > > > > > > política do seu firewall é "aberta" ou "fechada"? a interface
> > rl0 é
> > > > > a
> > > > > > > externa (ip real)?
> > > > > > >
> > > > > > > --
> > > > > > > Celso Vianna
> > > > > > > BSD User: 51318
> > > > > > > http://www.bsdcounter.org
> > > > > > >
> > > > > > > 63 8404-8559
> > > > > > > Palmas/TO
> > > > > > > -------------------------
> > > > > > > Histórico: http://www.fug.com.br/historico/html/freebsd/
> > > > > > > Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
> > > > > > >
> > > > > > -------------------------
> > > > > > Histórico: http://www.fug.com.br/historico/html/freebsd/
> > > > > > Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
> > > > >
> > > > > -------------------------
> > > > > Histórico: http://www.fug.com.br/historico/html/freebsd/
> > > > > Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
> > > > >
> > > > >
> > > > >
> > > >
> > > -------------------------
> > > Histórico: http://www.fug.com.br/historico/html/freebsd/
> > > Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
> >
> > -------------------------
> > Histórico: http://www.fug.com.br/historico/html/freebsd/
> > Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
> >
> >
> >
> -------------------------
> Histórico: http://www.fug.com.br/historico/html/freebsd/
> Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd
>

Veja esse doc.

https://freebsdbrasil.com.br/fbsdbr_files/File/public_docs/ipfw-howto.pdf

-- 
Celso Vianna
BSD User: 51318
http://www.bsdcounter.org

63 8404-8559
Palmas/TO


Mais detalhes sobre a lista de discussão freebsd