[MASOCH-L] Squid com TProxy

Eduardo Schoedler eschoedler at viavale.com.br
Thu Feb 28 09:33:27 BRT 2008


Olá Guilherme!

Eu tentei com os 2 patches... os 2 dão vários erros.
O pessoal do tproxy me mandou mais um, mas também não estou conseguindo 
aplicar...
https://lists.balabit.hu/pipermail/tproxy/2007-December/000638.html

# cat squid-tproxy.patch | patch -p1
patching file src/comm.c
patch: **** malformed patch at line 7: {


Abraço!


--------------------------------------------------
From: "Guilherme de Freitas Figueiredo" <gui at maniacs.com.br>
Subject: Re: [MASOCH-L] Squid com TProxy

veja o link q te mandei, eh outro patch

com o link 1522 o patch funcionou nao usei o link 1581 nao, lembrando que
apliquei o patch em um squid baixado do source da árvore debian.

abraços!

Em 27/02/08, Eduardo Schoedler <eschoedler at viavale.com.br> escreveu:
>
> O kernel e o iptables já estão com o patch.
> Só o patch desse link que eu não consigo aplicar.
> Dá erro para caramba!
>
> Acabei de baixar os sources do squid-2.6.STABLE18... veja o que acontece
> quando tento aplicar o patch desse link que você passou:
>
> # cat squid-tproxy.diff | patch -p1
>
> patching file client_side.c
> Hunk #1 FAILED at 4822.
> 1 out of 1 hunk FAILED -- saving rejects to file client_side.c.rej
> patching file comm.c
> Hunk #3 succeeded at 227 (offset -24 lines).
> Hunk #4 succeeded at 377 (offset -58 lines).
> Hunk #5 succeeded at 944 (offset -58 lines).
> patching file defines.h
> patching file forward.c
> Hunk #1 FAILED at 524.
> Hunk #2 FAILED at 577.
> Hunk #3 FAILED at 626.
> Hunk #4 FAILED at 678.
> 4 out of 4 hunks FAILED -- saving rejects to file forward.c.rej
> patching file structs.h
> Hunk #1 FAILED at 895.
> 1 out of 1 hunk FAILED -- saving rejects to file structs.h.rej
> patching file tools.c
> Hunk #1 FAILED at 1364.
> 1 out of 1 hunk FAILED -- saving rejects to file tools.c.rej
>
>
> # pwd
> /usr/src/squid-2.6.STABLE18/src
>
>
> Você compilou com os erros mesmo ?
>
>
> Abraço!
>
> --------------------------------------------------
> From: "Guilherme de Freitas Figueiredo" <gui at maniacs.com.br>
> Subject: Re: [MASOCH-L] Squid com TProxy
>
> seguinte,
>
> acabei de fazer funcionar aqui usando squid-2.6.18 ( debian ) mais este
> patch
>
> http://www.squid-cache.org/bugs/attachment.cgi?id=1522
>
> kernel 2.6.22.15
>
> com as regras que passei antes
>
> abraços!
>
> Em 27/02/08, Eduardo Schoedler <eschoedler at viavale.com.br> escreveu:
> >
> > Eu baixei o conteúdo e aparentemente são idênticos.
> > O patch eu tentei aplicar no squid, não funcionou legal.
> >
> > Esse é o anexo do link do bug que enviei abaixo.
> >
> > Eu tentei aplicar no squid, não funcionou.
> > Veja:
> >
> > ===> Sources of squid-2.6.STABLE16
> >
> > # cat patch-tproxy-squid.diff | patch -p1
> > patching file client_side.c
> > Hunk #1 FAILED at 4822.
> > 1 out of 1 hunk FAILED -- saving rejects to file client_side.c.rej
> > patching file comm.c
> > Hunk #3 succeeded at 227 (offset -24 lines).
> > Hunk #4 succeeded at 377 (offset -58 lines).
> > Hunk #5 succeeded at 944 (offset -58 lines).
> > patching file defines.h
> > patching file forward.c
> > Hunk #1 FAILED at 524.
> > Hunk #2 FAILED at 577.
> > Hunk #3 FAILED at 626.
> > Hunk #4 FAILED at 678.
> > 4 out of 4 hunks FAILED -- saving rejects to file forward.c.rej
> > patching file structs.h
> > Hunk #1 FAILED at 895.
> > 1 out of 1 hunk FAILED -- saving rejects to file structs.h.rej
> > patching file tools.c
> > Hunk #1 FAILED at 1364.
> > 1 out of 1 hunk FAILED -- saving rejects to file tools.c.rej
> >
> > ===> Sources of squid-2.6.STABLE17
> >
> > # cat patch-tproxy-squid.diff | patch -p1
> > patching file client_side.c
> > Hunk #1 FAILED at 4822.
> > 1 out of 1 hunk FAILED -- saving rejects to file client_side.c.rej
> > patching file comm.c
> > Hunk #3 succeeded at 227 (offset -24 lines).
> > Hunk #4 succeeded at 377 (offset -58 lines).
> > Hunk #5 succeeded at 944 (offset -58 lines).
> > patching file defines.h
> > patching file forward.c
> > Hunk #1 FAILED at 524.
> > Hunk #2 FAILED at 577.
> > Hunk #3 FAILED at 626.
> > Hunk #4 FAILED at 678.
> > 4 out of 4 hunks FAILED -- saving rejects to file forward.c.rej
> > patching file structs.h
> > Hunk #1 FAILED at 895.
> > 1 out of 1 hunk FAILED -- saving rejects to file structs.h.rej
> > patching file tools.c
> > Hunk #1 FAILED at 1364.
> > 1 out of 1 hunk FAILED -- saving rejects to file tools.c.rej
> >
> >
> > ===> Sources of squid-2.6.STABLE18
> >
> > # cat patch-tproxy-squid.diff | patch -p1
> > patching file client_side.c
> > Hunk #1 FAILED at 4822.
> > 1 out of 1 hunk FAILED -- saving rejects to file client_side.c.rej
> > patching file comm.c
> > Hunk #3 succeeded at 227 (offset -24 lines).
> > Hunk #4 succeeded at 377 (offset -58 lines).
> > Hunk #5 succeeded at 944 (offset -58 lines).
> > patching file defines.h
> > patching file forward.c
> > Hunk #1 FAILED at 524.
> > Hunk #2 FAILED at 577.
> > Hunk #3 FAILED at 626.
> > Hunk #4 FAILED at 678.
> > 4 out of 4 hunks FAILED -- saving rejects to file forward.c.rej
> > patching file structs.h
> > Hunk #1 FAILED at 895.
> > 1 out of 1 hunk FAILED -- saving rejects to file structs.h.rej
> > patching file tools.c
> > Hunk #1 FAILED at 1364.
> > 1 out of 1 hunk FAILED -- saving rejects to file tools.c.rej
> >
> >
> >
> >
> >
> >
> > --------------------------------------------------
> > From: "Guilherme de Freitas Figueiredo" <gui at maniacs.com.br>
> > Subject: Re: [MASOCH-L] Squid com TProxy
> >
> > eu também encontrei este
> >
> > http://www.squid-cache.org/bugs/attachment.cgi?id=1581
> >
> >
> > Em 27/02/08, Eduardo Schoedler <eschoedler at viavale.com.br> escreveu:
> > >
> > > O pessoal do tproxy me sugeriu um patch para o squid:
> > > http://www.squid-cache.org/bugs/show_bug.cgi?id=2129
> > >
> > > Estou aplicando agora para ver o que acontece.
> > >
> > > Obrigado!
> > >
> > > Abraços.
> > >
> > >
> > >
> > > --------------------------------------------------
> > > From: "Guilherme de Freitas Figueiredo" <gui at maniacs.com.br>
> > > Subject: Re: [MASOCH-L] Squid com TProxy
> > >
> > > Eduardo, da uma olhadinha
> > >
> > > https://lists.balabit.hu/pipermail/tproxy/2007-December/000638.html
> > >
> > > Abraços!
> > >
> > > Em 27/02/08, Eduardo Schoedler <eschoedler at viavale.com.br> escreveu:
> > > >
> > > > Estou usando o kernel 2.6.22-r10 ... apliquei o patch tproxy-4.0.3no
> > > > kernel
> > > > e no iptables.
> > > > Porém, lendo o FAQ do Ming-Ching Tiew, ele diz que o tproxy que vem
> no
> > > > squid-2.6 e o antigo (tproxy2), e teria de aplicar outro patch para
> > > > funcionar com o tproxy-4.0.3 ... e não estou conseguindo localizar
> > esse
> > > > patch.
> > > >
> > > >
> > > > Abraço.
> > > >
> > > >
> > > > --------------------------------------------------
> > > > From: "Guilherme de Freitas Figueiredo" <gui at maniacs.com.br>
> > > > Subject: Re: [MASOCH-L] Squid com TProxy
> > > >
> > > > Quando usei o tproxy como bridge foi usando o tproxy2 com kernel
> > 2.6.18,
> > > > justamente como dito. Estou agora a testar o tproxy na versao 4.1com
> > o
> > > > kernel 2.6.24.3 da seguinte forma:
> > > >
> > > > cliente -> servidor-tproxy -> roteador -> internet
> > > >
> > > > com o kernel 2.6.18 eu garanto que funciona do jeito que descrevi as
> 2
> > > > maneiras.
> > > >
> > > > Em 27/02/08, Eduardo Schoedler <eschoedler at viavale.com.br> escreveu:
> > > > >
> > > > > Olá Guilherme!
> > > > >
> > > > > Eu fiz o que você me falou.
> > > > > Poderia me dizer qual a versão do tproxy que você utilizou?
> > > > > Existem 3 (retirado da FAQ do Ming-Ching Tiew da lista de
> discussão
> > do
> > > > > tproxy):
> > > > >
> > > > > "  (A) Version Tproxy2
> > > > >    =============
> > > > >    For kernel 2.6.18
> > > > >    URL: http://www.balabit.hu/downloads/files/tproxy/obsolete/
> > > > >
> > > > >    (B) Version Tproxy 4.0.x
> > > > >    ================
> > > > >     For kernel 2.6.22
> > > > >     URL: http://www.balabit.hu/downloads/files/tproxy/
> > > > >
> > > > >    (C) Version Tproxy-4.1.0
> > > > >    =================
> > > > >     For kernel 2.6.25
> > > > >     URL: The "official website" is for kernel <=2.6.24
> > > > >     http://people.netfilter.org/hidden/tproxy
> > > > >
> > > > >      but the actual version of tproxy 4.1 for 2.6.25 is here:
> > > > >      http://people.balabit.hu/panther/tproxy
> > > > >
> > > > >     The kernel patch might work with nearby kernel versions, for
> > > > example,
> > > > >     tproxy2 might work with kernel 2.6.19; however it will not
> work
> > > > >     will kernel 2.6.22 ( unless you port it )."
> > > > >
> > > > >
> > > > > Como você aplicou o patch ao iptables ? E ao squid ?
> > > > >
> > > > > Abraço!
> > > > >
> > > > > --------------------------------------------------
> > > > > From: "Guilherme de Freitas Figueiredo" <gui at maniacs.com.br>
> > > > >
> > > > > Subject: Re: [MASOCH-L] Squid com TProxy
> > > > >
> > > > > senhores,
> > > > >
> > > > > ja fiz funcionar das 2 formas...
> > > > >
> > > > > segue abaixo a estrutura
> > > > >
> > > > > cliente -> servidor -> tproxy ( br0 + ip ) -> roteador -> internet
> > > > >
> > > > > e tambem assim
> > > > >
> > > > > cliente -> servidor ( tproxy ) -> roteador -> internet
> > > > >
> > > > > segue também algumas opções que tem q ser vistas
> > > > >
> > > > > iptables -t tproxy -A PREROUTING -d ! 200.201.0.0/16 -p tcp
> --dport
> > 80
> > > > -j
> > > > > TPROXY --on-port 3128
> > > > > echo 1 > /proc/sys/net/ipv4/ip_nonlocal_bind
> > > > >
> > > > > Em 26/02/08, Eduardo Schoedler <eschoedler at viavale.com.br>
> escreveu:
> > > > > >
> > > > > > O problema é que devido a minha infra, eu teria de colocar esse
> > > linux
> > > > > como
> > > > > > bridge.
> > > > > > O pessoal do tproxy jura de pé junto que dá... rsrsrs... são não
> > > dizem
> > > > > > COMO.
> > > > > > =/
> > > > > >
> > > > > > Abraços!
> > > > > >
> > > > > >
> > > > > > --------------------------------------------------
> > > > > > From: "Marcone Drumond Jacob" <marconedj at gmail.com>
> > > > > >
> > > > > > Subject: Re: [MASOCH-L] Squid com TProxy
> > > > > >
> > > > > > Pessoal,
> > > > > >
> > > > > > ACHO que se os pacotes forem roteados através do linux funciona
> > > 100%.
> > > > > >
> > > > > >
> > > > > > Exemplo:
> > > > > >
> > > > > > cliente1----|
> > > > > > cliente2----|-----squid-t-proxy-----|roteador--------internet
> > > > > > cliente3----|
> > > > > > cliente4----|
> > > > > >
> > > > > > e NÃO
> > > > > >
> > > > > > cliente1----|
> > > > > > cliente2----|-----|linux
> > redirecionar-----|roteador--------internet
> > > > > > cliente3----|-----|squid-t-proxy--------|
> > > > > > cliente4----|
> > > > > >
> > > > > >
> > > > > > Usando via Bridge, vc tem que colocar a opção para o squid
> > utilizar
> > > 1
> > > > ip
> > > > > > da
> > > > > > máquina (Não sei pq).
> > > > > > tcp_outgoing_address 192.168.254.253 all
> > > > > >
> > > > > > OBS. De qualquer forma os pacotes tem que passar pelo
> > > > linux-squid-tproxy
> > > > > >
> > > > > > Gui (maniac) se estiver errado, por favor. !!!
> > > > > >
> > > > > > []'s
> > > > > > Marcone
> > > > > > ----- Original Message -----
> > > > > > From: "Rubens Marins" <rubens.marins at gmail.com>
> > > > > > To: "Mail Aid and Succor, On-line Comfort and Help"
> > > > > > <masoch-l at eng.registro.br>
> > > > > > Sent: Monday, February 25, 2008 8:46 PM
> > > > > > Subject: Re: [MASOCH-L] Squid com TProxy
> > > > > >
> > > > > >
> > > > > > Rapaz, eu tambem já tentei de tudo e nada, parece-me que o patch
> > > > > > funciona quando voce tem um router cisco e configura no cisco
> para
> > > > > > redirecionar os pacotes para o proxy transparente, neste caso o
> > > squid.
> > > > > >
> > > > > > Eu cheguei a esta conclusao depois de ver muitas listas somente
> > com
> > > > > > exemplos de config do cisco para isso, mais alguns tunnings no
> > linux
> > > ,
> > > > > > e tambem o fato de eu não conseguir com o linux  puro .
> > > > > >
> > > > > > Estou ansioso para ver se alguem na lista conseguiu com o linux
> > puro
> > > e
> > > > > > passe o bizu aqui. : )
> > > > > >
> > > > > > PS: Ainda não desisti, é que faltou tempo, caso eu veja que
> > > > > > orignalmente só com linux não vai, eu pretendo implementar isso,
> > mas
> > > > > > isso vai requerer um pouco mais de tempo meu.
> > > > > >
> > > > > >
> > > > > >
> > > > > > Em 25/02/08, Eduardo Schoedler<eschoedler at viavale.com.br>
> > escreveu:
> > > > > > > Senhores.
> > > > > > >
> > > > > > >  Já não sei mais o que fazer, pois já tentei de tudo.
> > > > > > >  Espero que alguém possa me ajudar!
> > > > > > >
> > > > > > >  Eu tenho um box linux (Gentoo) com 2 interfaces em bridge,
> > usando
> > > > IP
> > > > > > >  "válido" na bridge e rodando squid.
> > > > > > >
> > > > > > >  Eu abro 2 consoles e fico monitorando os arquivos de log
> > (access
> > > e
> > > > > > cache)
> > > > > > >  com tail -f .
> > > > > > >  De um outro computador, eu tento acessar... tudo funciona,
> > porém
> > > > nada
> > > > > > >  acontece (nenhuma linha de acesso aparece no access.log).
> > > > > > >
> > > > > > >
> > > > > > >  Já compilei o kernel com suporte TProxy, vejam:
> > > > > > >
> > > > > > >  ===> Kernel: Linux Kernel v2.6.22-gentoo-r9 Configuration
> > > > > > >
> > > > > > >  <*> Ethernet Bridge tables (ebtables) support
> > > > > > >  <*>   ebt: broute table support
> > > > > > >
> > > > > > >  [*] TCP/IP networking
> > > > > > >  [*]   IP: advanced router
> > > > > > >
> > > > > > >  <*> 802.1d Ethernet Bridging
> > > > > > >
> > > > > > >  --- Network packet filtering framework (Netfilter)
> > > > > > >  [*]   Bridged IP/ARP packets filtering
> > > > > > >
> > > > > > >  Core Netfilter Configuration  --->
> > > > > > >   <*> Netfilter connection tracking support
> > > > > > >
> > > > > > >  --- Netfilter Xtables support (required for ip_tables)
> > > > > > >  <*>   TPROXY target support
> > > > > > >  <*>   "connbytes" per-connection counter match support
> > > > > > >  <*>   "connmark" connection mark match support
> > > > > > >  <*>   "conntrack" connection tracking match support
> > > > > > >  <*>   "tproxy" match support
> > > > > > >  <*>   "state" match support
> > > > > > >  <*>   "layer7" match support
> > > > > > >
> > > > > > >  IP: Netfilter Configuration
> > > > > > >  <*> IP tables support (required for filtering/masq/NAT)
> > > > > > >  <*>   Transparent proxying
> > > > > > >  <*>   Full NAT
> > > > > > >
> > > > > > >
> > > > > > >  ===> Kernel compilado com Tproxy:
> > > > > > >
> > > > > > >  # dmesg | grep -i tproxy
> > > > > > >  IP_TPROXY: Transparent proxy support initialized, version
> 4.0.0
> > > > > > >  IP_TPROXY: Copyright (c) 2002-2007 BalaBit IT Ltd.
> > > > > > >
> > > > > > >
> > > > > > >  ===> Já configurei o kernel:
> > > > > > >
> > > > > > >  net.ipv4.ip_nonlocal_bind = 1
> > > > > > >  net.ipv4.ip_forward = 1
> > > > > > >
> > > > > > >
> > > > > > >  ===> Bridge configurada:
> > > > > > >
> > > > > > >  # brctl show
> > > > > > >  bridge name     bridge id               STP enabled
> > > interfaces
> > > > > > >  br0             8000.005004ee4b13       no              eth0
> > > > > > >
> > > > > > >      eth1
> > > > > > >
> > > > > > >
> > > > > > >  ===> No squid.conf:
> > > > > > >
> > > > > > >  tcp_outgoing_address 189.x.x.x
> > > > > > >  http_port 3128 tproxy transparent
> > > > > > >
> > > > > > >
> > > > > > >  ===> Regras que tentei (nenhuma funcionou):
> > > > > > >
> > > > > > >  (Retiradas de
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://fuzzylab00net.blog.dada.net/post/413913/Squid-2.6-+-tproxy-+-bridge-+-gentoo.html
> > > > > > )
> > > > > > >  ebtables -t broute -A BROUTING -p IPv4 --ip-protocol
> > > > > > > 6 --ip-destination-port
> > > > > > >  80 -j redirect --redirect-target ACCEPT
> > > > > > >  iptables -t tproxy -A PREROUTING -i br0 -p tcp --dport 80 -j
> > > > > > >  TPROXY --on-port 3128
> > > > > > >
> > > > > > >  (Retiradas de
> > > > > > >
> > > http://www.balabit.com/support/community/products/tproxy/README.txt
> > > > )
> > > > > > >  iptables -t nat -A PREROUTING -j DNAT --to 189.x.x.x:3128
> > > > > > >  iptables -t tproxy -A PREROUTING -j TPROXY --on-port 3128
> > > > > > >
> > > > > > >
> > > > > > >  A única forma que consegui fazer funcionar meu squid foi
> > setando
> > > o
> > > > > > > browser
> > > > > > >  para conectar a um servidor proxy... porém, no
> > > > > > > cache.logaparecem
> > > > as
> > > > > > >  seguintes linhas  (189.x.x.y é o ip do cliente):
> > > > > > >  2008/02/25 19:13:59| tproxy ip=189.x.x.y,0x1b5b16bd,port=0
> > ERROR
> > > > > ASSIGN
> > > > > > >
> > > > > > >
> > > > > > >  Abraço!
> >
> > __
> > masoch-l list
> > https://eng.registro.br/mailman/listinfo/masoch-l
> >
>
>
>
> --
> []s!
>
> --
> Guilherme de Freitas Figueiredo - gui at maniacs.com.br -
> http://gui.maniacs.com.br
> __
> masoch-l list
> https://eng.registro.br/mailman/listinfo/masoch-l
>
> __
> masoch-l list
> https://eng.registro.br/mailman/listinfo/masoch-l
>



-- 
[]s!

--
Guilherme de Freitas Figueiredo - gui at maniacs.com.br -
http://gui.maniacs.com.br
__
masoch-l list
https://eng.registro.br/mailman/listinfo/masoch-l 



More information about the masoch-l mailing list