You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
7.2 KiB

  1. # adblock script for openwrt
  2. ## Description
  3. A lot of people already use adblocker plugins within their desktop browsers,
  4. but what if you are using your (smart) phone, tablet, watch or any other wlan gadget...
  5. ...getting rid of annoying ads, trackers and other abuse sites (like facebook ;-) is simple: block them with your router.
  6. When the dns server on your router receives dns requests, you’ll sort out queries that ask for the [A] resource records of ad servers and return the local ip address of your router and the internal web server delivers a transparent pixel instead.
  7. ## Main Features
  8. * support of the following domain blocklist sources (free for private usage, for commercial use please check their individual licenses):
  9. * [adaway.org](https://adaway.org)
  10. * => infrequent updates, approx. 400 entries
  11. * [disconnect.me](https://disconnect.me)
  12. * => numerous updates on the same day, approx. 6.500 entries
  13. * [dshield.org](http://dshield.org)
  14. * => daily updates, approx. 4.500 entries
  15. * [feodotracker.abuse.ch](https://feodotracker.abuse.ch)
  16. * => daily updates, approx. 0-10 entries
  17. * [malwaredomains.com](http://malwaredomains.com)
  18. * => daily updates, approx. 16.000 entries
  19. * [palevotracker.abuse.ch](https://palevotracker.abuse.ch)
  20. * => daily updates, approx. 15 entries
  21. * [shallalist.de](http://www.shallalist.de) (categories "adv" "costtraps" "spyware" "tracker" "warez" enabled by default)
  22. * => daily updates, approx. 32.000 entries (a short description of all shallalist categories can be found [online](http://www.shallalist.de/categories.html))
  23. * [spam404.com](http://www.spam404.com)
  24. * => infrequent updates, approx. 5.000 entries
  25. * [whocares.org](http://someonewhocares.org)
  26. * => weekly updates, approx. 12.000 entries
  27. * [winhelp2002.mvps.org](http://winhelp2002.mvps.org)
  28. * => infrequent updates, approx. 15.000 entries
  29. * [yoyo.org](http://pgl.yoyo.org/adservers)
  30. * => weekly updates, approx. 2.500 entries (enabled by default)
  31. * [zeustracker.abuse.ch](https://zeustracker.abuse.ch)
  32. * => daily updates, approx. 440 entries
  33. * each blocklist source will be updated and processed separately
  34. * timestamp check to download and process only updated blocklists
  35. * overall duplicate removal in separate blocklists (will be automatically disabled on low memory systems)
  36. * blocklist parsing by fast & flexible regex rulesets
  37. * additional white- and blacklist support for manual overrides
  38. * use of dynamic adblock network interface
  39. * use of dynamic uhttpd instance as pixel server
  40. * use of quality checks after adblocklist updates to ensure a reliable dnsmasq service
  41. * optional features (disabled by default):
  42. * powerful adblock list backup/restore handling
  43. * wan interface check, useful for rc.local based autostart and (mobile) multiwan setups to update only on pre-defined wan interfaces
  44. * domain query logging as a background service to easily identify free and already blocked domains (see example output below)
  45. * adblock statistics (req. query logging)
  46. * ntp time sync
  47. * status & error logging to separate file (req. ntp time sync)
  48. ## Prerequisites
  49. * [openwrt](https://openwrt.org) (tested only with trunk > r47025), CC should also work
  50. * additional software packages:
  51. * curl
  52. * wget (due to an openwrt bug still needed for certain https requests - see ticket #19621)
  53. * optional: busybox find with *-mtime* support for logfile housekeeping (enabled by default with r47362, will be disabled if not found)
  54. * the above dependencies and requirements will be checked during package installation & script startup, please check console output or *logread -e "adblock"* for errors
  55. ## Usage
  56. * select & install adblock package (*opkg install adblock*)
  57. * configure */etc/config/adblock* to your needs, see additional comments in *adblock.conf.sample*
  58. * at least configure the ip address of the local adblock interface/uhttpd instance, it needs to be a different subnet from the normal LAN
  59. * recommendation: there is no need to enable all blacklist sites at once, for normal use one to three lists should be sufficient
  60. * recommendation: to handle all blacklists at once add an usb stick or any other storage device to supersize your /tmp directory with a swap partition
  61. * => see [openwrt wiki](https://wiki.openwrt.org/doc/uci/fstab) for further details
  62. * add additional domain white- or blacklist entries, one domain per line (wildcards & regex are not allowed!), both lists are located in */etc/adblock*
  63. * by default openwrts main uhttpd instance is bind to all ports of your router,
  64. * for a working adblock setup you have to bind uhttpd to the standard LAN port only, please change listen_http accordingly
  65. * start /usr/bin/adblock-update.sh and check console output or *logread -e "adblock"* for errors
  66. ## Distributed samples
  67. * all sample configuration files stored in */etc/adblock/samples*
  68. * to enable/disable additional domain query logging set the dnsmasq option *logqueries* accordingly, see *dhcp.config.sample*
  69. * to bind uhttpd to standard LAN port only, see *uhttpd.config.sample*
  70. * for rc.local based autostart and /tmp resizing on the fly see *rc.local.sample*
  71. * for scheduled call of *adblock-update.sh* see *root.crontab.sample*
  72. * to redirect/force all dns queries to your router see *firwall.user.sample*
  73. * for further dnsmasq tweaks see *dnsmasq.conf.sample*
  74. ## Examples
  75. adblock log file excerpt:
  76. adblock[11780] info : domain adblock processing started (0.40.1, r47929, 20.12.2015 21:59:56)
  77. adblock[11780] info : backup/restore will be disabled
  78. adblock[11780] info : wan update check will be disabled
  79. adblock[11780] info : get ntp time sync (192.168.254.254), after 0 loops
  80. adblock[11780] info : source doesn't change, no update required (whocares)
  81. adblock[11780] info : adblocklists with overall 11619 domains loaded, backups disabled
  82. adblock[11780] info : adblock statistics for query date 20151220 (total: 2495, blocked: 154)
  83. adblock[11780] info : domain adblock processing finished (0.40.1, r47929, 20.12.2015 22:00:03)
  84. domain blocklist for dnsmasq (disconnect.me after overall duplicate removal):
  85. address=/0000mps.webpreview.dsl.net/192.168.2.1
  86. address=/0001.2waky.com/192.168.2.1
  87. address=/001wen.com/192.168.2.1
  88. address=/002it.com/192.168.2.1
  89. address=/00game.net/192.168.2.1
  90. [...]
  91. address=/zzsgssxh.com/192.168.2.1
  92. address=/zzshw.net/192.168.2.1
  93. address=/zztxdown.com/192.168.2.1
  94. address=/zzxcws.com/192.168.2.1
  95. #------------------------------------------------------------------
  96. # adblock-update.sh (0.40.0) - 3710 ad/abuse domains blocked
  97. # source: https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt
  98. # last modified: Thu, 17 Dec 2015 09:21:17 GMT
  99. domain query log excerpt:
  100. query[A] www.seenby.de from fe80::6257:18ff:fe6b:4667
  101. query[A] tarifrechner.heise.de from 192.168.1.131
  102. query[A] www.mittelstandswiki.de from fe80::6257:18ff:fe6b:4667
  103. query[A] ad.doubleclick.net from 192.168.1.131
  104. ad.doubleclick.net is 192.168.2.1
  105. The first three queries are OK (not blocked), the last one has been blocked and answered by local dnsmasq instance.
  106. Have fun!
  107. Dirk