Search squid archive

Re: help with squid redirectors

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

 



Osmany,

I can help you but I think it is better to do this off list.
You can send me to my private email
- the latest version of the script and
- the unedited relevant lines from access.log

Marcus


Osmany wrote:
thanks for the reply. Ok so now I've modified the script with your
suggestion and I get this in my access.log

http://dnl-16.geo.kaspersky.com/ftp://dnl-kaspersky.quimefa.cu:2122/Updates/.com/index/u0607g.xml.klz

I'm pretty sure this is not working for the clients. I'm looking for it
to return something like this:

http://dnl-16.geo.kaspersky.com/ftp://dnl-kaspersky.quimefa.cu:2122/Updates/index/u0607g.xml.klz


I've changed the script many time so that I can get what I want but I
had no success. can you please help me?

On Sun, 2011-03-13 at 21:27 -0300, Marcus Kool wrote:
Osmany,
look in access.log.
It should say what is happening:
I expect this:
...  TCP_MISS/301   GET http://kaspersky....
...  TCP_MISS/200   GET ftp://dnl-kaspersky.quimefa.cu:2122/Updates

and does the client use Squid for the ftp protocol ??

And the RE matches too many strings.
I recommend to rewrite it to something like this:

    if ($url =~ /^http:\/\/dnl.*\.kaspersky\.com\/(.*)/) {
       my $newurl;
       $newurl = "ftp:\/\/dnl-kaspersky\.quimefa\.cu\:2122\/Updates/$1";  # Note the $1
       print $X[0]." 301:$newurl\n";
    }

Marcus

Osmany wrote:
So finally this is what I have and it works perfectly. But I want to go
further than this. I want the clients to download what they've requested
from my local urls. For example...if a client wants to update their
Kaspersky antivirus and it requests for an internet update server, I
want it to actually get redirected to my ftp and download what it wants
from here. So far what I've accomplished is that any request gets
redirected to the specified url but it doesn't follow the path of the
file that the client requested.

#!/usr/bin/perl
BEGIN {$|=1}
while (<>) {
     @X = split;
     $url = $X[1];
   if ($url =~ /^http:\/\/(.*)kaspersky(.*)/) {
    print $X[0]." 301:ftp:\/\/dnl-kaspersky\.quimefa\.cu\:2122\/Updates
\n";
   }
   elsif ($url =~ /^http:\/\/(.*)update(.*)/) {
    print $X[0]." 301:http:\/\/windowsupdate\.quimefa\.cu\:8530\n";
   }
   else {
    print $X[0]."\n";
   }
}

Can anybody help me with this?









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

  Powered by Linux