Re: [squid-users] Making a Squid Start Page

From: Chris Robertson <crobertson@dont-contact.us>
Date: Wed, 28 Nov 2007 12:45:09 -0900

Reid wrote:
> I am trying to create a start page so that Squid will display a disclaimer when clients login.
>
> I found the following script on a previous posting, and put it on my server:
>
> #!/usr/bin/perl
> $|=1;
> my %logged_in;
>
> while(<>) {
> if (!defined($logged_in{$_})) {
> $logged_in{$_} = 1;
> print "ERR\n";
> } else {
> print "OK\n";
> }
> }
>
>

This never "expires" sessions from the hash "logged_in". The following
hack would at least help there:

#!/usr/bin/perl
$|=1;
my %logged_in;
my $session_ttl = 3600;
my $time = time();

while(<>) {
  if ((!defined($logged_in{$_}) ||
      ($logged_in{$_} + $session_ttl > $time)) {
    $logged_in{$_} = $time;
    print "ERR\n";
  } else {
    print "OK\n";
  }
}

No promises that it won't set your hair on fire, or scratch your CD's, etc.

> I gave it proper permissions, and then put the following in my squid.conf:
>
>
> external_acl_type session negative_ttl=0 %LOGIN /usr/lib/squid/my_squid_session.pl
> acl session external session
> http_access deny !session
> deny_info http://##.##.##.##/startpage.php session
>
>
> Using this configuration, the script will redirect the client the first time logging in, but not
> again. Even 24 hours later and after deleting cookies, if I login again I am not redirected. I
> have to restart squid in order to get another redirect to take place.
>
> So I changed the first line to:
>
> external_acl_type session ttl=300 negative_ttl=0 %LOGIN /usr/lib/squid/my_squid_session.pl
>
> That doesn't seem to make a difference.
>
> Any ideas? I am trying to avoid using the "squid_session" helper because I get all sorts of errors
> when using it together with digest_authentication.
>

That's very odd. I have no insight here, I just find it odd.

> Thank you!
>

Chris
Received on Wed Nov 28 2007 - 14:45:17 MST

This archive was generated by hypermail pre-2.1.9 : Sat Dec 01 2007 - 12:00:03 MST