|
|
| (Hi ha 6 revisions intermèdies sense mostrar fetes per un usuari) |
| Línia 1: |
Línia 1: |
| − | {|align=left|__TOC__|}
| |
| − | = Configurar un filtre de publicitat web per servidors proxy i dnsservices =
| |
| | | | |
| − | == Introducció ==
| |
| − | Configurarem el servei [[Servidor_DNS|dnsservices]] (bind9) inclòs a ([[Servidor_Proxy|Proxy3]] / [[Cloudy]]) perque elimini els anuncis de les pàgines web. Farem un script que descarrega una [http://pgl.yoyo.org/adservers/serverlist.php?hostformat=bindconfig&showintro=0&mimetype=plaintext llista pública] de servidors de banners publicitaris tipus "doubleclick.net" i l'afegeix al servidor DNS (bind9) per que els bloquegi.
| |
| − | Aplicant el filtre a nivell de DNS eliminem la publicitat de les webs i també de tots els dispositius mòbils i aplicacions que l'utilitzen.
| |
| − |
| |
| − | == Requisits ==
| |
| − | Disposar d'un servidor linux ([[Servidor_Proxy|Proxy3]] / [[Cloudy]]) basat en [[Debian]] que ha d'estar configurat com a [[Servidor_DNS|servidor de noms]].
| |
| − |
| |
| − | == Configuració ==
| |
| − | === Crear script ad-blacklist-update.sh ===
| |
| − | Obrim una finestra '''ssh'''
| |
| − | Cal tenir permisos root
| |
| − | *'''sudo su -'''
| |
| − |
| |
| − | Ens situem al directori /etc/bind
| |
| − | *'''cd /etc/bind'''
| |
| − |
| |
| − | Creem l'script ad-blacklist-update.sh
| |
| − | *'''nano /etc/bind/ad-blacklist-update.sh'''
| |
| − | #'''Contingut de l'script ad-blacklist-update.sh'''
| |
| − |
| |
| − | # Baixa la llista de servidors de publicitat de <nowiki>http://pgl.yoyo.org/adservers</nowiki>
| |
| − | # qualsevol servidor d'aquesta llista rebrà una IP nula del servidor de noms
| |
| − |
| |
| − | wget "<nowiki>http://pgl.yoyo.org/adservers/serverlist.php?hostformat=bindconfig&showintro=0&mimetype=plaintext</nowiki>" -qO ad-blacklist
| |
| − | sed -i 's/null.zone.file/\/etc\/bind\/foratnegre/g' ad-blacklist
| |
| − |
| |
| − | Convertim l'script en executable
| |
| − | *'''chmod +x /etc/bind/ad-blacklist-update.sh'''
| |
| − |
| |
| − | === Configurar Bind ===
| |
| − | Preparem l'arxiu named.conf.int.private perquè inclogui la llista de servidors bloquejats
| |
| − | *'''echo 'include "/etc/bind/ad-blacklist";' > /etc/bind/named.conf.int.private'''
| |
| − |
| |
| − | === Configurar el cron perque actualitzi la llista ===
| |
| − | Editem l'arxiu /etc/cron.d/dnsservices
| |
| − | *'''cd /etc/cron.d'''
| |
| − | *'''nano /etc/cron.d/dnsservices
| |
| − |
| |
| − | Afegim el contingut del requadre al final de l'arxiu editat perquè s'executi l'script cada hora
| |
| − |
| |
| − | # Actualitza ad-blocklist a dnsservices
| |
| − | 0 * * * * root cd /etc/bind; /etc/bind/ad-blacklist-update.sh; rndc reload
| |
| − |
| |
| − | === Provar el funcionament ===
| |
| − | *'''cd /etc/bind; /etc/bind/ad-blacklist-update.sh; rndc reload'''
| |
| − | *'''dig @localhost doubleclick.net
| |
| − | La resposta ha de ser semblant a això:
| |
| − | ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @localhost doubleclick.net
| |
| − | ; (1 server found)
| |
| − | ;; global options: +cmd
| |
| − | ;; Got answer:
| |
| − | ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 19515
| |
| − | ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
| |
| − |
| |
| − | ;; QUESTION SECTION:
| |
| − | ;doubleclick.net. IN A
| |
| − |
| |
| − | ;; Query time: 0 msec
| |
| − | ;; SERVER: 127.0.0.1#53(127.0.0.1)
| |
| − | ;; MSG SIZE rcvd: 33
| |
| − |
| |
| − |
| |
| − | == Veure també ==
| |
| − | * [[Filtrar pornografia / malware en un servidor Debian amb dnsservices]]
| |
| − | * [[Servidor_DNS|dnsservices]]
| |
| − | * [[Servidor_Proxy|Proxy3]]
| |
| − | * [[Cloudy]]
| |
| − |
| |
| − | == Referències ==
| |
| − | * https://advanxer.com/blog/2015/05/adblocking-using-bind-dns-server/
| |
| − |
| |
| − | [[Categoria:Servidor]]
| |