Ahmt,
wer "Interesse" hat und 'privoxy' etwas erweitern möchte...
Das hier vorgestelle Skript läuft hier schon seit ca. vier Monaten problemlos bei mir im Produktiv-Test.
Hintergrund:
Leider wird 'privoxy' mit nur wenigen 'action'/Regel-Files ausgeliefert, man kann diese aber relativ simpel um eigene Regeldateien, u.a. basierend auf
Fanboy,
Easylist,
Adblock- und
Malc0de-Listen erweitern.
Das Skript ('
get_and_convert_privoxy_blocklists.sh') stammt ursprünglich vom Copfilter, ist dort wesentlich umfangreicher, tut aber in der vorliegenden, etwas vereinfachten Form auf dem IPFire genauso seinen Dienst.
Es lädt zunächst
adversity,
easylist,
easylistgermany,
easyprivacy,
fanboy,
Malc0de,
malwaredomainlist und
malwaredomains-Listen und konvertiert diese anschließend für den Einsatz mit 'privoxy'.
Download:
http://people.ipfire.org/~mfischer/priv ... ter.tar.gz
MD5SUM:
74a30fc92eb8e101b628add41b1d9f4f
Installation:
Das Archiv (am einfachsten per '
wget') herunterladen:
Code: Select all
wget http://people.ipfire.org/~mfischer/privoxy/privoxy_blocklist_updater.tar.gz
Checksumme prüfen:
Code: Select all
md5sum privoxy_blocklist_updater.tar.gz
Wenn die Checksumme stimmt, entpacken nach '
/usr/local/bin':
Code: Select all
tar xvf privoxy_blocklist_updater.tar.gz -C /usr/local/bin
Dorthin wechseln und die Rechte definieren (root.nobody / 0755)
Code: Select all
chown root.nobody get_and_convert_privoxy_blocklists.sh
Code: Select all
chmod 0755 get_and_convert_privoxy_blocklists.sh
Arbeitsweise:
In '
/var/ipfire/proxy/advanced/settings' wird überprüft, ob der Eintrag
ENABLE_PRIVOXY=on existiert. Wenn nicht, passiert...nix.
Wenn ja, werden
Fanboy-,
Malware-, verschiedene
Easylist-,
Adversity- und
Malc0de-Listen in ein temporäres Verzeichnis heruntergeladen, in ein für '
privoxy' lesbares Format konvertiert, umbenannt und per '
rsync' in das Verzeichnis '
/etc/privoxy' verschoben, defekte Listen werden ausgelassen. Außerdem werden die Dateirechte angepasst.
Um den korrekten Ablauf zu kontrollieren, sollte das Skript als Nächstes
einmal händisch gestartet werden:
Code: Select all
root@ipfire: /usr/local/bin # ./get_and_convert_privoxy_blocklists.sh
--2016-01-02 22:54:54-- https://secure.fanboy.co.nz/r/fanboy-ultimate.txt
Resolving secure.fanboy.co.nz (secure.fanboy.co.nz)... 104.25.84.26, 104.25.85.26
Connecting to secure.fanboy.co.nz (secure.fanboy.co.nz)|104.25.84.26|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: '/tmp/privoxy-blocklists/fanboy'
/tmp/privoxy-blocklists/fanboy [ <=> ] 2.40M 1.30MB/s in 1.9s
2016-01-02 22:54:56 (1.30 MB/s) - '/tmp/privoxy-blocklists/fanboy' saved [2520413]
--2016-01-02 22:54:57-- https://easylist-downloads.adblockplus.org/malwaredomains_full.txt
Resolving easylist-downloads.adblockplus.org (easylist-downloads.adblockplus.org)... 148.251.139.76, 78.46.104.117
Connecting to easylist-downloads.adblockplus.org (easylist-downloads.adblockplus.org)|148.251.139.76|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 382131 (373K) [text/plain]
Saving to: '/tmp/privoxy-blocklists/malwaredomains'
/tmp/privoxy-blocklists/malwaredomains 100%[===============================================================================>] 373.17K 1.24MB/s in 0.3s
2016-01-02 22:54:57 (1.24 MB/s) - '/tmp/privoxy-blocklists/malwaredomains' saved [382131/382131]
--2016-01-02 22:54:57-- http://www.malwaredomainlist.com/hostslist/hosts.txt
Resolving www.malwaredomainlist.com (www.malwaredomainlist.com)... 143.215.130.61
Connecting to www.malwaredomainlist.com (www.malwaredomainlist.com)|143.215.130.61|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 48422 (47K) [text/plain]
Saving to: '/tmp/privoxy-blocklists/malwaredomainlist'
/tmp/privoxy-blocklists/malwaredomainli 100%[===============================================================================>] 47.29K 192KB/s in 0.2s
2016-01-02 22:54:58 (192 KB/s) - '/tmp/privoxy-blocklists/malwaredomainlist' saved [48422/48422]
--2016-01-02 22:54:58-- https://easylist-downloads.adblockplus.org/easylist.txt
Resolving easylist-downloads.adblockplus.org (easylist-downloads.adblockplus.org)... 78.46.104.117, 148.251.139.76
Connecting to easylist-downloads.adblockplus.org (easylist-downloads.adblockplus.org)|78.46.104.117|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1691937 (1.6M) [text/plain]
Saving to: '/tmp/privoxy-blocklists/easylist'
/tmp/privoxy-blocklists/easylist 100%[===============================================================================>] 1.61M 1.30MB/s in 1.2s
2016-01-02 22:55:00 (1.30 MB/s) - '/tmp/privoxy-blocklists/easylist' saved [1691937/1691937]
--2016-01-02 22:55:00-- https://easylist-downloads.adblockplus.org/easyprivacy.txt
Resolving easylist-downloads.adblockplus.org (easylist-downloads.adblockplus.org)... 148.251.139.76, 78.46.104.117
Connecting to easylist-downloads.adblockplus.org (easylist-downloads.adblockplus.org)|148.251.139.76|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 307177 (300K) [text/plain]
Saving to: '/tmp/privoxy-blocklists/easyprivacy'
/tmp/privoxy-blocklists/easyprivacy 100%[===============================================================================>] 299.98K 1.26MB/s in 0.2s
2016-01-02 22:55:01 (1.26 MB/s) - '/tmp/privoxy-blocklists/easyprivacy' saved [307177/307177]
--2016-01-02 22:55:01-- https://easylist-downloads.adblockplus.org/easylistgermany.txt
Resolving easylist-downloads.adblockplus.org (easylist-downloads.adblockplus.org)... 78.46.104.117, 148.251.139.76
Connecting to easylist-downloads.adblockplus.org (easylist-downloads.adblockplus.org)|78.46.104.117|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 392212 (383K) [text/plain]
Saving to: '/tmp/privoxy-blocklists/easylistgermany'
/tmp/privoxy-blocklists/easylistgermany 100%[===============================================================================>] 383.02K 1.09MB/s in 0.3s
2016-01-02 22:55:02 (1.09 MB/s) - '/tmp/privoxy-blocklists/easylistgermany' saved [392212/392212]
--2016-01-02 22:55:02-- http://malc0de.com/bl/BOOT
Resolving malc0de.com (malc0de.com)... 198.41.201.203, 198.41.200.203
Connecting to malc0de.com (malc0de.com)|198.41.201.203|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 29136 (28K) [text/plain]
Saving to: '/tmp/privoxy-blocklists/Malc0de'
/tmp/privoxy-blocklists/Malc0de 100%[===============================================================================>] 28.45K --.-KB/s in 0.09s
2016-01-02 22:55:02 (302 KB/s) - '/tmp/privoxy-blocklists/Malc0de' saved [29136/29136]
--2016-01-02 22:55:02-- https://raw.githubusercontent.com/Hubird-au/Adversity/master/Adversity.txt
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.31.17.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.31.17.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 207392 (203K) [text/plain]
Saving to: '/tmp/privoxy-blocklists/adversity'
/tmp/privoxy-blocklists/adversity 100%[===============================================================================>] 202.53K --.-KB/s in 0.1s
2016-01-02 22:55:03 (1.41 MB/s) - '/tmp/privoxy-blocklists/adversity' saved [207392/207392
Das Verzeichnis '/etc/privoxy' sollte anschließend so aussehen:
Code: Select all
root@ipfire: /etc/privoxy # ls -la
total 1596
drwxr-xr-x 3 privoxy privoxy 4096 Jan 2 22:55 .
drwxr-xr-x 46 root root 4096 Jan 2 04:47 ..
-r--r----- 1 privoxy privoxy 39997 Jan 2 22:55 Adversity.script.action
-rw-rw---- 1 privoxy privoxy 62421 Nov 29 07:19 config
-rw-rw---- 1 privoxy privoxy 89872 Nov 8 09:20 default.action
-rw-rw---- 1 privoxy privoxy 41188 Jun 15 2015 default.filter
-r--r----- 1 privoxy privoxy 64753 Jan 2 22:55 easylistgermany.script.action
-r--r----- 1 privoxy privoxy 265137 Jan 2 22:55 easylist.script.action
-r--r----- 1 privoxy privoxy 140905 Jan 2 22:55 easyprivacy.script.action
-r--r----- 1 privoxy privoxy 462143 Jan 2 22:54 fanboy.script.action
-r--r----- 1 privoxy privoxy 10044 Jan 2 22:55 Malc0de.script.action
-r--r----- 1 privoxy privoxy 31531 Jan 2 22:54 malwaredomainlist.script.action
-r--r----- 1 privoxy privoxy 345392 Jan 2 22:54 malwaredomains.script.action
-rw-rw---- 1 privoxy privoxy 839 Apr 23 2015 match-all.action
-rw-rw---- 1 privoxy privoxy 627 Apr 11 2015 match-all.action.new
drwxr-xr-x 2 privoxy privoxy 4096 Apr 11 2015 templates
-rw-rw---- 1 privoxy privoxy 3761 Apr 11 2015 trust
-rw-rw---- 1 privoxy privoxy 3761 Apr 11 2015 trust.new
-rw-rw---- 1 privoxy privoxy 9046 Dec 25 01:44 user.action
-rw-rw---- 1 privoxy privoxy 8794 Apr 11 2015 user.action.new
-rw-rw---- 1 privoxy privoxy 3316 Nov 29 06:53 user.filter
-rw-rw---- 1 privoxy privoxy 3334 Apr 11 2015 user.filter.new
Jetzt muss noch die '
/etc/privoxy/config' um die neu hinzugekommenen 'action'-files erweitert werden.
Dazu öffnet man mit einem Editor des geringsten Misstrauens die Datei '
/etc/privoxy/config' und trägt diese neuen Dateien ein.
Aus (~Zeile 387ff):
Code: Select all
...
actionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.
actionsfile default.action # Main actions file
actionsfile user.action # User customizations
...
Wird:
Code: Select all
...
actionsfile match-all.action # Actions that are applied to all sites and maybe overruled later on.
actionsfile default.action # Main actions file
actionsfile fanboy.script.action
actionsfile malwaredomains.script.action
actionsfile malwaredomainlist.script.action
actionsfile easylist.script.action
actionsfile easyprivacy.script.action
actionsfile easylistgermany.script.action
actionsfile Malc0de.script.action
actionsfile Adversity.script.action
actionsfile user.action # User customizations
...
Wichtig ist, dass der Eintrag
actionsfile user.actions die
letzte Datei in dieser Liste darstellt. Wer zuletzt kommt, gewinnt!
Abschließend muss
'privoxy' - ausnahmsweise - neu gestartet werden:
Im 'privoxy'-Log und und auf der
Statusseite von 'privoxy' sollte im Anschluss der korrekte Start überprüft werden:
Auszug Logfile:
Code: Select all
...
2016-01-02 04:47:19.981 51df76c0 Info: Privoxy version 3.0.23
2016-01-02 04:47:19.981 51df76c0 Info: Program name: /usr/sbin/privoxy
2016-01-02 04:47:19.981 51df76c0 Info: Loading filter file: /etc/privoxy/default.filter
2016-01-02 04:47:19.988 51df76c0 Info: Loading filter file: /etc/privoxy/user.filter
2016-01-02 04:47:19.989 51df76c0 Info: Loading actions file: /etc/privoxy/match-all.action
2016-01-02 04:47:19.989 51df76c0 Info: Loading actions file: /etc/privoxy/default.action
2016-01-02 04:47:20.001 51df76c0 Info: Loading actions file: /etc/privoxy/fanboy.script.action
2016-01-02 04:47:20.220 51df76c0 Info: Loading actions file: /etc/privoxy/malwaredomains.script.action
2016-01-02 04:47:20.325 51df76c0 Info: Loading actions file: /etc/privoxy/malwaredomainlist.script.action
2016-01-02 04:47:20.335 51df76c0 Info: Loading actions file: /etc/privoxy/easylist.script.action
2016-01-02 04:47:20.462 51df76c0 Info: Loading actions file: /etc/privoxy/easyprivacy.script.action
2016-01-02 04:47:20.521 51df76c0 Info: Loading actions file: /etc/privoxy/easylistgermany.script.action
2016-01-02 04:47:20.549 51df76c0 Info: Loading actions file: /etc/privoxy/Malc0de.script.action
2016-01-02 04:47:20.553 51df76c0 Info: Loading actions file: /etc/privoxy/Adversity.script.action
2016-01-02 04:47:20.572 51df76c0 Info: Loading actions file: /etc/privoxy/user.action
2016-01-02 04:47:20.573 51df76c0 Info: Listening on port 8118 on IP address 127.0.0.1
...
Auszug der 'privoxy'-Status-Optionen:
Wer das Ganze automatisieren möchte, legt z.B. in '
/etc/fcron.daily' (oder '
weekly', bzw. '
monthly') einen entsprechenden Symlink an:
Code: Select all
ln -s /usr/local/bin/get_and_convert_privoxy_blocklists.sh privoxy-blocklist-update
Nicht zu oft aktualisieren, manche Download-Seiten reagieren darauf u.U. allergisch...
Das Ganze ist, abgesehen von der händischen Installation, die man natürlich beherrschen sollte, recht simpel gehalten, kann natürlich noch dran gefeilt werden, an einer Installationsroutine bastle ich noch. Rückmeldungen und konstruktive Kritik sind ausdrücklich erwünscht.
Meine bisherigen Erfahrungen mit '
privoxy', die verschiedenen Vor- und Nachteile habe ich schon einmal
hier aufgelistet, bis heute hat sich daran nicht viel geändert.
Änderungen an den Filter-Dateien greifen unmittelbar, ein 'privoxy'-Neustart ist die absolute Ausnahme. Abstürze gabs bisher keine, die Block-Raten liegen (trotz Verwendung von
HTTPS-Everywhere) zwischen 5 bis 20%.
Viele Grüße,
Matthias