Obre el menú principal

Canvis

Personalitzar squid

1.191 bytes afegits, 10:39, 9 set 2014
cap resum d'edició
Font: http://mestreacasa.gva.es/web/lliurex/forums/message_boards/message/500006118731
 
 
==Script per a afergir les adresses de adblock==
<pre>
#!/bin/bash
tmp_dir=$(mktemp -d)
 
rm_temp() {
rm -rf "${tmp_dir}"
rm /tmp/adblock.sed && return 0;
}
acl=/etc/squid3/adblock.acl
 
source=(
https://easylist-downloads.adblockplus.org/malwaredomains_full.txt
https://easylist-downloads.adblockplus.org/easyprivacy.txt
https://easylist-downloads.adblockplus.org/easylist.txt
https://easylist-downloads.adblockplus.org/easyprivacy_nointernational.txt
https://easylist-downloads.adblockplus.org/easylist_noadult.txt
https://easylist-downloads.adblockplus.org/fanboy-social.txt
https://easylist-downloads.adblockplus.org/easylistdutch.txt
)
 
cat > /tmp/adblock.sed <<'EOF'
/.*\$.*/d;
/\n/d;
/.*\#.*/d;
/@@.*/d;
/^!.*/d;
s/\[\]/\[.\]/g;
s#http://#||#g;
s/\/\//||/g
s/^\[.*\]$//g;
s,[+.?&/|],\\&,g;
s#*#.*#g;
s,\$.*$,,g;
s/\\|\\|\(.*\)\^\(.*\)/\.\1\\\/\2/g;
s/\\|\\|\(.*\)/\.\1/g;
/^\.\*$/d;
/^$/d;
EOF
 
mv $acl "$acl".old
cd $tmp_dir
wget -nv ${source[*]} || $(mv "$acl".old $acl && rm_temp)
sed -f /tmp/adblock.sed $(ls) >> $acl
 
rm_temp</pre>
 
Es pot afegir aquestes línies a la configuració de Squid
 
<pre>
acl adblock url_regex "/etc/squid3/adblock.acl"
http_access deny adblock
</pre>
3.113
modificacions