How does one configure squid3 proxy to support http auth – quick and dirty

httphttp-authenticationPROXYsquid

I am interested in the the easiest solution, authentication doesn't actually have to even test user/pass pairs… it just has to do the http auth challenge. I am trying to test http auth on a proxy for a library that I am working on.

I have implemented a script that returns "ok" to use as my program, as in:

auth_param basic realm Squid proxy-caching web server auth_param basic
program /usr/local/bin/ok

squid dies, this is what shows up in my log:

2012/03/13 13:09:24| WARNING: basicauthenticator #1 (FD 12) exited
2012/03/13 13:09:24| WARNING: basicauthenticator #2 (FD 14) exited
2012/03/13 13:09:24| WARNING: basicauthenticator #3 (FD 16) exited
2012/03/13 13:09:24| WARNING: basicauthenticator #4 (FD 18) exited
2012/03/13 13:09:24| Too few basicauthenticator processes are running
2012/03/13 13:09:24| storeDirWriteCleanLogs: Starting...
2012/03/13 13:09:24|   Finished.  Wrote 0 entries.
2012/03/13 13:09:24|   Took 0.00 seconds (  0.00 entries/sec).
FATAL: The basicauthenticator helpers are crashing too rapidly, need help!

Squid Cache (Version 3.1.19): Terminated abnormally.
CPU Usage: 0.014 seconds = 0.008 user + 0.006 sys
Maximum Resident Size: 5709824 KB
Page faults with physical i/o: 0

there is a reference in the documentation that may be related, but I am not sure how to implement:

#   If you use an authenticator, make sure you have 1 acl of type
#   proxy_auth.

currently trying this:

http://www.cyberciti.biz/tips/linux-unix-squid-proxy-server-authentication.html

Best Answer

Something like this should work:

acl example proxy_auth REQUIRED
http_access allow example

For consistency's sake this is a configuration you can use with LDAP:

auth_param basic program /usr/lib/squid/ldap_auth -ZZ -b "dc=example,dc=com" -f "(&(uid=%s)(!(gn=noaccess))(!(cn=noaccess)))" -h ldap.example.org -v 3
acl ldap proxy_auth REQUIRED
http_access allow ldap
http_access deny all

What it does is it will try to authenticate the user with uid against LDAP server ldap.example.org (preferably use an IP address), and it will not allow access when gn equals "noaccess" OR cn equals "noaccess".

It will deny access to everything else.