dibdot
September 13, 2017, 6:01pm
1
Hi,
in the TurrisOS 5.x package feed you’ll find the adblock package (plus LuCI companion/configuration package) with native kresd support.
current stable version in OpenWrt 19.07.x aka TurrisOS 5.x: adblock 4.0.5-3 plus luci companion package
The latest adblock releases are only compatible with TurrisOS 5.x!
Link to the latest adblock documentation
Main support thread in OpenWrt forum with more detailed installation instructions, version history etc.
Have fun!
Dirk
6 Likes
dbonnes
September 13, 2017, 9:02pm
3
Sorry @dibdot ,
I couldn’t get it working. I did the following:
wget https://downloads.lede-project.org/snapshots/packages/x86_64/packages/adblock_3.0.1-1_all.ipk
wget https://downloads.lede-project.org/snapshots/packages/x86_64/luci/luci-app-adblock_git-17.255.51369-6d4370d-1_all.ipk
opkg install adblock_3.0.1-1_all.ipk
opkg install luci-app-adblock_git-17.255.51369-6d4370d-1_all.ipk
Then:
root@sr-router:~# uci show adblock.global
adblock.global=adblock
…
adblock.global.adb_manmode=‘0’
adblock.global.adb_enabled=‘1’
…
adblock.global.adb_dns=‘kresd’
adblock.global.adb_debug=‘1’
But I get (this is exactly what I get, i.e. no output):
root@sr-router:~# /etc/init.d/adblock start
root@sr-router:~# /etc/init.d/adblock status
root@sr-router:~# cat /var/log/messages | grep adb
Also, cat /var/log/messages | tail provides no useful output.
Any ideas?
dibdot
September 13, 2017, 10:53pm
4
Yes, please enter …
/etc/init.d/adblock enable
… and try it again - that happend in LEDE automatically. Sorry, I’ll add that additional step in the first post.
einar
September 14, 2017, 4:50am
5
Easier setup for kresd, without having to mess with custom configuration. If you have TurrisOS > 3.6, add
list rpz_file "/etc/kresd/adb_list.overall"
to /etc/config/resolver
and restart the resolver itself.
Proof of working from a client machine. Before:
[lb@leon ~]$ host ziheyuan.com
ziheyuan.com is an alias for mymb.jumi.com.
mymb.jumi.com has address 47.89.60.137
After:
[lb@leon ~]$ host ziheyuan.com
Host ziheyuan.com not found: 3(NXDOMAIN)
This post is where the config option is mentioned.
2 Likes
einar
September 14, 2017, 5:12am
6
As an addition, I need to start adblock manually via adblock.sh
or it won’t work:
root@seldon:~# /etc/init.d/adblock enable
root@seldon:~# /etc/init.d/adblock start
root@seldon:~# /etc/init.d/adblock status
After:
root@seldon:~# /usr/bin/adblock.sh
root@seldon:~# /etc/init.d/adblock status
::: adblock runtime information
+ adblock_status : enabled
+ adblock_version : 3.0.1
+ blocked_domains : 5333
+ fetch_utility : wget (built-in)
+ dns_backend : kresd (/etc/kresd)
+ last_rundate : 14.09.2017 07:09:47
+ system_release : OpenWrt omnia 15.05
dibdot
September 14, 2017, 7:24am
7
Thanks, I will add this alternative approach to the online documentation.
dibdot
September 14, 2017, 7:25am
8
Please post the global section of your adblock config.
einar
September 14, 2017, 7:26am
9
Thanks, here it is:
config adblock 'global'
option adb_forcesrt '0'
option adb_forcedns '0'
option adb_whitelist '/etc/adblock/adblock.whitelist'
option adb_whitelist_rset '\$1 ~/^([A-Za-z0-9_-]+\.){1,}[A-Za-z]+/{print tolower(\"^\"\$1\"\\\|[.]\"\$1)}'
option adb_backup '0'
option adb_backupdir '/mnt'
option adb_rtfile '/tmp/adb_runtime.json'
option adb_enabled '1'
option adb_dns 'kresd'
option adb_trigger 'timed'
option adb_manmode '0'
option adb_debug '0'
dibdot
September 14, 2017, 8:03am
10
config looks OK, please make sure that you’ve a S30adblock-entry in /etc/rc.d (if not start /etc/init.d/adblock enable once) and reboot your router … and look afterwards for log entries with …
cat /var/log/messages | grep "adblock"
einar
September 14, 2017, 8:08am
11
I tried to debug a bit myself but I don’t understand LEDE/openWRT’s boot sequence.
Debugging doesn’t give me that much information:
root@seldon:/etc/rc.d# /etc/init.d/adblock start
{ "name": "adblock", "script": "\/etc\/init.d\/adblock", "instances": { "adblock": { "command": [ "\/usr\/bin\/adblock.sh" ], "stdout": true, "stderr": true } }, "triggers": [ [ "config.change", [ "if", [ "eq", "package", "adblock" ], [ "run_script", "\/etc\/init.d\/adblock", "reload" ] ] ] ] }
(I can’t reboot the router at the moment, but the symlink is there)
dibdot
September 14, 2017, 8:15am
12
That looks all OK, just a rough guess: during your first reboot test you’ve the adb_trigger ‘wan’ in your config and that’s currently not supported on turris omnia devices. ‘timed’ should work in any case.
vcunat
September 14, 2017, 9:15am
13
Briefly looking at the docs , having multiple policy.add(policy.all
lines does not do what you intend. The first matching rule wins; if you want kresd to choose automatically from a set of (up to four) IPs, you have to pass a list into a single rule, e.g. see examples in kresd docs .
dibdot
September 14, 2017, 11:06am
14
Thanks for your input, so I assume that this is a correct example, isn’t it?
policy.add(policy.all(policy.FORWARD({‘8.8.8.8’, ‘8.8.4.4’})))
vcunat
September 14, 2017, 11:42am
15
Correct.
Post must be at least 20 characters.
1 Like
dbonnes
September 14, 2017, 7:11pm
16
Well, I feel pretty stupid for missing that one out!
After installing the packages mentioned in first post, i get an error in luci:
/usr/lib/lua/luci/dispatcher.lua:460: Failed to execute cbi dispatcher target for entry '/admin/services/adblock'.
The called action terminated with an exception:
/usr/lib/lua/luci/cbi.lua:53: Model 'adblock' not found!
stack traceback:
[C]: in function 'assert'
/usr/lib/lua/luci/dispatcher.lua:460: in function 'dispatch'
/usr/lib/lua/luci/dispatcher.lua:141: in function </usr/lib/lua/luci/dispatcher.lua:140>
Anyone idea?
dibdot
September 15, 2017, 9:18am
18
Probably a LuCI caching issue. Please submit both commands:
> rm -rf /tmp/luci-*
> /etc/init.d/lighttpd restart
After that it should work … fingers crossed!
2 Likes
dibdot:
rm -rf /tmp/luci-*
Working like a charm, had this before, but didn’t remember the solution! =)
Jirka
September 15, 2017, 11:46am
20
Cant wait to Adblock in official turris repository (possible with sha256sum) What do you think @miska ?
2 Likes