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.

114 lines
7.9 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...getting rid of annoying ads, trackers and other abuse sites (like facebook ;-) is simple: block them with your router.
  5. When the dns server on your router receives dns requests, you will sort out queries that ask for the resource records of ad servers and return the local ip address of your router and the internal web server delivers a transparent pixel instead.
  6. ## Main Features
  7. * support of the following domain blocklist sources (free for private usage, for commercial use please check their individual licenses):
  8. * [adaway](https://adaway.org)
  9. * => infrequent updates, approx. 400 entries (enabled by default)
  10. * [disconnect](https://disconnect.me)
  11. * => numerous updates on the same day, approx. 6.500 entries (enabled by default)
  12. * [dshield](http://dshield.org)
  13. * => daily updates, approx. 4.500 entries
  14. * [feodotracker](https://feodotracker.abuse.ch)
  15. * => daily updates, approx. 0-10 entries
  16. * [malwaredomains](http://malwaredomains.com)
  17. * => daily updates, approx. 16.000 entries
  18. * [malwaredomainlist](http://www.malwaredomainlist.com)
  19. * => daily updates, approx. 1.500 entries
  20. * [openphish](https://openphish.com)
  21. * => numerous updates on the same day, approx. 1.800 entries
  22. * [palevotracker](https://palevotracker.abuse.ch)
  23. * => daily updates, approx. 15 entries
  24. * [ruadlist+easylist](https://code.google.com/p/ruadlist)
  25. * => weekly updates, approx. 2.000 entries
  26. * [shallalist](http://www.shallalist.de) (categories "adv" "costtraps" "spyware" "tracker" "warez" enabled by default)
  27. * => daily updates, approx. 32.000 entries (a short description of all shallalist categories can be found [online](http://www.shallalist.de/categories.html))
  28. * [spam404](http://www.spam404.com)
  29. * => infrequent updates, approx. 5.000 entries
  30. * [whocares](http://someonewhocares.org)
  31. * => weekly updates, approx. 12.000 entries
  32. * [winhelp](http://winhelp2002.mvps.org)
  33. * => infrequent updates, approx. 15.000 entries
  34. * [yoyo](http://pgl.yoyo.org/adservers)
  35. * => weekly updates, approx. 2.500 entries (enabled by default)
  36. * [zeustracker](https://zeustracker.abuse.ch)
  37. * => daily updates, approx. 440 entries
  38. * zero-conf like automatic installation & setup, usually no manual changes needed (i.e. ip address, network devices etc.)
  39. * full IPv4 and IPv6 support
  40. * each blocklist source will be updated and processed separately
  41. * timestamp check to download and process only updated adblock list sources
  42. * overall duplicate removal in separate adblock lists (will be automatically disabled on low memory systems)
  43. * adblock source list parsing by fast & flexible regex rulesets
  44. * additional white- and blacklist support for manual overrides
  45. * quality checks during & after update of adblock lists to ensure a reliable dnsmasq service
  46. * basic adblock statistics via iptables packet counters for each chain
  47. * status & error logging to stdout and syslog
  48. * use of dynamic uhttpd instance as adblock pixel server
  49. * use of dynamic iptables ruleset for adblock related redirects/rejects
  50. * openwrt init system support (start/stop/restart/reload)
  51. * hotplug support, adblock start will be triggered by wan 'ifup' event
  52. * optional: adblock list backup/restore (disabled by default)
  53. ## Prerequisites
  54. * [openwrt](https://openwrt.org), tested with latest stable release (Chaos Calmer 15.05) and with current trunk (Designated Driver > r47025)
  55. * usual openwrt setup with 'iptables' & 'uhttpd', additional required software packages:
  56. * wget
  57. * optional: 'kmod-ipt-nat6' for IPv6 support
  58. * the above dependencies and requirements will be checked during package installation & script runtime
  59. ## Installation & Usage
  60. * install the adblock package (*opkg update & opkg install adblock*)
  61. * start the adblock service with */etc/init.d/adblock start* and check *logread -e "adblock"* for adblock related information
  62. * optional: enable/disable your required adblock list sources in */etc/config/adblock* - 'adaway', 'disconnect' and 'yoyo' are enabled by default
  63. * optional: maintain the adblock service in luci under 'System => Startup'
  64. ## LuCI adblock companion package
  65. For easy management of the various blocklist sources and and the adblock options there is also a nice & efficient LuCI frontend available.
  66. Please install the package 'luci-app-adblock'. Then you will find the application in LuCI located under 'Services' menu.
  67. Thanks to Hannu Nyman for this great adblock LuCI frontend!
  68. ## CC installation notes
  69. * currently the adblock package is *not* part of the CC package repository
  70. * download the latest adblock package *adblock_x.xx.x-1_all.ipk* from a DD snapshot [package directory](https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/packages/packages)
  71. * manual transfer the package to your router and install the opkg package as usual
  72. ## Tweaks
  73. * there is no need to enable all blacklist sites at once, for normal use one to three adblock list sources should be sufficient
  74. * if you really need to handle all blacklists at once add an usb stick or any other storage device to enlarge your temp directory with a swap partition => see [openwrt wiki](https://wiki.openwrt.org/doc/uci/fstab) for further details
  75. * add personal domain white- or blacklist entries as an additional blocklist source, one domain per line (wildcards & regex are not allowed!), by default both empty lists are located in */etc/adblock*
  76. * enable the backup/restore feature, to restore automatically the latest stable backup of your adblock lists in case of any (partial) processing error (i.e. a single blocklist source server is down). Please use an (external) solid partition and *not* your volatile router temp directory for this
  77. * for a scheduled call of the adblock service via */etc/init.d/adblock start* add an appropriate crontab entry
  78. ## Further adblock config options
  79. * usually the adblock autodetection works quite well and no manual config overrides are needed, all options apply to 'global' adblock config section:
  80. * adb\_enabled => main switch to enable/disable adblock service (default: '1', enabled)
  81. * adb\_cfgver => config version string (do not change!) - adblock checks this entry and automatically applies the current config, if none or an older revision was found.
  82. * adb\_wanif => name of the logical wan interface (default: 'wan')
  83. * adb\_lanif => name of the logical lan interface (default: 'lan')
  84. * adb\_port => port of the adblock uhttpd instance (default: '65535')
  85. * adb\_nullipv4 => IPv4 blackhole ip address (default: '192.0.2.1')
  86. * adb\_nullipv6 => IPv6 blackhole ip address (default: '::ffff:c000:0201')
  87. * adb\_forcedns => redirect all DNS queries to local dnsmasq resolver (default: '1', enabled)
  88. ## Background
  89. This adblock package is a dns/dnsmasq based adblock solution for openwrt.
  90. Queries to ad/abuse domains are never forwarded and always replied with a local IP address which may be IPv4 or IPv6.
  91. For that purpose adblock uses an ip address from the private 'TEST-NET-1' subnet (192.0.2.1 / ::ffff:c000:0201) by default.
  92. Furthermore all ad/abuse queries will be filtered by ip(6)tables and redirected to internal adblock pixel server (in PREROUTING chain) or rejected (in FORWARD or OUTPUT chain).
  93. All iptables and uhttpd related adblock additions are non-destructive, no hard-coded changes in 'firewall.user', 'uhttpd' config or any other openwrt related config files.
  94. There is *no* adblock background daemon running, the (scheduled) start of the adblock service keeps only the adblock lists up-to-date.
  95. ## Support
  96. Please join the adblock discussion in this [openwrt forum thread](https://forum.openwrt.org/viewtopic.php?id=59803) or contact me by mail <openwrt@brenken.org>
  97. ## Removal
  98. * stop all adblock related services with */etc/init.d/adblock stop*
  99. * optional: remove the adblock package (*opkg remove adblock*)
  100. Have fun!
  101. Dirk