Add support for IPCOP – Advanced Proxy – Update Accelerator to cache Antivirus ESET Nod32 update files

I’ve been digging and foraging for infos about this one. The author of this ipcop great plugin, stated in the FAQ that it is possible to add custom rules for Update Accelerator, but can’t seem to find the guide anywhere.

Here are my findings so far :

Simply edit this file in your IPCOP box:

/usr/sbin/updxlrator

and you will find these lines :

while (<>) {

    $request=$_;

    @tmp=split(/ /,$request);
    chomp(@tmp);

    $source_url = $tmp[0];
    $hostaddr   = $tmp[1]; while ($hostaddr =~ /.*\/$/) { chop $hostaddr; }
    $username   = $tmp[2]; if ($username eq ”) { $username=’-‘; };
    $method     = $tmp[3];

    $xlrator_url = $source_url;

    if (($method eq ‘GET’) || ($method eq ‘HEAD’))
    {

    # ———————————————————–
    #  Section: Windows Update / Windows Downloads
    # ———————————————————–

    if (
        (($source_url =~ m@^http://[^/]*\.microsoft\.com/.*\.(exe|psf|msi|msp|cab)$@i) ||
         ($source_url =~ m@^http://[^/]*\.windowsupdate\.com/.*\.(exe|psf|msi|msp|cab)$@i))
    &&   ($source_url !~ m@^http://[^/]*\.microsoft\.com/.*(/autoupd|selfupdate/).*\.cab@i)
    &&   ($source_url !~ m@\&@)
       )
    {
        $xlrator_url = &check_cache($source_url,$hostaddr,$username,”Microsoft”,$unique);
    }

    # ———————————————————–
    #  Section: Adobe Downloads
    # ———————————————————–

    if (
        ($source_url =~ m@^http://(ar)?download\.adobe\.com/.*\.(exe|msi|bin|dmg|idx|gz)$@i) ||
        ($source_url =~ m@^http://swupdl\.adobe\.com/updates/.*\.(exe|msi|bin|dmg|idx|gz|[a-z][a-z]_[A-Z][A-Z])$@i) ||
        ($source_url =~ m@^http://swupmf\.adobe\.com/manifest/.*\.upd$@i)
       )
    {
        $xlrator_url = &check_cache($source_url,$hostaddr,$username,”Adobe”,$unique);
    }

    # ———————————————————–
    #  Section: Linux Downloads
    # ———————————————————–

    if ($source_url =~ m@^[h|f]t?tp://[^?]+\.(deb|rpm)$@i)
    {
        $xlrator_url = &check_cache($source_url,$hostaddr,$username,”Linux”,$mirror);
    }

    # ———————————————————–
    #  Section: Trend Micro Downloads
    # ———————————————————–

    if (
        ($source_url =~ m@^http://[^/]*\.trendmicro\.com/activeupdate/.*@i) &&
        ($source_url !~ m@.*/tmnotify\.dat$@i) &&
        ($source_url !~ m@.*/ini_xml\.zip$@i) &&
        ($source_url !~ m@.*/server\.ini$@i)
       )
    {
        $xlrator_url = &check_cache($source_url,$hostaddr,$username,”TrendMicro”,$mirror);
    }

    # ———————————————————–
    #  Section: Symantec Downloads
    # ———————————————————–

    if ($source_url =~ m@^[h|f]tt?p://[^/]*\.symantec(liveupdate)?\.com/.*\.(exe|zip|vdb|xdb)$@i)
    {
        $xlrator_url = &check_cache($source_url,$hostaddr,$username,”Symantec”,$unique);
    }

    # ———————————————————–
    #  Section: Apple Downloads
    # ———————————————————–

    if (
        (($source_url =~ m@^http://swcdn\.apple\.com/content/downloads/.*\.(tar)$@i) ||
         ($source_url =~ m@^http://appldnld\.apple\.com\.edgesuite\.net/.*\.(exe|dmg)$@i) ||
         ($source_url =~ m@^http://.*\.g.akamai.net/.*/3093/1/.*\.(tar|pkg|dmg|exe)$@i))
       )
    {
        $xlrator_url = &check_cache($source_url,$hostaddr,$username,”Apple”,$unique);
    }

    # ———————————————————–
    #  Section: Avast Downloads
    # ———————————————————–

    if ($source_url =~ m@^http://download[\d]+\.avast\.com/.*\.(exe|vpu)$@i)
    {
        $xlrator_url = &check_cache($source_url,$hostaddr,$username,”Avast”,$mirror);
    }
   

    # ———————————————————–

    }

Simply add these lines, just below the Avast section:

    # ———————————————————–

    #  Section: NOD Downloads

    # ———————————————————–

    if ($source_url =~ m@^[h|f]t?tp://[^?]+\.(nup|ver|)$@i)

    {

        $xlrator_url = &check_cache($source_url,$hostaddr,$username,”Other”,$mirror);

    }

I’m using the Linux section as the template, which is the easiest template compare to others. What do those line mean?

$source_url =~ m@^[h|f]t?tp://[^?]+\.(nup|ver|)$@i)

translate: UA should cache  nup and ver files…

$source_url =~ m@^[h|f]t?tp://[^?]+\.(nup|ver|)$@i)

translate: and the URLS could be anywhere

$source_url =~ m@^[h|f]t?tp://[^?]+\.(nup|ver|)$@i)

translate: and it doesn’t matter whether it is http or ftp

Pay attention to this:

$xlrator_url = &check_cache($source_url,$hostaddr,$username,”Other“,$mirror);

It’s vendorid flag, which indicated that these NUP and VER files should use Other flag in the UA web interface. If you want to mess around and add your own image/category, edit this file

/home/httpd/cgi-bin/updatexlrator.cgi

find these line :

print “\t\t “;
            if ($vendorid =~ /^Adobe$/i)
            {
                print “Adobe \n”;
            } elsif ($vendorid =~ /^Microsoft$/i)
            {
                print “Microsoft \n”;
            } elsif ($vendorid =~ /^Symantec$/i)
            {
                print “Symantec \n”;
            } elsif ($vendorid =~ /^Linux$/i)
            {
                print “Linux \n”;
            } elsif ($vendorid =~ /^TrendMicro$/i)
            {
                print “Trend Micro \n”;
            } elsif ($vendorid =~ /^Apple$/i)
            {
                print “Apple \n”;
            } elsif ($vendorid =~ /^Avast$/i)
            {
                print “Avast \n”;
            } else
            {
                if (-e “/home/httpd/html/images/updxl-src-” . $vendorid . “.gif”)
                {
                    print “" . ucfirst $vendorid . " \n”;
                } else {
                    print “" . ucfirst $vendorid . " \n”;
                }
            }

Maybe there are other files or lines that should be edited as well, I don’t know yet.
Technorati Tags: ,