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.

97 lines
6.3 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 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.
  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 (enabled by default)
  11. * [disconnect.me](https://disconnect.me)
  12. * => numerous updates on the same day, approx. 6.500 entries (enabled by default)
  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. * [malwaredomainlist.com](http://www.malwaredomainlist.com)
  20. * => daily updates, approx. 1.500 entries
  21. * [palevotracker.abuse.ch](https://palevotracker.abuse.ch)
  22. * => daily updates, approx. 15 entries
  23. * [shallalist.de](http://www.shallalist.de) (categories "adv" "costtraps" "spyware" "tracker" "warez" enabled by default)
  24. * => daily updates, approx. 32.000 entries (a short description of all shallalist categories can be found [online](http://www.shallalist.de/categories.html))
  25. * [spam404.com](http://www.spam404.com)
  26. * => infrequent updates, approx. 5.000 entries
  27. * [whocares.org](http://someonewhocares.org)
  28. * => weekly updates, approx. 12.000 entries
  29. * [winhelp2002.mvps.org](http://winhelp2002.mvps.org)
  30. * => infrequent updates, approx. 15.000 entries
  31. * [yoyo.org](http://pgl.yoyo.org/adservers)
  32. * => weekly updates, approx. 2.500 entries (enabled by default)
  33. * [zeustracker.abuse.ch](https://zeustracker.abuse.ch)
  34. * => daily updates, approx. 440 entries
  35. * zero-conf like automatic installation & setup, usually no manual changes needed (i.e. ip address, network devices etc.)
  36. * full IPv4 and IPv6 support
  37. * each blocklist source will be updated and processed separately
  38. * timestamp check to download and process only updated adblock list sources
  39. * overall duplicate removal in separate adblock lists (will be automatically disabled on low memory systems)
  40. * adblock source list parsing by fast & flexible regex rulesets
  41. * additional white- and blacklist support for manual overrides
  42. * quality checks during & after update of adblock lists to ensure a reliable dnsmasq service
  43. * wan update check, to wait for an active wan uplink before update
  44. * basic adblock statistics via iptables packet counters
  45. * status & error logging to stdout and syslog
  46. * use of dynamic uhttpd instance as adblock pixel server
  47. * optional features (disabled by default):
  48. * adblock list backup/restore
  49. * debug logging to separate file
  50. ## Prerequisites
  51. * [openwrt](https://openwrt.org), tested with latest stable release (Chaos Calmer 15.05) and with current trunk (Designated Driver > r47025)
  52. * usual openwrt setup with 'iptables' & 'uhttpd', additional required software packages:
  53. * wget
  54. * optional: 'kmod-ipt-nat6' for IPv6 support
  55. * the above dependencies and requirements will be checked during package installation & script runtime, please check console output or *logread -e "adblock"* for errors
  56. ## Usage
  57. * install the adblock package (*opkg install adblock*)
  58. * optional: for an update installation please replace your existing */etc/config/adblock* with a copy of */etc/samples/adblock.conf.sample* to get the latest changes
  59. * optional: enable/disable your required adblock list sources in */etc/config/adblock* - 'adaway', 'disconnect' and 'yoyo' are enabled by default
  60. * start */usr/bin/adblock-update.sh* and check console output or *logread -e "adblock"* for errors
  61. ## Tweaks
  62. * there is no need to enable all blacklist sites at once, for normal use one to three adblock list sources should be sufficient
  63. * if you really need to handle all blacklists at once add an usb stick or any other storage device to supersize your /tmp directory with a swap partition
  64. * => see [openwrt wiki](https://wiki.openwrt.org/doc/uci/fstab) for further details
  65. * add static, personal domain white- or blacklist entries, one domain per line (wildcards & regex are not allowed!), by default both lists are located in */etc/adblock*
  66. * enable the backup/restore feature, to restore automatically the latest, stable backup of your adblock lists in case of any processing error
  67. * enable the logging feature for continuous logfile writing to monitor the adblock runs over a longer period
  68. ## Distributed samples
  69. * all sample configuration files stored in */etc/adblock/samples*
  70. * for a fully blown adblock configuration with all explained options see *adblock.conf.sample*
  71. * for some dnsmasq tweaks see *dhcp.config.sample* and *dnsmasq.conf.sample*
  72. * for rc.local based autostart and /tmp resizing on the fly see *rc.local.sample*
  73. * for scheduled call of *adblock-update.sh* see *root.crontab.sample*
  74. ## Background
  75. This adblock package is a dns/dnsmasq based adblock solution for openwrt.
  76. Queries to ad/abuse domains are never forwarded and always replied with a local IP address which may be IPv4 or IPv6.
  77. For that purpose adblock uses an ip address from the private 'TEST-NET-1' subnet (192.0.2.1 / ::ffff:c000:0201) by default.
  78. 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 and OUTPUT chain).
  79. 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.
  80. ## Removal
  81. * remove the adblock package (*opkg remove adblock*)
  82. * remove all script generated adblock lists in */tmp/dnsmasq.d/*
  83. * kill the running adblock uhttpd instance (ps | grep "[u]httpd.*\-h /www/adblock")
  84. * run /etc/init.d/dnsmasq restart
  85. * run /etc/init.d/firewall restart
  86. Have fun!
  87. Dirk