+ Responder ao Tópico



  1. #1

    Padrão Liberação de navegação por MAC

    Opa pessoal.
    Estou precisando de uma ajudinha... tenho um firewall aqui na empresa Debian.
    Preciso liberar de alguma forma a navegação de alguns MAC "por fora" do proxy, pois, não consigo configurar o proxy em alguns smarthphones. Então, teria que navegar normalmente sem utilização do proxy configurado. Pode ser por IP também, não necessáriamente por MAC. Minha policy no iptables é DROP. No resumo do firewall está para redirecionar todas as conexões da porta 80 para 3128, acredito que seja por aí a configuração, fazer com que a conexão de tal MAC ou IP não redirecione para porta 3128.

    Agradeço desde já a ajuda.

    Atenciosamente.

  2. #2

    Padrão Re: Liberação de navegação por MAC

    veja se ajuda
    Código :
    # smartphone do zé 192.168.1.50   
    $iptables -t nat -A PREROUTING -s 192.168.1.50 -d 0.0.0.0/0  -j ACCEPT

  3. #3

    Padrão Re: Liberação de navegação por MAC

    Valeu pela dica.

    Adicionei esta regra lá em etc/arno-iptables-firewall/custom-rules e não bombou, não sei se fiz algo de errado ou adicionei no local errado. Não sei se serve de ajuda, pois não mexo a muito tempo em Linux, mas aí vai algumas configurações que copiei.

    Arno's Iptables Firewall Script v1.8.8o
    -------------------------------------------------------------------------------
    Sanity checks passed...OK
    Stopping (user) plugins (if used)...
    Checking/probing Iptables modules:
    Module check done...
    Configuring /proc/.... settings:
    Enabling anti-spoof with rp_filter
    Enabling SYN-flood protection via SYN-cookies
    Disabling the logging of martians
    Disabling the acception of ICMP-redirect messages
    Setting the max. amount of simultaneous connections to 16384
    Setting default conntrack timeouts
    Enabling protection against source routed packets
    Enabling reduction of the DoS'ing ability
    Setting Default TTL=64
    Disabling ECN (Explicit Congestion Notification)
    Flushing route table
    /proc/ setup done...
    Setting up firewall chains
    Setting default INPUT/FORWARD policy to DROP
    Using loglevel "info" for syslogd

    Setting up firewall rules:
    -------------------------------------------------------------------------------
    Accepting packets from the local loopback device
    Enabling setting the maximum packet size via MSS
    Enabling mangling TOS
    Logging of stealth scans (nmap probes etc.) enabled
    Logging of packets with bad TCP-flags enabled
    Logging of INVALID TCP packets disabled
    Logging of INVALID UDP packets disabled
    Logging of INVALID ICMP packets disabled
    Logging of fragmented packets enabled
    Logging of access from reserved addresses enabled
    Setting up (antispoof) INTERNAL net(s): 10.1.1.0/24
    Reading custom rules from /etc/arno-iptables-firewall/custom-rules
    Checking for (user) plugins in /etc/arno-iptables-firewall/plugins...None found
    Setting up INPUT policy for the external net (INET):
    Logging of explicitly blocked hosts enabled
    Logging of denied local output connections enabled
    Packets will NOT be checked for private source addresses
    Allowing the whole world to connect to TCP port(s): 80 443 2631 22 3110 3007 80 98 5017 27001 5700 5704 5741 5744 7171 7172 8017 30007 3389 54925 54926 137 1011 8
    Allowing the whole world to connect to UDP port(s): 54925 443 80 3110 3007 2631 8098 5017 27001 5700 5704 5741 5744 7171 7172 8017 30007 54926 137
    Denying the whole world to send ICMP-requests(ping)
    Logging of dropped ICMP-request(ping) packets enabled
    Logging of dropped other ICMP packets enabled
    Logging of possible stealth scans enabled
    Logging of (other) connection attempts to PRIVILEGED TCP ports enabled
    Logging of (other) connection attempts to PRIVILEGED UDP ports enabled
    Logging of (other) connection attempts to UNPRIVILEGED TCP ports enabled
    Logging of (other) connection attempts to UNPRIVILEGED UDP ports enabled
    Logging of other IP protocols (non TCP/UDP/ICMP) connection attempts enabled
    Logging of ICMP flooding enabled
    Setting up OUTPUT policy for the external net (INET):
    Allowing all (other) ports/protocols
    Applying INET policy to external interface: eth1 (without an external subnet spe cified)
    Setting up INPUT policy for internal (LAN) interface(s): eth0
    Allowing ICMP-requests(ping)
    Allowing all (other) ports/protocols
    Setting up FORWARD policy for internal (LAN) interface(s): eth0
    Logging of denied LAN->INET FORWARD connections enabled
    Setting up LAN->INET policy:
    Allowing TCP port(s): 21 443 25 22 10118 3110 995 54925 54926 137 587 465 8245 110 1723 3007 3550 4550 27001 5700 5704 5741 5744 6550 80 2631 8098 1863 1867 6 891 6901 5017 7171 7172 8017 3389 30007 35300 5552 9100 9190
    Allowing UDP port(s): 53 443 3007 3110 8098 500 1863 1867 6891 6901 5002 27001 5700 5704 5741 5744 5017 7171 7172 8017 3389 5003 587 54925 54926 137 80 2631 1 10 30007 9100
    Allowing ICMP-requests(ping)
    Denying all (other) ports/protocols
    Enabling masquerading(NAT) via external interface(s): eth1
    Adding (internal) host(s): 10.1.1.0/24
    Forwarding(NAT) TCP port(s) 3389 to 10.1.1.3
    Redirecting all internal HTTP(port 80) traffic to proxy-port 3128
    Security is ENFORCED for external interface(s) in the FORWARD chain

    Mar 22 17:41:25 All firewall rules applied.

    ------

    ##SERVIDOR###
    iptables -t nat -A PREROUTING -p tcp -s 10.1.1.195/32 --dport 80 -j ACCEPT
    #iptables -t nat -A PREROUTING -p tcp -s 192.168.1.254/32 --dport 80 -j ACCEPT
    #iptables -t nat -A PREROUTING -p tcp -s 192.168.1.250/32 --dport 80 -j ACCEPT


    iptables -A FORWARD -s 10.1.1.0/24 -d 201.21.198.160 -j ACCEPT
    iptables -t nat -A PREROUTING -i eth0 -p tcp -d ! 200.201.0.0/16 --dport 80 -j REDIRECT --to-port 3128


    #iptables -t nat -A PREROUTING -p tcp --dport 80 -d ! 200.201.174.207 -j REDIRECT --to-port 3128
    #$IPTABLES -t nat -A POSTROUTING -d 200.201.173.68 -j ACCEPT
    #iptables -A FORWARD -d 200.201.174.0/24 -j ACCEPT
    #iptables -A FORWARD -d 200.201.173.0/24 -j ACCEPT
    #iptables -A FORWARD -s 192.168.1.250 -j ACCEPT
    #iptables -A FORWARD -s 192.168.0.47 -j ACCEPT
    iptables -A FORWARD -s 10.1.1.193 -j ACCEPT
    iptables -I FORWARD 1 -p tcp --dport 35108:35118 -j ACCEPT

    ------

    ### Portas q rodam o servidor
    http_port 3128
    ###
    ## Nome do servidor no squid
    visible_hostname srvltsp

    ## Tamanhos de arquivos salvos
    maximum_object_size_in_memory 64 KB
    maximum_object_size 512 MB
    minimum_object_size 0 KB

    ## Tenha no minimo o dobro livre de memória
    cache_mem 32 MB
    cache_swap_low 90
    cache_swap_high 95

    ## Configs de cache
    cache_effective_user proxy
    cache_effective_group proxy
    cache_dir ufs /var/log/squid 1024 16 256

    ## local salva logs
    cache_access_log /var/log/squid/access.log
    cache_log /var/log/squid/cache.log
    cache_store_log none

    ## Refresh
    refresh_pattern ^ftp: 15 20% 2280
    refresh_pattern ^gopher: 15 0% 2280
    refresh_pattern . 15 20% 2280

    ## Liberar acesso por horário

    #acl tempolivre MTWHF 12:00-13:00
    #acl manha time MTWHF 06:00-12-00
    #acl tarde time MTWHF 13:00-18:30

    acl ips_bloqueados src "/etc/squid/regras/ips_bloqueados"
    http_access deny ips_bloqueados

    acl liberados url_regex "/etc/squid/regras/liberados"
    http_access allow liberados

    acl ips_liberados src "/etc/squid/regras/ips_liberados"
    http_access allow ips_liberados

    acl bloqueados url_regex "/etc/squid/regras/bloqueados"
    http_access deny bloqueados

    auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd

    acl senha proxy_auth REQUIRED

    auth_param basic children 5

    Desde já agradeço a atenção.

    Luis.

  4. #4

    Padrão Re: Liberação de navegação por MAC

    Configurar o proxy no smart?
    Porque você não faz proxy transparente para não ter que configurar proxy nos navegadores?
    Acredito que seria mais viavel!

  5. #5

    Padrão Re: Liberação de navegação por MAC

    Desculpe minha ignorância sobre efetuar a cfg para proxy transparente, mas como eu poderia efetuar esta configuração? Seria algo a modificar no squid.conf? Ou modificar todas configurações?

    Se puderes me ajudar com esta configuração lhe agradeço muito.

    Atenciosamente,

    Luis.

  6. #6

    Padrão Re: Liberação de navegação por MAC

    Em primeiro lugar squal a versão do seu proxy?
    Em segundo, esta range de ip 200.201.0.0/16 e referente aos ips que seus clientes estão usando ou e os ips fornecidos pela sua operadora?
    Se este bloco for o fornecido pela sua operador, porque você esta fazendo um redirect? acredito que esteja fazendo no local errado!

  7. #7

    Padrão Re: Liberação de navegação por MAC

    1 - Onde que eu posso pegar a informação da versão do proxy?;
    2 - Este é o range de IP da operadora, pois o range de IP dos clients é 10.1.1.xxx;
    3 - O redirect é para todas conexões que passarem pela porta 80 serem redirecionadas para a porta do proxy, no caso 3128...está errado?

    Atenciosamente,

    Luis.


    UP__

    A VERSÃO É DO SQUID É 2.7...

    Eu adicionei uma regra lá no iptables e coloquei ao lado da porta do proxy no squid.conf "transparent" mas nao rolou...

    o que pode ser?
    Última edição por genarinho; 24-03-2011 às 12:09.

  8. #8

    Padrão Re: Liberação de navegação por MAC

    UPUPUP___

    Cara, seguinte.

    Configurei para proxy transparente e funcionou 50%. Porque 50%?

    Por causa do seguinte... eu tenho uma acl aqui que eu faço liberação de acesso por IP, tipo, não pode acessar twitter, facebook, terra, uol e etc, mas os IPS que estão nessa acl podem.

    Então o que acontece, os únicos locais que funcionou o proxy transparente, onde eu desconfigurei no browser o proxy, foram nesses terminais onde os ips estão incluídos nesta acl de liberação. O.O

    O que posso estar fazendo de errado?

    As Acl's de liberação e bloqueio são.

    acl ips_bloqueados src "/etc/squid/regras/ips_bloqueados"
    http_access deny ips_bloqueados

    acl liberados url_regex "/etc/squid/regras/liberados"
    http_access allow liberados

    acl ips_liberados src "/etc/squid/regras/ips_liberados"
    http_access allow ips_liberados

    acl bloqueados url_regex "/etc/squid/regras/bloqueados"
    http_access deny bloqueados

    auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd

    acl senha proxy_auth REQUIRED

    Atenciosamente ,

    Luis.

  9. #9

    Padrão Re: Liberação de navegação por MAC

    Sinto informar que seu redirect esta errado!
    Acredito que sua eth0 esta sendo usada com o link de sua operadora e a eth1 com seus clientes! então porque vc esta fazendo um redirect informando que vai redirecionar todo o trafego da 80 para 3128 na eth0 menos a range de ip 200.201.0.0/16
    Penssa ai mais um pouco!
    Última edição por tianguapontocom; 24-03-2011 às 15:36.

  10. #10

    Padrão Re: Liberação de navegação por MAC

    Velho eu vo fica louco u.u eahuiheuoia

    Vo postar minhas regras aqui só pra você ver se pode me dar alguma dica mais, porque eu não sei mais o que fazer.. u.u


    # Put any custom (iptables) rules here down below:
    ##################################################


    ##SERVIDOR###
    iptables -t nat -A PREROUTING -p tcp -s 10.1.1.195/32 --dport 80 -j ACCEPT
    #iptables -t nat -A PREROUTING -p tcp -s 192.168.1.254/32 --dport 80 -j ACCEPT
    #iptables -t nat -A PREROUTING -p tcp -s 192.168.1.250/32 --dport 80 -j ACCEPT

    iptables -t nat -A PREROUTING -s 10.1.1.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
    iptables -A FORWARD -s 10.1.1.0/24 -d 201.21.198.160 -j ACCEPT
    iptables -t nat -A PREROUTING -i eth0 -p tcp -d ! 200.201.0.0/16 --dport 80 -j REDIRECT --to-port 3128


    #iptables -t nat -A PREROUTING -p tcp --dport 80 -d ! 200.201.174.207 -j REDIRECT --to-port 3128
    #$IPTABLES -t nat -A POSTROUTING -d 200.201.173.68 -j ACCEPT
    #iptables -A FORWARD -d 200.201.174.0/24 -j ACCEPT
    #iptables -A FORWARD -d 200.201.173.0/24 -j ACCEPT
    #iptables -A FORWARD -s 192.168.1.250 -j ACCEPT
    #iptables -A FORWARD -s 192.168.0.47 -j ACCEPT
    iptables -A FORWARD -s 10.1.1.193 -j ACCEPT
    iptables -I FORWARD 1 -p tcp --dport 35108:35118 -j ACCEPT

    A parte que está em negrito foi a que adicionei..

    Desde já agradeço.

    Atenciosamente, Luis.

  11. #11

    Padrão Re: Liberação de navegação por MAC

    Retira isso:
    Código :
    [B]iptables -t nat -A PREROUTING -s 10.1.1.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128[/B]
    iptables -A FORWARD -s 10.1.1.0/24 -d 201.21.198.160 -j ACCEPT
    iptables -t nat -A PREROUTING -i eth0 -p tcp -d ! 200.201.0.0/16 --dport 80 -j REDIRECT --to-port 3128
    Coloca isso
    Código :
    iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
    Ve se resolve! o Ideal era reformular suas regras!

  12. #12

    Padrão Re: Liberação de navegação por MAC

    Ok cara... vou testar aqui e qualquer coisa posto denovo!

    Valeu pela força!

    Luis.

  13. #13

  14. #14

    Padrão Re: Liberação de navegação por MAC

    Ou serviu ou caiu de vez hehehehe