Re: Squid authentication

From: Skylar Thompson (skylar_at_os2.dhs.org)
Date: 07/07/04


Date: Wed, 07 Jul 2004 15:59:58 GMT

On 6 Jul 2004 12:13:58 -0700, Fabricio Greco <fabricio.greco@edag.com.br> wrote:
> Hello Guys,
> I am user of Squid2.2 and I have setup it to work with ncsa
> authentication schema. Now I would like to change it, I donīt what the
> user type a login and password to access the internet, I want to
> validate the user through the login that he or she is using on the
> Windows and Unix systems. At my Company we have a mixed enviroment
> with UNIX-Solaris and PC-W2k systems.
> I donīt want the user spend his or her time trying to store another
> login/password.
> I was trying to setup the acl ident in squid , but I was not
> successuful.
> Please, can anyone give me any idea to setup it?

We use a Python script that queries our IMAP server to get its
authentication info. Works great for us.

Here the entries in our squid.conf for authentication:

===

auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic program /usr/local/bin/squidauth.py

===

And here's the script we use:

===

#!/usr/bin/env python

from imaplib import IMAP4
import sys

#IMAP server against which we authenticate
server="imap.cs.earlham.edu"
#Port number for IMAP server. Usually 143
port=143

#Below here you shouldn't need to edit anything

while 1:

        #Read user and password from stdin, remove the newline, split at the space
        #and assign to the user and password variables

        line=sys.stdin.readline()[:-1]
        [user,password]=line.split(' ')

        #Connect to the IMAP server

        p=IMAP4(server,port)

        #Try to authenticate. If it doesn't work, it throws an exception

        try:
                p.login(user,password)
        except:

                #If it threw an exception, log in cache.log the auth booboo
                sys.stderr.write("ERR authenticating %s\n"%user)
                #Then deny access
                sys.stdout.write("ERR\n")
                #IMPORTANT!!!!!!!!!!!! Flush stdout
                sys.stdout.flush()
                continue

        #If it didn't throw exceptions, that means it authenticated

        #Log success to cache.log
        sys.stderr.write("OK authenticated %s\n"%user)
        #Then allow access
        sys.stdout.write("OK\n")
        sys.stdout.flush()

===

You'll just have to change the IMAP server to your own IMAP server, and
you're good to go.

-- 
-- Skylar Thompson (skylar@cs.earlham.edu)
-- http://www.cs.earlham.edu/~skylar/


Relevant Pages

  • RE: [fw-wiz] Locking down public wireless access
    ... The authentication is web-based using https. ... We don't encrypt anything because we didn't feel that protecting the ... Current problems with unrestricted access ... floating on the net about how to achieve this sort of setup, ...
    (Firewall-Wizards)
  • Re: Need help securing SFTP inbound (virtual root equivalent)
    ... "ron" schreef in bericht ... > Installed Openssl and ssh and have setup public key authentication. ... > Looking to automate an inbound file transfer using SFTP. ...
    (comp.unix.aix)
  • Re: Secure Server & Services
    ... You can setup a proxy and configure it to allow only ... authenticated users (Integrated authentication) to have access to the ... In this case if users are loged on to their computers as members ... of domain they will not be allowed access to the internet... ...
    (microsoft.public.windows.server.security)
  • Re: Wrong Logonserver users getting second site:
    ... people working when the wrong server was being used for authentication. ... second site for authentication, How can i test this and what could be ... run Dcdiag no errors, Sites & services is setup ...
    (microsoft.public.windows.server.active_directory)
  • Re: MOSS Hosting
    ... our setup is configured at the moment is that we configure their top ... problem as I see it is that the dedicated service is in our hosting AD ... MOSS server in our hosting domain. ... there someway this can be done using forms based authentication and ...
    (microsoft.public.sharepoint.portalserver)