[squid-users] Squid Authenticators

From: Mike Diggins <diggins@dont-contact.us>
Date: Sat, 6 Apr 2002 14:09:23 -0500 (EST)

I use this little perl program I got off this list to authenticate my
users via Squid. It checks credentials against an NT domain first and a
old user database using ncsa_auth second. The third check is to a another
domain controller if the primary goes down.

Most of our users have migrated to the NT domain but some are still using
the old database (lep-db). I'd like to modify this script to log to a file
users that are still using the second authenticator. I though I could
simply open a file for append, then "print {file} $_" during the second
check as in:

add: open (OUTFILE, ">>$outfile") || die "Could not open $outfile file";
change: if ($ans =~ /^OK/) { print $ans; print OUTFILE $_; next; }

It doesn't seem to work well however. I don't know a lot about Perl
programming so I'm having trouble figuring out how to do this. Is there a
quick modification to this program that will do what I want?

#!/usr/bin/perl
use IPC::Open2;
open2(*read1,*write1,"/usr/local/squid/bin/smb_auth -W ap1 -U
192.168.226.16");
open2(*read2,*write2,"/usr/local/squid/bin/ncsa_auth
/usr/local/squid/bin/lep-db");
open2(*read3,*write3,"/usr/local/squid/bin/smb_auth -W ap1 -U
192.168.64.43");
select write1;
$|=1;
select write2;
$|=1;
select write3;
$|=1;
select STDOUT;
$|=1;
while(<>) {
  print write1 $_; $ans = <read1>;
  if ($ans =~ /^OK/) { print $ans; next; }
  print write2 $_; $ans = <read2>;
  if ($ans =~ /^OK/) { print $ans; next; }
  print write3 $_; $ans = <read3>;
  if ($ans =~ /^OK/) { print $ans; next; }
  print $ans;
}
Received on Sat Apr 06 2002 - 12:09:32 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:07:29 MST