Author Topic: Adding exceptions to the Adzapper script.  (Read 2915 times)

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Adding exceptions to the Adzapper script.
« on: November 24, 2011, 07:34:19 pm »
Better to tackle this issue right now before someone else is looking all over...

Today one of my users complained about not being able to see the photos on some website. He said that somewhere else the photos were loading just fine.
After visiting this site:
Code: [Select]
http://www.amarillasinternet.comand conducting a search like "restaurantes", no images were displayed on the right side of the screen.
Opening the foto gallery yielded the same result.
I knew instantly that it was the Adzapper playing up, but adding the sites address to the exception list (Dansguardian) didn't solve anything.

After poking around in my server I found the script here:
Code: [Select]
/usr/bin/adzapper 

A little down the list there are a few lines starting with "PASS", those are the sites that will NOT be zapped so I just maintained the same format and added
amarillasinternet to the list.
After restarting the proxy all was well.
I don't know if this will "stick" after an update. In that case it could be helpful to know how we can create static exception lists.

You have to take care with the cache, sometimes you need to clear the browser cache to have all the stuff come up again.
Hope this eventually saves people from searching all over.

Cheers.
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

innocenti_jr

  • Zen Monk
  • **
  • Posts: 98
  • Karma: +9/-0
    • View Profile
Re: Adding exceptions to the Adzapper script.
« Reply #1 on: November 25, 2011, 08:43:48 am »
No, your modifications to /usr/bin/adzapper would get overwritten by a possible update.

Please read:
http://adzapper.sourceforge.net/#pattern-files

In /etc/adzapper.conf you can define custom patterns in files you define via ZAP_POSTMATCH=<file> (and ZAP_PREMATCH) -- this should do the trick.
"The problem with quotes on the Internet is that it is hard to verify their authenticity." - Abraham Lincoln

Javier Amor Garcia

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1225
  • Karma: +12/-0
    • View Profile
Re: Adding exceptions to the Adzapper script.
« Reply #2 on: November 25, 2011, 12:43:20 pm »
I remember you that this file is overwritten when saving configuration changes, so use a post conf hook as usual.

innocenti_jr

  • Zen Monk
  • **
  • Posts: 98
  • Karma: +9/-0
    • View Profile
Re: Adding exceptions to the Adzapper script.
« Reply #3 on: November 25, 2011, 02:55:05 pm »
Gotcha!  8)
I decided to use a custom template.
Will $postMatch => '' ever make it to Zentyal's web interface?
"The problem with quotes on the Internet is that it is hard to verify their authenticity." - Abraham Lincoln

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Re: Adding exceptions to the Adzapper script.
« Reply #4 on: November 26, 2011, 02:20:10 pm »
Got it, more or less  :)
Found adzapper.conf where it should be. In that file exist the line "ZAP_POSTMATCH="
So I should give the path to the extra pattern file, seems best to put it in /usr/bin like the main script.
What about the file name? Would any name do?
Like:
Code: [Select]
ZAP_POSTMATCH=/usr/bin/postmatch
Assuming the file would have to be in the same format as the url's in the main script.
Is above correct?

Cheers.
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

innocenti_jr

  • Zen Monk
  • **
  • Posts: 98
  • Karma: +9/-0
    • View Profile
Re: Adding exceptions to the Adzapper script.
« Reply #5 on: November 28, 2011, 11:45:17 am »
Yes, any name would do.
But I'd suggest you better put these files to /etc or /usr/local/etc, like:
Code: [Select]
/usr/local/etc/adzapper_postmatch.conf
The fileformat is the one from the main script; e.g. I have the following in /usr/local/etc/adzapper_postmatch.conf:
Code: [Select]
ADJS http://im.banner.t-online.de/addyn/**
ADJS http://bs.serving-sys.com/**
ADJS http://ds.serving-sys.com/**
"The problem with quotes on the Internet is that it is hard to verify their authenticity." - Abraham Lincoln

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Re: Adding exceptions to the Adzapper script.
« Reply #6 on: November 28, 2011, 12:51:29 pm »
Perfect, no more questions about locations, filename or format.
But what about the PASS lines? If the main script first "zaps" the site I've put in postmatch to "unblock" it, it would perhaps get zapped anyway...
The adzapper documentation says that prematch is better left empty, but for the PASS statements it might be necessary to populate that file.

Cheers.
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

innocenti_jr

  • Zen Monk
  • **
  • Posts: 98
  • Karma: +9/-0
    • View Profile
Re: Adding exceptions to the Adzapper script.
« Reply #7 on: November 28, 2011, 01:28:45 pm »
Since I personally don't have a need for PASS statements, I assume that things should work, if you put
  • PASS statements to your custom prematch file and
  • any additional blocking statements to your custom postmatch file
"The problem with quotes on the Internet is that it is hard to verify their authenticity." - Abraham Lincoln