OpenWrt Forum Archive

Topic: adblock package, release 2.x

The content of this topic has been archived between 22 Mar 2018 and 4 May 2018. Unfortunately there are posts – most likely complete pages – missing.

Updated first post to reflect all changes in the first stable adblock release.

best regards
dirk

i have flashed my wndr3700v2 with the hnyman chaos-r48925-20160309 build.  there is an ablock section under the "services" menu.  i have a few questions:

1.  do i simply check the enable adblock box, save and apply, then reboot?
2.  what is the backup option used for?  there is an enable blocklist backup box, and a field to configure the backup directory.  is this used in conjunction with an USB drive as a swap for increasing /tmp?

thank you dibdot, hnyman, and the testers for making adblock easier to use.

wrtboy wrote:

1.  do i simply check the enable adblock box, save and apply, then reboot?

Almost so. But there is no need to reboot. Just save and apply. That will start the adblock operations.

(My own build has adblock disable initially, so you need to toggle the enable option. Normally the package is enabled right after installation.)

Note on a separate issue: for trunk users the easiest installation method is "opkg install luci-app-adblock" that will install also the adblock itself in addition to the Luci app.

(Last edited by hnyman on 11 Mar 2016, 11:57)

wrtboy wrote:

2.  what is the backup option used for?  there is an enable blocklist backup box, and a field to configure the backup directory.  is this used in conjunction with an USB drive as a swap for increasing /tmp?

Here's the suitable excerpt from the adblock online documentation ...

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

i have formatted an old 64mb USB into ext4.  i believe the hnyman chaos-r48925-20160309 build comes with USB auto-mounting feature.  i now see there is a new mount point showing /mnt/sda1.

to enable the adblock backup restore feature, do i simply enable the check box and list /mnt/sda1 as the backup directory?

wrtboy wrote:

i have formatted an old 64mb USB into ext4.  i believe the hnyman chaos-r48925-20160309 build comes with USB auto-mounting feature.  i now see there is a new mount point showing /mnt/sda1.

to enable the adblock backup restore feature, do i simply enable the check box and list /mnt/sda1 as the backup directory?

Yes, that's all! ;-)
Edit: I forgot to mention that an adblock restart afterwards (etc/init.d/adblock restart), will generate a full set of fresh block lists plus backups.

(Last edited by dibdot on 12 Mar 2016, 07:15)

dibdot wrote:

Edit: I forgot to mention that an adblock restart afterwards (etc/init.d/adblock restart), will generate a full set of fresh block lists plus backups.

i followed your guidance and the adblock is working on the hnyman CC builds.  i don't fully understand by the adblock restart comment.  i used a WinSCP.exe program to look at router files and i do see an adblock file in the etc/init.d/ directory but i don't see an adlock restart file.  am i missing something with my configuration?

i noticed whenever i do a reboot, the backup files in the /mnt/sda1 are also updated.  does the adblock program auto update block lists or its refresh is dependent on restarts or reboots.

(Last edited by wrtboy on 14 Mar 2016, 17:03)

wrtboy wrote:

i do see an adblock file in the etc/init.d/ directory but i don't see an adlock restart file.  am i missing something with my configuration?

No, "/etc/init.d/adblock" is the script file and "restart" is the command you give to it from console. (or "stop", "start" etc. the standard commands given to Openwrt service startup scripts...)

"/etc/init.d/adblock restart" would be the complete command you type on the console. That forces the adblock service to reinitialize itself (and to download the changed blocklists).

To my knowledge there is no automatic "timed" update of the blocklists, but they update checked at a reboot of the router or a restart of the adblock service.

(Last edited by hnyman on 14 Mar 2016, 17:25)

thank you both hnyman and dibdot.  my wndr3700v2 is running great with the hnyman CC r49004 build with the dibdot adblock package.

wrtboy wrote:

i noticed whenever i do a reboot, the backup files in the /mnt/sda1 are also updated.  does the adblock program auto update block lists or its refresh is dependent on restarts or reboots.

for a regular update of the block lists you can add a crontab entry like that ...

# configuration found in /etc/crontabs/root
# start adblock script once a day at 6 a.m.
#
0 06 * * *    /etc/init.d/adblock start

... and only updated sources will be downloaded & processed by adblock.

i thought about it and i've decided to schedule weekly reboots since i have read atheros chipsets can also benefit from weekly reboots for stability--hitting two birds with one stone.  thanks again to both hnyman and dibdot for making this so easy.

# configuration found in /etc/crontabs/root
# reboot router every saturday at 3 a.m.
#
0 3 * * 6 reboot

(Last edited by wrtboy on 15 Mar 2016, 18:14)

wrtboy wrote:

i thought about it and i've decided to schedule weekly reboots

Be aware about the risk of a reboot loop when rebooting with cron. Most routers do not have any real-time clock, so at the boot Openwrt uses the most recent timestamp of files in /etc as the approximation of the time and then launches ntpd to fetch the correct time from internet, but that may take a few seconds. With bad luck, the router starts from a time a few seconds earlier than the earlier reboot, and cron may make it to reboot again before ntpd gets the correct time from internet. You might read:
https://forum.openwrt.org/viewtopic.php?id=54227 and https://wiki.openwrt.org/doc/howto/cron … f_a_router

consider this line for crontab:
0 3 * * 6 sleep 70 && touch /etc/banner && reboot

I got a question. Sorry if the answer is already in this topic.


How to simply add ads pages or url to block additional ads , like on youtube, twitchtv etc.. (like on gargoyle)

I need a simple procedure. smile Thanks.

(Last edited by scrmtrey on 15 Mar 2016, 18:42)

scrmtrey wrote:

I got a question. Sorry if the answer is already in this topic.


How to simply add ads pages or url to block additional ads , like on youtube, twitchtv etc.. (like on gargoyle)

I need a simple procedure. smile Thanks.

ad blocking is domain based ... to add additional domains simply edit /etc/adblock/adblock.blacklist (one domain per line, no regex!) and finally start adblock service again (/etc/init.d/adblock start).

Thanks for reply.
Where can i found the domain name for google ads and from ads on twitch tv ?
Is there any really large list (all in one) ?

scrmtrey wrote:

Thanks for reply.
Where can i found the domain name for google ads and from ads on twitch tv ?
Is there any really large list (all in one) ?

Please follow the documentation link in the first post for a short description on every blocklist source, adblock supports 16 blocklist sources ... if you really need additional domains on the blacklist, trace it on your own, see here

hnyman wrote:

Be aware about the risk of a reboot loop when rebooting with cron.

i have digested your recommended reads and updated my cron script.  thanks so much.

I have backported adblock 1.0.0 and luci-app-adblock to the Chaos Calmer 15.05 source code repositories now that Chaos Calmer 15.05.1 has been released.
https://github.com/openwrt/packages/tre … et/adblock
https://github.com/openwrt/luci/tree/fo … pp-adblock

Note: adblock and luci-app-adblock packages are NOT available as .ipk packages in the 15.05.1 download repos, but instead the packages can be selected via "make menuconfig" if you build your own firmware. (selecting luci-app-adblock will automatically include also adblock itself.)

hnyman wrote:

I have backported adblock 1.0.0 and luci-app-adblock to the Chaos Calmer 15.05 source code repositories now that Chaos Calmer 15.05.1 has been released.

Thank you! smile

I´ve configured my system as client (no wan interface), which will only provide a tor network and secure dns.

Now, adblock states:

adblock[30579] error: LAN only (lan) network, no valid IPv4/IPv6 wan update interface found, rc: 125


Can i somehow overcome this issue ? Thank you

Edit: Just read page 3. Anyway, is there a possibility ?

(Last edited by sok on 16 Mar 2016, 20:15)

sok wrote:

Edit: Just read page 3. Anyway, is there a possibility ?

no, sorry it's not supported.

Absolutely phenomenal work, Dirk and Hannu. Great package, functionality, and luci frontend as well.  The documentation on github is fantastic too.  Thank you for creating and sharing this work with the community in an easy to use and easy to understand way.  Cheers!

(Last edited by WildByDesign on 17 Mar 2016, 03:05)

Just a brief question regarding the following config option:

adb_wanif => name of the logical wan interface (default: 'wan')

On my router, wan is listed as:  eth0.2

So I was just not sure if, by "logical" that is referring to the plain title of "wan" or the more technical name of "eth0.2" in my case.

Thank you for your time.

EDIT:  I apologize, but I have one other basic level question that I wanted to clarify.

I definitely want to make use of the pixel server option for using uhttpd to replace ads with transparent pixel which seems to be the default with your package which is great.  But what I am curious about is if the default will work for my network setup.  So far everything appears to be working appropriately, the adblock service has downloaded and prepared the default blocklists and running, but no ads are being blocked yet.  So I am just troubleshooting that right now. My second question is regarding this option:

adb_nullipv4 => IPv4 blackhole ip address (default: '192.0.2.1')

My OpenWrt is configured to 192.168.0.5 and so I see that, by default, adblock service has uhttpd listening/filtering on 192.0.2.1.  Will the default work based on my setup?  Or would I need to set the uhttpd setting (nullipv4) to something like 192.168.0.10?

Sorry for my basic questions.  I am just trying to get a better understanding. Thank you.

(Last edited by WildByDesign on 17 Mar 2016, 15:56)

WildByDesign wrote:

adb_wanif => name of the logical wan interface (default: 'wan')

On my router, wan is listed as:  eth0.2
So I was just not sure if, by "logical" that is referring to the plain title of "wan" or the more technical name of "eth0.2" in my case.

It's all OK, no need to change anything. The script uses an openwrt internal function to find the logical interface which holds the current IPv4/IPv6 default route, in your case logical interface: "wan" and logical device: "eth0.2"

WildByDesign wrote:

My OpenWrt is configured to 192.168.0.5 and so I see that, by default, adblock service has uhttpd listening/filtering on 192.0.2.1.  Will the default work based on my setup?

Yes, no need to change anything. The adblock uhttpd instance uses an ip address from the private 'TEST-NET-1' subnet (192.0.2.1 / ::ffff:c000:0201) by default and all ad related domains will be redirected to this (pixelserver) ip.

To check if adblock works, please keep an eye on the adblock statistics ... after you've visited some ad related sites run '/etc/init.d/adblock start' again and you should see something like this:

[...]
adblock[10296] info : adblock firewall statistics (IPv4/IPv6):
adblock[10296] info : 179/0 packets redirected in PREROUTING chain
adblock[10296] info : 0/0 packets rejected in FORWARD chain
adblock[10296] info : 0/0 packets rejected in OUTPUT chain
adblock[10296] info : domain adblock processing finished successfully (1.0.0, r49006, 17.03.2016 18:10:24)

If all counters are still "0" then drop me a mail (openwrt@brenken.org) for further analysis.

Thanks for using adblock!

@dibdot  Thank you, sir.  I appreciate you taking your time to respond.

You did a great job of clarifying both of my questions and thanks to your detailed explanations, I now have a much better understanding of how to configure and how things work as well.  Also, that is also a great testament to the way that you've coded and designed this adblock package; very smart work.

Now, I was able to confirm that everything is working correctly now.  I do have a follow-up question though, if you have a moment.  Also, I know that you had suggested further questions to your email address, but I have a feeling that the scenario that I am about to inquire about may be beneficial to other users and therefore I figured that it might be best to ask my next question in this open forum so that the answers to follow may help others potentially.

First, just to confirm that my setup is functioning correctly:

Thu Mar 17 14:02:04 2016 user.notice adblock[7532] info : domain adblock processing started (1.0.0, 15.05.1, 17.03.2016 14:02:04)
Thu Mar 17 14:02:05 2016 user.notice adblock[7532] info : backup/restore will be disabled
Thu Mar 17 14:02:05 2016 user.notice adblock[7532] info : => processing adblock source 'adaway'
Thu Mar 17 14:02:06 2016 user.notice adblock[7532] info :    source doesn't change, no update required
Thu Mar 17 14:02:06 2016 user.notice adblock[7532] info : => processing adblock source 'disconnect'
Thu Mar 17 14:02:06 2016 user.notice adblock[7532] info :    source doesn't change, no update required
Thu Mar 17 14:02:06 2016 user.notice adblock[7532] info : => processing adblock source 'yoyo'
Thu Mar 17 14:02:07 2016 user.notice adblock[7532] info :    source doesn't change, no update required
Thu Mar 17 14:02:07 2016 user.notice adblock[7532] info : adblock lists with overall 6051 domains are still valid, no dnsmasq restart required
Thu Mar 17 14:02:07 2016 user.notice adblock[7532] info : adblock firewall statistics (IPv4/IPv6):
Thu Mar 17 14:02:07 2016 user.notice adblock[7532] info : 414/0 packets redirected in PREROUTING chain
Thu Mar 17 14:02:07 2016 user.notice adblock[7532] info : 0/0 packets rejected in FORWARD chain
Thu Mar 17 14:02:07 2016 user.notice adblock[7532] info : 0/0 packets rejected in OUTPUT chain
Thu Mar 17 14:02:07 2016 user.notice adblock[7532] info : domain adblock processing finished successfully (1.0.0, 15.05.1, 17.03.2016 14:02:07)

My initial scenario which I believe was causing problems with adblock:

Pushing DNS addresses out specifically to clients.  For example, there are some iPads and iPhones and other devices on my network which go out to children's devices.  So I was using OpenWrt to forcefully push OpenDNS Family Shield DNS addresses out to clients by default using list dhcp_option '6,208.67.222.123,208.67.220.123' within the dhcp config file.  So, instead of all clients receiving the typical gateway IP (example, 192.168.0.1) showing under individual clients for DNS address, they all would actually list the two IPs for OpenDNS Family Shield.

So once I got rid of that functionality and stopped pushing out the DNS to clients, now just using the typical router gateway IP as DNS, now your adblock was functioning perfectly for all of the devices on my network.

Previously, I had it setup so that, similar to your adblock, I had dnsmasq filtering within OpenWrt using Peter Lowe's hosts (yoyo) and all DNS requests also went through OpenDNS.

Question:

Is there a way that I can utilize your adblock for filtering and also have DNS requests forwarded through OpenDNS or other?

Thank you for your time.