+ Responder ao Tópico



  1. #1

    Padrão Proxy Transparente no FreeBSD

    Olá galera, sou novo nesse fórum...
    Estou precisando montar urgente no meu serviço um proxy no FreeBSD com os seguintes serviços: Squid + IPFW. Preciso que esse proxy seja transparente. Já procurei em muito lugares na net e fiz alguns testes... mas tudo em vão. Alguém pode me ajudar dando uma boa dica?

  2. #2

    Padrão Re: Proxy Transparente no FreeBSD

    Olá JorgeAldo, já fiz isso. Já recompilei o kernel tbm.

  3. #3

    Padrão Re: Proxy Transparente no FreeBSD

    Então... já recompilei o kernel adicionando as seguintes linhas no arquivo:

    #Ativa o IPFW
    options IPFIREWALL

    #Ativa o log do ipfw através do syslog
    options IPFIREWALL_VERBOSE
    options IPFIREWALL_VERBOSE_LIMIT=100

    #Ativa o NAT
    options IPFIREWALL_FORWARD
    options IPFIREWALL_NAT
    options LIBALIAS

    #Ativa o redirecionamento de portas através do socket "divert"
    options IPDIVERT

    #Define a política aberta do firewall
    options IPFIREWALL_DEFAULT_TO_ACCEPT

    #Fazer o gerenciamento de controle de banda
    options DUMMYNET
    #Esta linha auxilia no funcionamento do Dummynet
    options HZ=1000

    Meu /etc/rc.conf está assim:hostname="proxy"
    keymap="br275.iso.acc.kbd"
    sshd_enable="YES"

    ifconfig_em1="inet xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx"
    ifconfig_em0="inet 192.168.255.1 netmask 255.255.255.128"
    defaultrouter="xxx.xxx.xxx.xxx"

    dumpdev="AUTO"

    keyrate="fast"
    gateway_enable="YES"

    kern_securelevel_enable="YES"
    kern_securelevel="-1"

    firewall_enable="YES"
    firewall_type="/etc/regras"
    natd_enable="YES"
    natd_interface="em1"
    natd_flags=""



    Meu arquivo /etc/regras está assim:

    add 00050 divert 8668 ip from any to any via em1
    add 00100 allow ip from any to any via lo0
    add 00101 fwd "meu ip externo",3128 tcp from 192.168.255.0/25 to any dst-port 80
    add 00200 deny ip from any to 127.0.0.0/8
    add 00300 deny ip from 127.0.0.0/8 to any
    add 65535 allow ip from any to any

    Meu arquivo squid.conf está assim:

    http_port 3128 transparent
    visible_hostname HeltonBarbosa

    hierarchy_stoplist cgi-bin ?
    acl QUERY urlpath_regex cgi-bin \?
    no_cache deny QUERY

    cache_mem 85 MB
    ipcache_size 2048
    fqdncache_size 2048
    cache_dir ufs /usr/local/etc/squid/cache 2000 32 512
    cache_access_log /usr/local/etc/squid/logs/access.log
    cache_mgr [email protected]
    #error-directory /usr/local/etc/squid/errors/English
    cache_effective_user squid
    cache_effective_group squid

    acl intranet src 192.168.255.0/25
    acl localhost src 127.0.0.1/32
    acl all src 0.0.0.0/0.0.0.0

    acl manager proto cache_object

    acl SSL_ports port 443
    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 #multilling http

    acl CONNECT method CONNECT

    httpd_accel_host virtual
    httpd_accel_port 80
    httpd_accel_with_proxy on
    httpd_accel_uses_host_header on

    http_access allow manager localhost
    http_access deny manager
    http_access deny !Safe_ports
    http_access deny CONNECT !SSL_ports
    http_access allow intranet
    http_access allow localhost
    http_access deny all
    http_reply_access allow all
    icp_access allow all



    Inicio o squid normal no sistema, porém, nas estações clientes não consigo navegar. Lembrando que testei uma máquina com XP na mesma faixa de ip da placa de rede interna do proxy.

  4. #4

    Cool Re: Proxy Transparente no FreeBSD

    Olá, consegui resolver o problema. No meu arquivo de configuração do kernel, havia algumas linhas desnecessários. Então recompilei novamente, porém, com as seguintes linhas no fim do arquivo:

    options IPFIREWALL
    options IPFIREWALL_DEFAULT_TO_ACCEPT
    options IPFIREWALL_VERBOSE
    options IPFIREWALL_VERBOSE_LIMIT=100
    options IPFIREWALL_FORWARD
    options IPDIVERT

    Depois disso, funcionou perfeitamente.
    Muito obrigado JorgeAldo por responder às minhas dúvidas.