You are not logged in.

#1 2010-08-18 08:31:34

dcc24
Member
Registered: 2009-10-31
Posts: 732

Securing squid.conf

I'm using squid as a proxy server and I'd like to make sure only users defined in /etc/squid.passwd can use this service. Here's my squid.conf:

auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid.passwd
auth_param basic children 5
auth_param basic realm  My proxy-caching web server
auth_param basic credentialsttl 3 hours
auth_param basic casesensitive off
acl users proxy_auth REQUIRED
acl sectionx proxy_auth REQUIRED
http_access allow users
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl localnet src 10.0.0.0/8    # RFC1918 possible internal network
acl localnet src 172.16.0.0/12    # RFC1918 possible internal network
acl localnet src 192.168.0.0/16    # RFC1918 possible internal network
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
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 all
http_access allow manager localhost
#http_access deny manager
#http_access deny !Safe_ports
http_access allow !Safe_ports
http_access allow CONNECT SSL_ports
http_access allow localnet

#http_access deny all
icp_access allow localnet
#icp_access deny all
http_port xxx.xxx.xxx.xxx:yy

hierarchy_stoplist cgi-bin ?
cache_mem 64 MB
maximum_object_size 10 MB
access_log /var/log/squid/access.log squid
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
acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
visible_hostname myproxy
coredump_dir /var/cache/squid

forwarded_for off
tcp_outgoing_address xxx.xxx.xxx.xxx

header_access Proxy-Connection deny all
header_access X-Forwarded-For deny all
header_access Connection deny all
header_access Via deny all
header_access Cache-Control deny all
header_access Keep-Alive deny all

Is the above config secure? If not, what should I change?


It is better to keep your mouth shut and be thought a fool than to open it and remove all doubt. (Mark Twain)

My AUR packages

Offline

#2 2010-08-18 12:52:50

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: Securing squid.conf

Move all your http_access lines together, and finish with a DENY

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 all
http_access allow manager localhost
http_access allow !Safe_ports
http_access allow CONNECT SSL_ports
http_access allow localnet
http_access allow users
http_access deny

I've also found this to be useful (even on a strongly firewalled host -- long story for another thread):

acl safe_source src 192.168.0.0/16
acl safe_source src 172.16.0.0/12
acl safe_source src 10.0.0.0/8

Added above "localnets" http_access line:

http_access deny !safe_source

Last edited by fukawi2 (2010-08-18 12:55:20)

Offline

Board footer

Powered by FluxBB