Search squid archive

Digest auth trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

There are problems at use digest-auth by means of a perl-script
which takes data of users from a database postgresql. With periodicity of
the order of 40 minutes squid is core dumped. In logs (with
debug_options ALL, 9):

/var/messages

Aug  7 08:40:06 proxy kernel: pid 44537 (squid), uid 100: exited on signal 6 (core
dumped)
Aug  7 08:40:06 proxy squid[625]: Squid Parent: child process 44537 exited due to s
ignal 6
Aug  7 08:40:09 proxy squid[625]: Squid Parent: child process 46666 started

cache.log

2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: Creation time: 1186457467
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: nonce entry  : 0xb3913c0
'V+a3RsATOQua1Bg6'
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: Creation time: 1186457175
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: nonce entry  : 0xb4dd2c0
'2ea3RsDSTQuk9SQ8'
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: Creation time: 1186457305
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: nonce entry  : 0xb8d4580
'1ee3RoBFjQsWFJQP'
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: Creation time: 1186457557
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: nonce entry  : 0xb3db300
'iOa3RgCzPQsMiFoa'
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: Creation time: 1186457224
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: nonce entry  : 0xb38e840
'R+a3RkDoOAvkGp5K'
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: Creation time: 1186457159
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: nonce entry  : 0xa0ea040
'5eG3'
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: Creation time: 1186456037
2007/08/07 08:40:04| authDigestNonceIsStale: Nonce is too old. 1186456037 1800 1186
458004
2007/08/07 08:40:04| authenticateDigestNonceCacheCleanup: Removing nonce 5eG3 from
cache due to timeout.
2007/08/07 08:40:09| fd_open FD 4 /cache/logs/cache.log
2007/08/07 08:40:09| Starting Squid Cache version 2.6.STABLE13 for i386-portbld-fre
ebsd6.2...
2007/08/07 08:40:09| Process ID 46666

In squid.conf section of a digest auth:

auth_param digest program /usr/local/squidguardian/sqpg_authd.pl
auth_param digest children 10
auth_param digest realm Squid proxy-caching web server

Perl-script:

#!/usr/bin/perl -w
use strict;
use DBI;
use Digest::MD5 qw(md5_hex);
use Fcntl qw(:flock);
use POSIX qw(strftime);

$0='squidPGAuthd';
$|=1;

my $dbname = "squid";
my $dbuser = "squid";
my $dbpasswd = "squid";
my $log_file = '/cache/logs/sqpg_authd.log';
my ($squser, $sq_user, $realm, $hash);

my $dbh = DBI->connect("dbi:Pg:dbname=$dbname", "$dbuser", "$dbpasswd");
if ($log_file) { &open_log }
while (<STDIN>) {
if ($log_file) { &write_log($_) }
    chomp;
    ($squser, $realm) = split /\:/; $squser =~ s/\"//g; $realm =~ s/\"//g;
    if ( $squser && $realm ) {
    $sq_user = $dbh->selectrow_hashref("select login, password from sq_users where login = '$squser'");
    if ( ($sq_user->{login} && $sq_user->{password}) && ($sq_user->{login} eq $squser) ) {
    $hash = $sq_user->{login}.':'.$realm.':'.$sq_user->{password}; 
    $hash = md5_hex($hash);
    print "$hash\n" 
    }
    else { print "ERR\n" }
    }
}
$dbh->disconnect;
if ($log_file) { &close_log }

sub open_log {
    open(LOG, ">>$log_file") or die "squidPGAuthd - can't open/create log file";
    select((select(LOG), $|=1)[0]);
}

sub write_log { 
    my $message = shift; my $date=strftime("%d-%h-%Y %H:%M:%S", localtime);
    flock(LOG, LOCK_EX);
    print LOG "$date $message";
    flock(LOG, LOCK_UN);
}

sub close_log { close(LOG) }

In that reason? Where I am mistaken?

-- 
WBR
 Sergey Svyatkin                          mailto:shrdlu@xxxxxxx


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux