Re: [squid-users] Help about iptable squid

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 22 Apr 2010 21:49:13 +1200

kavin wrote:
> Dear All:
>
> iptables
> squid -v
> Squid Cache: Version 3.1.1
> configure options:
<snip>

> '--enable-err-language=Simplify_Chinese'

configure option --enable-err-language no longer exists.

> '--enable-default-err-language=Simplify_Chinese'

Language name "Simplify_Chinese" no longer exists.

Use "zh-cn" instead for Squid-3.1.
(Although zh-cn may be changed to the correct "zh-hans" shortly.)

> '--enable-baisc-auth-helpers=NCSA'

Spelling. "basic"

> '--enable-underscore'

Nasty option. Underscore characters are not valid on Internet traffic
and can confuse people about why they can reach a domain locally but not
remotely. Avoid whenever possible please.

> Why not Transparent proxy
>
> Help Me!

Your http_port needs the "intercept" flag to make it perform NAT lookups.

>
> Thanks!
>
> squid.conf
>
> acl manager proto cache_object
> acl localhost src 127.0.0.1/32
> acl localhost src ::1/128
> acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
> acl to_localhost dst ::1/128
>
> # Example rule allowing access from your local networks.
> # Adapt to list your (internal) IP networks from where browsing
> # should be allowed
> acl localnet src 192.168.2.100-192.168.2.200/32 # RFC1918 possible internal network
> #acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
> acl localnet src 192.168.3.100-192.168.3.200/32 # RFC1918 possible internal network
> acl localnet src fc00::/7 # RFC 4193 local private network range
> acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
>
> #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
>
> cache_effective_user squid
>
> cache_effective_group squid
>
> dns_nameservers 192.168.1.10
>
> dns_nameservers 168.95.1.1
>
> dns_nameservers 168.95.192.1
>
> dns_nameservers 211.72.67.226
>
> dns_nameservers 216.146.35.35
>
> dns_nameservers 216.146.36.36

Each entry of dns_nameservers replaces all previous instances. It's
configured once and takes a list of multiple nameservers.

Better solution is to use /etc/resolv.conf file so there is no
difference between Squid and admin test tools run on the box.

The bugs which broke resolv.conf in 2.6 and earlier are now gone. Squid
can now read resolv.conf and properly act on all the relevant options.

>
> ipcache_size 1024
>
> ipcache_low 90
>
> ipcache_high 95
>
> cache_mem 128 MB
>
> cache_access_log /var/log/squid/access.log
>
> cache_log /var/log/squid/cache.log
>
> cache_store_log /var/log/squid/store.log

Store log is mostly useless unless debugging. You can save yourself a
lot of Disk IO by removing it from the config.

>
> visible_hostname gw.efc.cory

Okay. but... always a but. I recommend making this a FQDN domain name
which people can trace back to you for reporting errors.

>
> cache_mgr kavin_at_everfocus.com.cn
>
>
> #
> # Recommended minimum Access Permission configuration:
> #
> # Only allow cachemgr access from localhost
> http_access allow manager localhost
> http_access deny manager
>
> # Deny requests to certain unsafe ports
> #http_access deny !Safe_ports
>
> # Deny CONNECT to other than secure SSL ports
> #http_access deny CONNECT !SSL_ports

Removal of basic security settings is a Bad Idea.

>
> # We strongly recommend the following be uncommented to protect innocent
> # web applications running on the proxy server who think the only
> # one who can access services on "localhost" is a local user
> #http_access deny to_localhost
>
> #
> # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
> #
>
> # Example rule allowing access from your local networks.
> # Adapt localnet in the ACL section to list your (internal) IP networks
> # from where browsing should be allowed
> http_access allow localnet
> http_access allow localhost
>
>
> allow_underscore on

See above mention with the configure option matching this.

> # And finally deny all other access to this proxy
> http_access deny all
>
> # Squid normally listens to port 3128
> http_port 3128

Adding "intercept" after the port number will enable traffic
interception from NAT.

NP: I also recommend using a port other than 3128 or 80 for receiving
the traffic. It's only needing access by the local machines firewall.
Bad things can happen when it's open for direct external access.

If you have a new enough Linux kernel the "tproxy" option may be used
instead to enable true proxy transparency. Different iptables config as
well.
see http://wiki.squid-cache.org/Feature/Tproxy4

>
> # We recommend you to use at least the following line.
> hierarchy_stoplist cgi-bin ?
>
> # Uncomment and adjust the following to add a disk cache directory.
> cache_dir ufs /var/squid/var/cache 4096 16 256
>
> # Leave coredumps in the first cache dir
> coredump_dir /var/squid/var/cache
>
> # Add any of your own refresh_pattern entries above these.
> 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
>
>
>
>
> ----- Original Message -----
> From: "Amos Jeffries" <squid3_at_treenet.co.nz>
> To: <squid-users_at_squid-cache.org>
> Sent: Thursday, April 22, 2010 1:27 PM
> Subject: Re: [squid-users] Help about iptable squid
>
>
>> kavin wrote:
>>> Dear All:
>>>
>>> Linux has three card:
>>> One is 192.168.1.250 (Internet) by 192.168.1.1
>>> The other two are: 192.168.2.1, 192.168.3.1
>>> Client: 192.168.2.100-192.168.2.200 / IP 192.168.3.100-192.168.3.200
>>>
>>> I have a few questions
>>> 1: I'm in the allocation of time, add squid --enable-underscore options
>>> But on a visit to the site is still has underlined
>> That made no sense at all.
>> Can you please describe the problem it another way?
>>
>>> 2: why Teamviever software from external links, always break, then cannot connect
>>> But, I have broken the network ,configuration files below
>> Again. Is that a question?
>>
>> Something called "teamviewer" does not work after you broke it?
>>
>> Please explain some more.
>>
>>
>> <snip>
>>> httpd_accel_host virtual
>>>
>> Squid 2.5 config. Please upgrade your software.
>>
>> 1) We have not supported 2.5 since more than 3 years now.
>>
>> 2) reverse proxy is quite difficult in that version.
>>

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.1
Received on Thu Apr 22 2010 - 09:49:43 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 22 2010 - 12:00:05 MDT