User Tools

Site Tools

This documentation is no longer maintained by the Turris team (although it can be used by the community to share content). The current official documentation is at docs.turris.cz.

Adblock

There are many discussions on the forum and it takes some time to get overview about adblock possibilities. I found Adblock working configuration in this post - https://forum.turris.cz/t/adblock-package-release-for-turris-omnia/4912/23. It works on Turris Omnia router with OS 3.9.2 and Adblock 3.4.3.

Link to the latest adblock online documentation: https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md

Download and install latest packages

[optional] Change current dir to /tmp, so you do not write to the Turris’ (precious) internal Flash memory. But you can use any directory you like…

cd /tmp

Download the adblock packages: adblock and luci-app-adblock. You will always find the latest versions on these pages: adblock package and luci-app-adblock. It is OK to use the x86_64 packages, because they are not binaries. Use proper links in wget commands below, e.g.:

  wget https://downloads.openwrt.org/snapshots/packages/x86_64/packages/adblock_3.4.3-1_all.ipk
  wget https://downloads.openwrt.org/snapshots/packages/x86_64/luci/luci-app-adblock_git-18.020.50283-194e429-1_all.ipk

Install both packages:

  opkg install adblock_3.4.3-1_all.ipk
  opkg install luci-app-adblock_git-18.020.50283-194e429-1_all.ipk

Enable the module. First of all, check the present state by running:

  /etc/init.d/adblock enabled; echo $?
  1

Please note that the script returned 1, which means the module is NOT enabled (or maybe some other problem).

Enable adblock and check the state again:

   /etc/init.d/adblock enable
   /etc/init.d/adblock enabled; echo $?
   0

Note that adblock will have to be 'enabled' again, elsewhere (in /etc/config/adblock: see below).

Configure service via LuCI interface

Now, go to the LuCI web interface, Services → Adblock page and make the following changes from the 'default' pre-set:

  • make sure “Enable Adblock” is checked (required)
  • change “DNS Backend” to “kresd” (default for Turris Omnia)
  • change “Startup Trigger” to “timed”
  • change “Download utility” to “wget” (required for Turris Omnia)
  • check additional Blocklist Sources, e.g.,: adaway, adguard, blacklist, disconnect, ransomware, winspy, yoyo, zeus
  • you can check “Verbose Debug Logging” (if you would like to check everything is working fine)
  • [optional] check “Force Local DNS

Finally, hit “Save & Apply” button to save all changes and start adblock processing.

Alternatively, configure adblock service via shell

Rather than use LuCI, you can configure adblock via the command line, for example:

  uci set adblock.global.adb_enabled='1'
  uci set adblock.global.adb_dns='kresd'
  uci set adblock.global.adb_trigger='timed'
  uci set adblock.global.adb_fetchutil='wget'
  uci commit
  

Finally start adblock processing with:

  /etc/init.d/adblock reload

Verify your setup

Check the adblock status with the following command or in LuCI in Section “Runtime Information”:

   /etc/init.d/adblock status
   ::: adblock runtime information
     + adblock_status  : enabled
     + adblock_version : 3.4.3
     + overall_domains : 22747 (normal mode)
     + fetch_utility   : /usr/bin/wget (built-in)
     + dns_backend     : kresd (/etc/kresd)
     + last_rundate    : 16.01.2018 13:05:43
     + system_release  : Turris Omnia, OpenWrt omnia 15.05/3.9.2

View log file:

   grep "adblock-" /var/log/messages

Check the existence of new definitions-file for kresd:

   ls -lh /etc/kresd/adb_list.overall
    -rw-r--r--    1 root     root        1.0M Sep 16 23:51 /etc/kresd/adb_list.overall

Let’s try to resolve some Ad-domain:

   nslookup securepubads.g.doubleclick.net localhost
   Server:    127.0.0.1
   Address 1: 127.0.0.1 localhost
   nslookup: can't resolve 'securepubads.g.doubleclick.net': Name does not resolve

If you get “Name does not resolve”, the AdBlocking is working correctly.

Well, and that’s all! Happy ad-blocking! :slight_smile:

Schedule Automatic Updates of the Blocklists

Add a cronjob for regular block list updates (/etc/crontabs/root), e.g. list update every day 6 o'clock in the morning:

  0 06 * * *    /etc/init.d/adblock reload

Troubleshooting

  • if the adblock LuCI interface doesn't come up after installation, reset the luci caches with:
    rm -rf /tmp/luci-*
  • at present the turris package repository includes only an ancient and incompatible adblock version (1.3.3), please do not use/install this version, take only the referenced one.
  • adblock blocks domain access by dns/kresd. Whenever you run into problems with your dns resolver or some pages are not loading, please first try to suspend the adblock service before you contact the turris support. Furthermore you can use the adblock query function (available in LuCI advanced section or via console) to check if a certain domain will be blocked by adblock.
  • Nextcloud is returning HTTP 403 or Transmission client doesn't work just after installation. It's probably some cache in lighthttpd. You can solve it by restarting router.

Upgrade

Follow instruction in Download and install latest packages section.

After installation apply changes in configs (merge adblock-opkg into adblock). After this reload configuration:

  /etc/init.d/adblock reload 

Removal

Stop all adblock related services with

  /etc/init.d/adblock stop; /etc/init.d/adblock disable

Remove the adblock package (and the LuCI page, which depends on it)

  opkg remove adblock --force-removal-of-dependent-packages