Re: [squid-users] squid3 makes my users foreigners!

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 01 Aug 2012 15:01:00 +1200

On 01.08.2012 12:59, Andreas Westvik wrote:
> First post from a "long" time squid user
>
> So during the Olympics my national broadcaster has these free HD
> streaming channels on some webpage. (I'm norwegian - nrk.no) Now,
> when
> I route my LAN traffic through squid3, nrk.no thinks Im outside
> Europe
> - and thus denies me access to the streams.
>
> And as soon I turn http routing off via squid3, everything works like
> a charm and nrk.no thinks Im legit.
>
> Now, I have a few webservers running on my host as well so I turned
> on dns lookups in apache2.conf to see what kind of host apache sees
> when Im visiting my own server, and sure enough thats
> hostname-ip.no-address
>
> So what am I doing wrong here?

Nothing. It is "yet another website with broken security systems".

They get it wrong more often than not when they try to do geo-based
protection. In order of likelyhood for you...

  - detecting a proxied 192.168.* or 127.* IP and assuming its some
non-local country.

  This is the most common breakage.
  If your squid version supports advanced forwarded_for options, you can
try "forwarded_for delete" to avoid this. In absence of that
"http_request_access X-Forwarded-For deny all" does the same.

  - detecting the proxy IP instead of the client IP

   IF your clients have global-scope IP addresses (outside 192.168.*
etc) you might be able to use "forwarded_for on" to avoid this. Since
your localnet is 192.168.* that method will not work.

   This can also depends on your proxy being registered by a company
within the .no country (whis lookup on the proxy IP says NO country
code), and maybe also having accurate reverse-DNS to your .no domain
name (having this will also enable Squid-3 to perform automatic hostname
detection for itself).

   The test you did with Apache shows you do not have working
reverse-DNS.

  - rejecting all proxied traffic

   You can try setting "via off" and "forwarded_for off". Bad things to
disable - that will cause all your clients to look like one "user" and
be throttled as such by any download/webmail/media website which does
per-IP throttling or delivery control. But it is the only way to avoid
this type of geo-IP site brokenness. And for this case the site is
seriously broken, its worth complaining to them.

  - failing to detect IPv6 addresses when relayed to them over IPv4 via
a proxy

  Not the problem for you since you are using NAT which is IPv4-only.

... or it could be simply an incorrect Geo-IP database being used by
the site. Nothing you can do about that except complain to the website
people themselves.

Amos

>
> acl manager proto cache_object
> acl localhost src 127.0.0.1/32 ::1
> acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
> acl localnet src 192.168.0.0/16
> acl SSL_ports port 443
> acl Safe_ports port 80 # http
> acl Safe_ports port 21 # ftp
> acl Safe_ports port 443 # https
> 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
> http_access allow manager localhost
> http_access deny manager
> http_access deny !Safe_ports
> http_access deny CONNECT !SSL_ports
> http_access allow localnet
> http_access deny all
> http_port 3128 transparent
> hierarchy_stoplist cgi-bin ?
> cache_mem 512 MB
> maximum_object_size_in_memory 2 MB
> cache_dir ufs /var/spool/squid3 2048 16 256
> access_log /var/log/squid3/access.log squid
> coredump_dir /var/spool/squid3
> refresh_pattern ^ftp: 1440 20% 10080
> refresh_pattern ^gopher: 1440 0% 1440
> refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
> refresh_pattern . 0 20% 4320
> shutdown_lifetime 5 seconds
> always_direct allow all
> memory_pools on
> memory_pools_limit 100 MB
>
> iptables routing
>
> Original (not working)
>
> iptables -t nat -A PREROUTING -i eth3 -p tcp --dport 80 -j REDIRECT
> --to-port 3128
>
> Some new ones Im testing (Not working either, still getting blocked)
>
> iptables -t nat -A PREROUTING -i eth3 -p tcp -m tcp --dport 80 -j
> DNAT --to-destination 192.168.0.1:3128
> iptables -t nat -A PREROUTING -i eth4 -p tcp -m tcp --dport 80 -j
> REDIRECT --to-ports 3128
>
> eth3 = LAN
> eth4 = official "norwegian" ip.
>
> So why does nrk.no think Im a foreigner when I try to watch the
> olympics via squid3?
Received on Wed Aug 01 2012 - 03:01:05 MDT

This archive was generated by hypermail 2.2.0 : Wed Aug 01 2012 - 12:00:02 MDT