Closed sgreadly closed 3 years ago
Hi,
Just checking for an update - is project still being developed / maintained?
Thanks!
A workaround I've found is to execute the command in /tmp
and it works.
Sorry for the delay, it seems my notifications need adjusting.
Thanks for your help! That fixes it, but raised another area of fault.
$ cd /tmp/
$ sudo /usr/local/bin/ad-blocker.sh
<snip>
2020-04-27 21:45:17 (226 KB/s) - written to stdout [251399]
server reload successful
However, via task scheduler it gives same error. I noticed it when saving the output of (manually) running the scheduled task to file.
You have to again modify the script to run:
cd /tmp/; sudo /usr/local/bin/ad-blocker.sh
However, then you get a new error
Running as root; switching to DNSServer
--2020-04-27 21:56:50-- http://pgl.yoyo.org/as/serverlist.php?hostformat=bindconfig&showintro=0&mimetype=plaintext
<snip>
2020-04-27 21:56:53 (227 KB/s) - written to stdout [251560]
rndc: 'reload' failed: failure
Looking around line 189 of /usr/local/bin/ad-blocker.sh,
reload the server config to pick up the changes
"${RootDir}"/script/reload.sh
}
That reload.sh script seems to want the zone to reload as a parameter, but we're not sending it one.
$ cat /var/packages/DNSServer/target/script/reload.sh
#!/bin/sh
ChrootDir="/var/packages/DNSServer/target/named"
RndcKeyFile=${ChrootDir}"/rndc.key"
BinDir="/var/packages/DNSServer/target/bin"
ZoneName="$1"
. /var/packages/DNSServer/scripts/start-stop-status
ChangeOwner
cd ${BinDir}
**./rndc -k ${RndcKeyFile} reload _${ZoneName}_**
To fix, append the zone name in ad-blocker.sh
"${RootDir}"/script/reload.sh null.zone.file
}
Save, and that should do it. It should show the output now as "zone reload queued", which should be ok. If you run it manually, the second time should show you it's up to date.
Running as root; switching to DNSServer
--2020-04-27 22:17:25-- http://pgl.yoyo.org/as/serverlist.php?hostformat=bindconfig&showintro=0&mimetype=plaintext
<snip>
2020-04-27 22:17:28 (225 KB/s) - written to stdout [251560]
zone reload queued
$ sudo /var/packages/DNSServer/target/script/reload.sh null.zone.file zone reload queued
Wellp.. It seems this project isn't maintained / dead in the water..
Advice for others, get a cheap Raspberry Pi (or any other supported hardware/OS) and install PiHole on it for a better experience, along with proper support.
Thanks @sgreadly -- your solution worked for me. I was getting a different error when running the task scheduler:
chown: changing ownership of '/var/packages/DNSServer/target/named/dev/log': Operation not permitted
server reload successful
After adding the arg to the reload script I'm getting:
2021-02-09 09:33:14 (381 KB/s) - written to stdout [269342]
zone reload queued
This script is such a clean way of ad-blocking it's a shame it's not being maintained.
@moos Happy to help!
Yea :/ Because of that I ended up moving everything onto my Raspberry Pi, running PiHole + Unbound. It also manages my local authoritative doman as well as DHCP - it all magically works without a hassle & lovely interface. If you're interested, https://www.youtube.com/watch?v=FnFtWsZ8IP0
Hi,
I've noticed the following 2 errors when running the script . I tried via sudo, and also as root
sudo su
.sudo /usr/local/bin/ad-blocker.sh
Running as root; switching to DNSServer --2019-10-11 09:32:15-- http://pgl.yoyo.org/as/serverlist.php?hostformat=bindconfig&showintro=0&mimetype=plaintext Resolving pgl.yoyo.org... 213.230.210.230 Connecting to pgl.yoyo.org|213.230.210.230|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/plain] Saving to: 'STDOUT'
2019-10-11 09:32:16 (202 KB/s) - written to stdout [229392]
/bin/find: cannot get current directory: Permission denied chown: missing operand after ‘DNSServer:DNSServer’ Try 'chown --help' for more information. server reload successful
This is on Synology DS916+ running DSM 6.2.2-24922 Update 3 and DNS Server package v 2.2.1-5014
Thanks.