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.

WildByDesign wrote:

When utilizing DNS based filtering such as this Adblock script or others which can use quite large domain lists at times, would there be any benefit to increasing DNSmasq cachesize?

If there was to be some benefit of increasing DNSmasq cachesize along with this Adblock script, would it be beneficial to add the ability to change your cachesize within the Services - Adblock page, perhaps on the Extra Options drop down menu?

Thanks.

I'm running dnsmasq with a chachesize of 1000. By default dnsmasq has the cache size to keep the last 150 entries. If there is no space in the cache to store a new positive DNS response it will replace an older entry - adblock itself doesn't benefit from a bigger cachesize.

WildByDesign wrote:

@dibdot, I just wanted to mention that you are doing a fantastic job with regard to developing, supporting, and maintaining your Adblock script/package for OpenWrt, Dirk.  I am very thankful.

Thank you!

WildByDesign wrote:

In the example image, pressing the REFRESH button would essentially run the /etc/init.d/adblock start command and pull the stats of how many ad domains were blocked.  Although since I am not a programmer, I do not know if this is even technically feasible.  So just a concept idea at the moment.

In general it's no problem to write these kind of information (last run plus blocked packet counter) in the adblock config file ... stay tuned! wink

(Last edited by dibdot on 27 May 2016, 16:28)

dibdot wrote:

In general it's no problem to write these kind of information (last run plus blocked packet counter) in the adblock config file ... stay tuned! wink

Storing this data under /etc/config/adblock (as already happening for adb_src_timestamp and adb_src_count) increases the number of flash writes quite significantly, especially if the lovely ISP in all its wisdom enforces a reconnect every 24h.

slh wrote:
dibdot wrote:

In general it's no problem to write these kind of information (last run plus blocked packet counter) in the adblock config file ... stay tuned! wink

Storing this data under /etc/config/adblock (as already happening for adb_src_timestamp and adb_src_count) increases the number of flash writes quite significantly, especially if the lovely ISP in all its wisdom enforces a reconnect every 24h.

You are right, the original openwrt goal has been to avoid unnecessary flash writes. This practice goes against that. But on the other hand it adds the user experience on LuCI side, so it looks ok to me. Todays flash modules write endurance has probably been increased to more than 1 million erase-write cycles ... and there is only one "commit" at the end of processing.

If you prefer a "purist" mode without any bells & whistles than change one line in adblock-helper.sh:

line no. 651:
#  "${adb_uci}" -q commit "adblock"
   "${adb_uci}" -q revert "adblock"
dibdot wrote:
dibdot wrote:
inakiregister wrote:

Hi,
Is it possible to temporally disable the blocking? Like toggling it on/off?
To be clear, I want to toggle the action of blocking on & off, and not the action of updating the list.

cool idea - I'll add this feature with the next release. wink

adblock 1.1.15 (released today) includes this new feature ...

[...]
adblock[2508] info : adblock lists with overall 101578 domains loaded
adblock[2508] info : new adblock list backups generated
adblock[2508] info : firewall statistics (IPv4/IPv6): 0/0 ad related packets blocked
adblock[2508] info : domain adblock processing finished successfully (1.1.15, r412, 26.05.2016 18:40:23)

root@blackhole:/etc/init.d$ /etc/init.d/adblock toggle
adblock[3222] info : toggle for adblocking switched 'off'

root@blackhole:/etc/init.d$ nslookup doubleclick.net
Name:      doubleclick.net
Address 1: 172.217.21.174 fra07s64-in-f14.1e100.net
Address 2: 2a00:1450:4001:80f::200e fra07s64-in-x0e.1e100.net

root@blackhole:/etc/init.d$ /etc/init.d/adblock toggle
adblock[3274] info : toggle for adblocking switched 'on'

root@blackhole:/etc/init.d$ nslookup doubleclick.net
Name:      doubleclick.net
Address 1: 192.168.254.250 blackhole.linuxad.lan

I just tried and it worked exactly as expected.

'Toggling' wasn't an idea of mine, but a feature that another OpenWRT adblock implementation has and I find useful.

The work is excellent and your commitment to this package and its users is amazing. Thank you very much.

dibdot wrote:
vjg wrote:

Can I block with this adblock for example google.com?

I added "google.ru" and saved file but I can open google.ru anyway. Why?

did you (re-)start adblock afterwards? If not, please start adblock service again (/etc/init.d/adblock start)

Dirk, thank you. This works.

1. Can I make white list to block all web sites which except the ones listed in a White List. For example, my white list is "google.com". Can I block all websites except "google.com"? 

2. I have some PC connected to router. Can I include this option with White list to some PC?

For example, computer N1 - white list="google.com". All websites except "google.com" are blocked.

computer N2 - I can visit all websites.

computer N1 and computer N2 connect to router with your adblock.

(Last edited by vjg on 28 May 2016, 23:53)

vjg wrote:

1. Can I make white list to block all web sites which except the ones listed in a White List. For example, my white list is "google.com". Can I block all websites except "google.com"? 

2. I have some PC connected to router. Can I include this option with White list to some PC?

"No" & "No"

So, AP Mode doesn't seem to be working. I'm using CC.

I've changing ports 80 and 443 to 88 and 445 (and can only see Luci throught 192.168.1.1:88, for example), but no ads are being blocked.

config uhttpd 'main'
list listen_http '0.0.0.0:88'
    list listen_http '[::]:88'
    list listen_https '0.0.0.0:445'
    list listen_https '[::]:445'

Am I missing something?

(Last edited by Seketh on 29 May 2016, 18:27)

Seketh wrote:

So, AP Mode doesn't seem to be working. I'm using CC.
Am I missing something?

I don't know ... AP mode worksforme & others ... any logs?

dibdot wrote:

I don't know ... AP mode worksforme & others ... any logs?

What should I be looking for? In system log it seems to be loading correctly:

Sun May 29 17:42:22 2016 user.notice adblock[981] info : adblock service started due to 'ifup' of 'lan' interface
Sun May 29 17:42:24 2016 user.notice adblock[1183] info : domain adblock processing started (1.1.15, r48532, 29.05.2016 17:42:24)
Sun May 29 17:42:24 2016 user.notice adblock[1183] info : AP mode enabled
Sun May 29 17:42:25 2016 user.notice adblock[1183] info : backup/restore will be disabled
Sun May 29 17:42:25 2016 user.notice adblock[1183] info : created volatile IPv4 firewall ruleset
Sun May 29 17:42:25 2016 user.notice adblock[1183] info : created volatile uhttpd instance
Sun May 29 17:46:23 2016 user.notice adblock[1183] info : adblock lists with overall 6117 domains loaded
Sun May 29 17:46:23 2016 user.notice adblock[1183] info : firewall statistics (IPv4/IPv6): 0/0 ad related packets blocked
Sun May 29 17:46:23 2016 user.notice adblock[1183] info : domain adblock processing finished successfully (1.1.15, r48532, 29.05.2016 17:46:23)

(Last edited by Seketh on 29 May 2016, 19:07)

Seketh wrote:
dibdot wrote:

I don't know ... AP mode worksforme & others ... any logs?

What should I be looking for? In system log it seems to be loading correctly:

OK, that looks OK. Please ssh to your router and type ...

ping doubleclick.net

... this should be answered with the local AP ip address. If so, make sure that all your clients use the dnsmasq server on your router ...

[...]
adblock[8675] info : adblock lists with overall 6117 domains loaded
adblock[8675] info : firewall statistics (IPv4/IPv6): 0/0 ad related packets blocked
adblock[8675] info : domain adblock processing finished successfully (1.1.16, r418, 29.05.2016 20:17:41)
root@blackhole:~# ping doubleclick.net
PING doubleclick.net (192.168.254.250): 56 data bytes
64 bytes from 192.168.254.250: seq=0 ttl=64 time=0.175 ms
64 bytes from 192.168.254.250: seq=1 ttl=64 time=0.124 ms
dibdot wrote:

... this should be answered with the local AP ip address. If so, make sure that all your clients use the dnsmasq server on your router ...

I seem to have misunderstood what AP mode means then, I have disabled DHCP, it's handled by my ISP router. It's a dumb AP as openwrt wiki calls it.

Although I'm rather confused. What is the difference between "normal" and AP mode in adblock?

Seketh wrote:
dibdot wrote:

... this should be answered with the local AP ip address. If so, make sure that all your clients use the dnsmasq server on your router ...

I seem to have misunderstood what AP mode means then, I have disabled DHCP, it's handled by my ISP router. It's a dumb AP as openwrt wiki calls it.

Although I'm rather confused. What is the difference between "normal" and AP mode in adblock?

Dump AP mode is not supported - regarding adblock AP mode see online doc:

[...]
usual setup with enabled 'iptables', 'dnsmasq' and 'uhttpd' - dump AP modes without these basics are not supported!
[...]
For that purpose adblock uses an ip address from the private 'TEST-NET-1' subnet (192.0.2.1 / ::ffff:c000:0201) by default (in AP mode the local router ip address will be used).
[...]

but it's no problem to split DHCP/DNS ... make sure that your existing DHCP server propagate the routers dnsmasq server as default, you only need the dns server part ... good luck.

dibdot wrote:

but it's no problem to split DHCP/DNS ... make sure that your existing DHCP server propagate the routers dnsmasq server as default, you only need the dns server part ... good luck.

Could be an option, but I think it's an overly complicated solution for a home network. I ended up using another setup.

Just wanted to say thank you for your time in answering my noobish questions and for adblock! wink

when I install it I get an error "uci" How I can debug it in order to help? I passed on LEDE

adblock[8612] info : adblock installation finished successfully, 'opkg' currently locked by package installer
Configuring luci-app-adblock.
uci: Parse error (invalid command) at line 63, byte 1
adblock[8641] info : domain adblock processing started (1.1.15, r483, 01.06.2016 22:32:11)
adblock[8641] info : backup/restore will be disabled
Foguet wrote:

when I install it I get an error "uci" How I can debug it in order to help? I passed on LEDE

worksforme (retested on LEDE r483)... might be unrelated to adblock.

root@pi2wrt:/tmp$ opkg install adblock_1.1.15-1_all.ipk 
Installing adblock (1.1.15-1) to root...
Configuring adblock.
adblock[2754] info : adblock installation finished successfully, 'opkg' currently locked by package installer
root@pi2wrt:/tmp$ opkg install luci-app-adblock_git-16.151.26687-f4af114-1_all.ipk 
Installing luci-app-adblock (git-16.151.26687-f4af114-1) to root...
Configuring luci-app-adblock.
root@pi2wrt:/tmp$ /etc/init.d/adblock start
adblock[3139] info : domain adblock processing started (1.1.15, r483, 02.06.2016 06:38:46)
[...]

I wonder if anyone can help - noticed that adblock is acting as an Open DNS Resolver on the WAN side : http://www.thinkbroadband.com/tools/dnscheck.html

If I disable adblock and restart the router or dnsmasq the issue isn't there, re-enable and it's back. I can only assume adblock is responding to DNS requests on the WAN interface - is there a way to block this?

I'm running DD and latest version of adblock - tried a clean-flash of OpenWRT with no config and just installing adblock and get the same results.

Any ideas anyone?

Thanks!

madmic wrote:

I wonder if anyone can help - noticed that adblock is acting as an Open DNS Resolver on the WAN side : http://www.thinkbroadband.com/tools/dnscheck.html

Sounds strange.
For me your test works ok (at least using ipv6 as test defaults to that):

Success! We detected your IP address as 2001:...:4781:ca76 and did not find an open DNS resolver running.

In there anything special on your internet connection / settings?

(Last edited by hnyman on 3 Jun 2016, 09:35)

Thanks for the reply - I was a bit stuck figuring it out too - seems to be like adblock is bound to the external DNS

Nothing special I can see - I'm on a Virgin Media link, using their "superhub" in modem mode - I get DHCP WAN ip from them.

I've read the adblock configuration manual through and can't see any way of changing the bindings - the interface defaults to LAN - so I guess I'll try that.

Any other ideas?

madmic wrote:

Thanks for the reply - I was a bit stuck figuring it out too - seems to be like adblock is bound to the external DNS

Nothing special I can see - I'm on a Virgin Media link, using their "superhub" in modem mode - I get DHCP WAN ip from them.

I've read the adblock configuration manual through and can't see any way of changing the bindings - the interface defaults to LAN - so I guess I'll try that.

Any other ideas?

yes, please retest with 1.1.16 ... as a workaround in 1.1.15 you can set 'adb_forcedns' to '0' and restart adblock afterwards.

(Last edited by dibdot on 3 Jun 2016, 15:05)

Not sure how to build packages - had a read and looks beyond the time the Mrs will allow me to play :-)

Installed 1.1.15 again and set adb_forcedns to 0 - issue has been cleared - thanks for the help everyone.

I'll wait for the ipk to be generated and will install that.

Hi,
I don't know if I have found a bug or if it was just my problem.
Anyway, I noted that if I have blocklist backup enabled and add some domain in the whitelist,
the domain remains blocked after restarting adblock.
I disabled the backup, restarted adblock and then the domain was correctly whitelisted.

EDIT: I was joking, I can't whitelist a domain!
I put the entry in /etc/adblock/adblock.whitelist but nothing, the domain remains blocked.

(Last edited by positronik on 4 Jun 2016, 20:35)

positronik wrote:

Hi,
I don't know if I have found a bug or if it was just my problem.

me too ... wink
did you read the online doc (see first post for a link)? which blocklists are activated? which domain should be whitelisted?

dibdot wrote:
positronik wrote:

Hi,
I don't know if I have found a bug or if it was just my problem.

me too ... wink
did you read the online doc (see first post for a link)? which blocklists are activated? which domain should be whitelisted?


root@OpenWrt:~# cat /etc/adblock/adblock.whitelist 
mailchimp.com
root@OpenWrt:/storage# grep -e mailchimp.com adb_list.shalla
address=/mailchimp.com/192.0.2.1
address=/mailchimp.com/::ffff:c000:0201

I grepped the stored shalla's list because I had to disable it to access that domain...