[squid-users] help with acl order and deny_info pages

Marko Cupać marko.cupac at mimar.rs
Thu Sep 17 07:24:55 UTC 2015


On Thu, 17 Sep 2015 03:00:56 +1200
Amos Jeffries <squid3 at treenet.co.nz> wrote:

> On 17/09/2015 12:37 a.m., Marko Cupać wrote:
> > Hi,
> > 
> > I'm trying to setup squid in a way that it authenticates users via
> > kerberos and grants different levels of web access according to ldap
> > query of MS AD groups.After some trials and errors I have found acl
> > order which apparently does not trigger reauthentication (auth
> > dialogues in browsers although I don't even provide basic auth).
> 
> What makes you think browser dialog box has anything to do with Basic
> auth? All it means is that the browser does not know what credentials
> will work. The ones tried (if any) have been rejected with a challenge
> response (401/407) for valid ones. It may be the browser password
> manager.
> 
> If you are using only Kerberos auth then users enter their Kerberos
> username and password into the dialog to allow the browser to fetch
> the Kerberos token (or keytab entry) it needs to send to Squid.
> 
> 
> > Here's relevant part:
> > 
> > http_access deny !Safe_ports
> > http_access deny CONNECT !SSL_ports
> > http_access allow localhost manager
> > http_access deny manager
> > http_access deny to_localhost
> > # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
> > http_access deny !auth all
> > http_access allow !basic_domains !basic_extensions basic_users
> > http_reply_access allow !basic_mimetypes basic_users
> > http_access allow !advanced_domains !advanced_extensions
> > advanced_users http_access allow expert_users all
> > # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
> > http_access allow localhost
> > http_access deny all
> > 
> > I'd like to know which acl triggered the ban, so I've created custom
> > error page:
> > 
> > error_directory /usr/local/etc/squid/myerrors
> > deny_info ERR_BASIC_EXTENSION basic_extensions
> > 
> > The problem is that my custom error page does not trigger when I
> > expect it to (member of basic_users accessing URL with extension
> > listed in basic_extensions) - ERR_ACCESS_DENIED is triggered
> > instead. I guess this is because of last matching rule which is
> > http_access deny all.
> 
> Perhapse.
> 
> But, basic_extensions is never the last listed ACL in a denial rule.
> There is never a deny action associated with the ACL. That is why the
> deny_info response template is not being used.
> 
> > 
> > Is there another way how I can order acls so that I don't trigger
> > reauthentication while triggering deny_info?
> 
> Not without the ACL definition details.
> 
> Amos

Hi Amos,

thank you for looking into this. Here's complete squid.conf (I changed
just private details such as domain, DN, password etc. in
external_acl_type).

auth_param negotiate program /usr/local/libexec/squid/negotiate_kerberos_auth \
	-r -s GSS_C_NO_NAME
auth_param negotiate children 10 startup=2 idle=1
auth_param negotiate keep_alive on

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 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

# ldap query for group membership
external_acl_type adgroups ttl=60 children-startup=2 children-max=10 %LOGIN \
	/usr/local/libexec/squid/ext_ldap_group_acl -R \
	-b "DC=example,DC=org" \
	-D "CN=AD Query,OU=Users,OU=BG,OU=RS,DC=example,DC=org" \
	-w "mylongpassword" \
	-f "(&(objectclass=person)(sAMAccountName=%v)\
	    (memberof=CN=%a,OU=Web Services,OU=Groups,OU=BG,OU=RS,DC=example,DC=org))" \
	-h dc.example.org
# map ldap groups to squid acls
acl basic_users external adgroups squid_basic
acl advanced_users external adgroups squid_advanced
acl expert_users external adgroups squid_expert
# filter by dstdomain
acl basic_domains dstdomain "/usr/local/etc/squid/basic_domains"
acl advanced_domains dstdomain "/usr/local/etc/squid/advanced_domains"
# filter by extension
acl basic_extensions urlpath_regex -i "/usr/local/etc/squid/basic_extensions"
acl advanced_extensions urlpath_regex -i "/usr/local/etc/squid/advanced_extensions"
# require proxy authentication
acl auth proxy_auth REQUIRED

# custom error pages
deny_info ERR_BASIC_DOMAIN basic_domains
deny_info ERR_ADVANCED_DOMAIN advanced_domains
deny_info ERR_BASIC_EXTENSION basic_extensions
deny_info ERR_ADVANCED_EXTENSION advanced_extensions

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access deny to_localhost
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
http_access deny !auth all
http_access allow !basic_domains !basic_extensions basic_users
http_access allow !advanced_domains !advanced_extensions advanced_users
http_access allow expert_users all
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
http_access allow localhost
http_access deny all

ssl_bump splice localhost
ssl_bump bump all

error_directory /usr/local/etc/squid/myerrors

http_port 127.0.0.1:3128
http_port 10.20.0.13:8080 ssl-bump generate-host-certificates=on \
	dynamic_cert_mem_cache_size=4MB \
	cert=/usr/local/etc/squid/myCA.pem

sslcrtd_program /usr/local/libexec/squid/ssl_crtd -s /usr/local/etc/squid/ssl_db -M 4MB
sslcrtd_children 10 startup=2 idle=1
cache_dir ufs /var/squid/cache 13000 16 256
coredump_dir /var/squid/cache

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

icap_enable on
icap_send_client_ip on
icap_send_client_username on
icap_client_username_encode off
icap_client_username_header X-Authenticated-User
icap_preview_enable on
icap_preview_size 1024
icap_service service_req reqmod_precache bypass=0 icap://127.0.0.1:1344/squidclamav 
adaptation_access service_req allow all
icap_service service_resp respmod_precache bypass=0 icap://127.0.0.1:1344/squidclamav
adaptation_access service_resp allow all

-- 
Before enlightenment - chop wood, draw water.
After  enlightenment - chop wood, draw water.

Marko Cupać
https://www.mimar.rs/


More information about the squid-users mailing list