[FUG-BR] Squid transparente com PF

2006-09-28 Por tôpico Rafael Faria
Olá novamente...

Estou tentando configurar um Squid transparente usando o PF.
Sempre consegui normamente trabalhar com o Squid transparente usando o
IPFW, porém, agora com o PF, não está tudo tão fácil.

Vamos lá ao que está acontecendo:

O squid está (aparentemente) funcionando normalmente. Se eu configuro
ele diretamente nos navegadores, tudo funciona OK. Fica localhost tb
está funcionando normal.

Porém, quando ativo as regras do PF para redirecionar o tráfego, eu
apenas recebo uma mensagem de acesso negado do squid. Mas não a mesma
mensagem de acesso negado quando o endereço não está em uma ACL, é uma
mensagem diferente, estranha. :/

Segue meu squid.conf:

---
http_port 3128
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 32 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 8192 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 256 KB
ipcache_size 2048
ipcache_low 80
ipcache_high 95
memory_replacement_policy lru
cache_dir ufs /usr/local/squid/cache 256 32 512
cache_access_log /usr/local/squid/logs/access.log
cache_log /usr/local/squid/logs/cache.log
cache_store_log /usr/local/squid/logs/store.log
mime_table /usr/local/etc/squid/mime.conf
pid_filename /var/run/squid.pid
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
request_header_max_size 20 KB
refresh_pattern ^ftp:   144020% 10080
refresh_pattern ^gopher:14400%  1440
refresh_pattern .   0   20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl Safe_ports port 80  # http
acl Safe_ports port 21  # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70  # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
follow_x_forwarded_for deny all
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
acl intranet src 172.18.9.0/24
http_access allow intranet
http_access deny all
http_reply_access allow all
icp_access allow all
httpd_accel_port 80
httpd_accel_with_proxy on
forwarded_for on
coredump_dir /usr/local/squid/cache
---


Segue meu pf.conf (só as linhas referentes ao squid):
---
rdr on $int_if inet proto tcp from any to any port www - 127.0.0.1 port 3128

# Squid Proxy
pass in  on $int_if proto tcp from any to 127.0.0.1 port www keep state
pass out on $ext_if proto tcp from any to any port www keep state
---


meu access.log
---
1158808928.069  0 172.18.9.2 TCP_DENIED/400 1441 GET
error:invalid-request - NONE/- text/html
1158808929.862  0 172.18.9.2 TCP_DENIED/400 1454 GET
error:invalid-request - NONE/- text/html
1158809077.025 16 172.18.9.2 TCP_MISS/200 514 GET
http://172.18.9.1/ - DIRECT/172.18.9.1 text/html
1158809078.675414 172.18.9.2 TCP_MISS/200 2754 GET
http://172.18.9.1/mrtg/ - DIRECT/172.18.9.1 text/html
---
A parte do TCP_DENIED é quando estava com o proxy transparente.


Algém já teve algum problema parecido?
Minhas versões: FreeBSD 6.2-PRERELEASE, Squid 2.6.3.

Se alguém tiver alguma idéia, eu agradeço.

Abraços

Rafael Henrique Faria
[EMAIL PROTECTED]
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


Re: [FUG-BR] Squid transparente com PF

2006-09-28 Por tôpico Thiago J. Ruiz
No port do squid quando vc dá um make install ele abre primeiro o make
config que é a configuraçao do que vc quer.. vc marcou a opção:

[ ] SQUID_PF  Enable transparent proxying with PF

dae crie uma tabela com os ips que vc quer e faça ao invez de any to any
no pf coloque assim:

table rede { 172.16.12.0/24 }

rdr on $int_if inet proto tcp from rede to any port http -
127.0.0.1 port 3128

abraço.




2006/9/28, Rafael Faria [EMAIL PROTECTED]:
 Olá novamente...

 Estou tentando configurar um Squid transparente usando o PF.
 Sempre consegui normamente trabalhar com o Squid transparente usando o
 IPFW, porém, agora com o PF, não está tudo tão fácil.

 Vamos lá ao que está acontecendo:

 O squid está (aparentemente) funcionando normalmente. Se eu configuro
 ele diretamente nos navegadores, tudo funciona OK. Fica localhost tb
 está funcionando normal.

 Porém, quando ativo as regras do PF para redirecionar o tráfego, eu
 apenas recebo uma mensagem de acesso negado do squid. Mas não a mesma
 mensagem de acesso negado quando o endereço não está em uma ACL, é uma
 mensagem diferente, estranha. :/

 Segue meu squid.conf:

 ---
 ---
 rdr on $int_if inet proto tcp from any to any port www - 127.0.0.1 port 3128

 # Squid Proxy
 pass in  on $int_if proto tcp from any to 127.0.0.1 port www keep state
 pass out on $ext_if proto tcp from any to any port www keep state
 ---


 meu access.log
 ---
 1158808928.069  0 172.18.9.2 TCP_DENIED/400 1441 GET
 error:invalid-request - NONE/- text/html
 1158808929.862  0 172.18.9.2 TCP_DENIED/400 1454 GET
 error:invalid-request - NONE/- text/html
 1158809077.025 16 172.18.9.2 TCP_MISS/200 514 GET
 http://172.18.9.1/ - DIRECT/172.18.9.1 text/html
 1158809078.675414 172.18.9.2 TCP_MISS/200 2754 GET
 http://172.18.9.1/mrtg/ - DIRECT/172.18.9.1 text/html
 ---
 A parte do TCP_DENIED é quando estava com o proxy transparente.


 Algém já teve algum problema parecido?
 Minhas versões: FreeBSD 6.2-PRERELEASE, Squid 2.6.3.

 Se alguém tiver alguma idéia, eu agradeço.

 Abraços

 Rafael Henrique Faria
 [EMAIL PROTECTED]
 -
 Histórico: http://www.fug.com.br/historico/html/freebsd/
 Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd



-- 
Thiago J. Ruiz
http://thiagoruiz.blogspot.com
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


Re: [FUG-BR] Squid transparente com PF

2006-09-28 Por tôpico Welkson Renny de Medeiros
Olá Rafael,


Você compilou o SQUID com suporte a proxy transparent com PF?

Veja no meu squid -v

[EMAIL PROTECTED]:/etc] # squid -v
Squid Cache: Version 2.5.STABLE14
configure options:  --enable-pf-transparent --enable-follow-x-forwarded-for 
 etc etc etc

Abraço,


-- 
Welkson Renny de Medeiros
Focus Automação Comercial
Desenvolvimento / Gerência de Redes
[EMAIL PROTECTED]

- Original Message - 
From: Rafael Faria [EMAIL PROTECTED]
To: Lista Brasileira de Discussão sobre FreeBSD (FUG-BR) 
freebsd@fug.com.br
Sent: Thursday, September 28, 2006 2:13 PM
Subject: [FUG-BR] Squid transparente com PF


Olá novamente...

Estou tentando configurar um Squid transparente usando o PF.
Sempre consegui normamente trabalhar com o Squid transparente usando o
IPFW, porém, agora com o PF, não está tudo tão fácil.

Vamos lá ao que está acontecendo:

O squid está (aparentemente) funcionando normalmente. Se eu configuro
ele diretamente nos navegadores, tudo funciona OK. Fica localhost tb
está funcionando normal.

Porém, quando ativo as regras do PF para redirecionar o tráfego, eu
apenas recebo uma mensagem de acesso negado do squid. Mas não a mesma
mensagem de acesso negado quando o endereço não está em uma ACL, é uma
mensagem diferente, estranha. :/

Segue meu squid.conf:

---
http_port 3128
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 32 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 8192 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 256 KB
ipcache_size 2048
ipcache_low 80
ipcache_high 95
memory_replacement_policy lru
cache_dir ufs /usr/local/squid/cache 256 32 512
cache_access_log /usr/local/squid/logs/access.log
cache_log /usr/local/squid/logs/cache.log
cache_store_log /usr/local/squid/logs/store.log
mime_table /usr/local/etc/squid/mime.conf
pid_filename /var/run/squid.pid
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
request_header_max_size 20 KB
refresh_pattern ^ftp:   144020% 10080
refresh_pattern ^gopher:14400%  1440
refresh_pattern .   0   20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563
acl Safe_ports port 80  # http
acl Safe_ports port 21  # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70  # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
follow_x_forwarded_for deny all
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
acl intranet src 172.18.9.0/24
http_access allow intranet
http_access deny all
http_reply_access allow all
icp_access allow all
httpd_accel_port 80
httpd_accel_with_proxy on
forwarded_for on
coredump_dir /usr/local/squid/cache
---


Segue meu pf.conf (só as linhas referentes ao squid):
---
rdr on $int_if inet proto tcp from any to any port www - 127.0.0.1 port 
3128

# Squid Proxy
pass in  on $int_if proto tcp from any to 127.0.0.1 port www keep state
pass out on $ext_if proto tcp from any to any port www keep state
---


meu access.log
---
1158808928.069  0 172.18.9.2 TCP_DENIED/400 1441 GET
error:invalid-request - NONE/- text/html
1158808929.862  0 172.18.9.2 TCP_DENIED/400 1454 GET
error:invalid-request - NONE/- text/html
1158809077.025 16 172.18.9.2 TCP_MISS/200 514 GET
http://172.18.9.1/ - DIRECT/172.18.9.1 text/html
1158809078.675414 172.18.9.2 TCP_MISS/200 2754 GET
http://172.18.9.1/mrtg/ - DIRECT/172.18.9.1 text/html
---
A parte do TCP_DENIED é quando estava com o proxy transparente.


Algém já teve algum problema parecido?
Minhas versões: FreeBSD 6.2-PRERELEASE, Squid 2.6.3.

Se alguém tiver alguma idéia, eu agradeço.

Abraços

Rafael Henrique Faria
[EMAIL PROTECTED]
-
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


Re: [FUG-BR] Squid transparente com PF

2006-09-28 Por tôpico Danilo Egea
no squid 2.6 as configuracoes de proxy tranparente sao
diferentes, basta apenas que se coloque a opcao
transparent na frente de http_port 3128


--- Rafael Faria [EMAIL PROTECTED] escreveu:

 Em 28/09/06, Welkson Renny de
 Medeiros[EMAIL PROTECTED] escreveu:
  Olá Rafael,
 
 
  Você compilou o SQUID com suporte a proxy
 transparent com PF?
 
 Então, eu ativei sim a opção para proxy transparente
 com o PF:
 
 papillon# squid -v
 Squid Cache: Version 2.6.STABLE3
 configure options: ... '--enable-arp-acl'
 '--enable-pf-transparent'
 '--enable-follow-x-forwarded-for' '--enable-kqueue'
 ... 'CC=cc'
 'CFLAGS=-O2 -pipe -march=pentium3' 'CPPFLAGS='
 'LDFLAGS='
 'build_alias=i386-portbld-freebsd6.2'
 'host_alias=i386-portbld-freebsd6.2'
 'target_alias=i386-portbld-freebsd6.2'
 papillon#
 
 E já vou proceder com a dica do Thiago, para ver o
 que acontece. :D
 -
 Histórico:
 http://www.fug.com.br/historico/html/freebsd/
 Sair da lista:
 https://www.fug.com.br/mailman/listinfo/freebsd
 


Insula T.I
[EMAIL PROTECTED]
www.insula.com.br
Blog- http://daniloegea.wordpress.com



___ 
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. 
Registre seu aparelho agora! 
http://br.mobile.yahoo.com/mailalertas/ 
 

-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


Re: [FUG-BR] Squid transparente com PF

2006-09-28 Por tôpico Nenhum _de_Nos
assim, aqui o squid funciona com:

squid.conf
http_port 127.0.0.1:3128 transparent

pf
rdr on $int_if proto tcp  from any to any port www -
127.0.0.1 port 3128

meu squid eh a mesma versao do seu :)

matheus

-- 
We will call you cygnus,
The God of balance you shall be
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


Re: [FUG-BR] Squid transparente com PF

2006-09-28 Por tôpico Welkson Renny de Medeiros
Tá explicado... squid 2.6 é bronca pra fazer proxy transparent... mudou 
algumas coisas...

Nesse link mostra como deve ficar o http_port:
http://www.rebit.com.br/2006/07/27/configurando-o-squid-26-como-proxy-transparente/

Mais informações sobre a mudança do 2.5 para 2.6 aqui:
http://www.squid-cache.org/Versions/v2/2.6/squid-2.6.STABLE1-RELEASENOTES.html#s2

Mas adianto que não consegui colocar pra funcionar... fiz tudo que foi 
indicado nos sites, e não
rodava... compilei o 2.5 rodou blz... se alguém da lista conseguiu fazer o 
squid 2.6 rodar
transparent com PF por favor poste o squid.conf, squid -v e pf.conf.

Abraço a todos.


-- 
Welkson Renny de Medeiros
Focus Automação Comercial
Desenvolvimento / Gerência de Redes
[EMAIL PROTECTED]



- Original Message - 
From: Rafael Faria [EMAIL PROTECTED]
To: Lista Brasileira de Discussão sobre FreeBSD (FUG-BR) 
freebsd@fug.com.br
Sent: Thursday, September 28, 2006 2:25 PM
Subject: Re: [FUG-BR] Squid transparente com PF


Em 28/09/06, Welkson Renny de Medeiros[EMAIL PROTECTED] 
escreveu:
 Olá Rafael,


 Você compilou o SQUID com suporte a proxy transparent com PF?

Então, eu ativei sim a opção para proxy transparente com o PF:

papillon# squid -v
Squid Cache: Version 2.6.STABLE3
configure options: ... '--enable-arp-acl' '--enable-pf-transparent'
'--enable-follow-x-forwarded-for' '--enable-kqueue' ... 'CC=cc'
'CFLAGS=-O2 -pipe -march=pentium3' 'CPPFLAGS=' 'LDFLAGS='
'build_alias=i386-portbld-freebsd6.2'
'host_alias=i386-portbld-freebsd6.2'
'target_alias=i386-portbld-freebsd6.2'
papillon#

E já vou proceder com a dica do Thiago, para ver o que acontece. :D
-
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


Re: [FUG-BR] Squid transparente com PF

2006-09-28 Por tôpico Matheus Lamberti
pf.conf
 rdr pass on $int_if proto tcp to port 80 - 127.0.0.1
port 3128

squid.conf
 http_port 127.0.0.1:3128 transparent

versões:
 FreeBSD 6.1-p7 + squid 2.6.3 (ainda tem um
dansguardian transparente para ajudar na historia)


 Você compilou o squid na mão, ou pelo ports?



Matheus Lamberti de Abreu
BSD UserID: 051370 / FUG ID: 388

Se a vida é regida por uma licença, esta é BSD.
Unix is very simple, but it takes a genius to understand the simplicity.
Unix is user friendly. It's just selective about who its friends are.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd