Checkpassword using Squid auth helpers

"Adam Aube" <[email protected]> Fri, 13 Jun 2003 15:01:54 -0400
Newsgroups gmane.comp.djb.checkpassword
Message-ID <[email protected]>
We recently migrated our File Server to Windows 2000, and shortly thereafter
I setup Squid's NTLM authentication using Winbind to integrate with the new
server. I wanted to do the same thing with qmail, but I found NT-compatible
checkpassword programs lacking, so I decided to write my own.

Using Jos Backus' Perl checkpassword script as a starting point, I wrote a
script that calls Squid's basic auth Winbind helper to do the
authentication.

Users log in to the server with their full email address as the user name.
The checkpassword script breaks the email address down into user name and
domain name, then sends the user name and password to the Winbind helper.
The helper returns OK if auth succeeded and ERR if it failed. If the helper
returns OK, it sets /basedir/domain.name/user as the homedir and calls
qmail-pop3d.

It logs success, failure, and errors via Syslog (using the mail facility by
default). The sending of log messages is handled by a single subroutine, so
it should be relatively easy to replace Syslog with another logging
mechanism. The script has a debug mode to call it from the command line for
testing. It is also flexible - it will work with any of Squid's basic auth
helpers.

The only downside is that it only supports a single NT domain. The only good
way to implement multi-domain support (that I can think of) is take the
first 8 characters of the domain name and make it the NT domain. I didn't
need it for my environment anyway, so it's missing for now.

The script is available at http://www.firstindependent.net/chkpass.txt

Any suggestions for improving it would be appreciated.

Adam
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.237 / Virus Database: 115 - Release Date: 3/7/2001