Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSM 6.1 and ";dynamic" alternative #20

Open
WolfspiritM opened this issue Feb 27, 2017 · 4 comments
Open

DSM 6.1 and ";dynamic" alternative #20

WolfspiritM opened this issue Feb 27, 2017 · 4 comments

Comments

@WolfspiritM
Copy link
Contributor

Hello,

So I recently noticed that my diskstation ends up getting very slow from time to time and only a reboot fixes it. "top" as well as "ps" aren't giving any results. Just telling me the "load average" is high even so no process is using a high amount of CPU. I wasn't able to figure out what the reason is yet but once I disabled the polling on boot I haven't had any issues anymore. I also found a note somewhere that someone else had troubles with another script that was set to boot automaticly from "rc.d" caused high load for him even so it wasn't doing anything. It MIGHT have something to do with DSM 6.1 beta (and now release) so I just thought I'd mention it here.
Maybe someone else has noticed the same.

However I also noticed that a recent change (might be a bit older so not sure if it's related to 6.1 but I just noticed) in DNSServer seems to block updating zone records with comments. As I implemented the ";dynamic" workaround a while ago it was able to edit these records in the Frontend and it automaticly removed the comment marking it as static. Now it seems to break saying it can't find the record in /var/logs/message and telling me to relog into DSM.

So I thought about another way to figure out which records are static and which ones are dynamic and came up with this solution:
Instead of checking for ";dynamic" I'd check for the second column to be "86400".
This seems to be the default value for DHCP Client (maybe we can make this dynamic to really check for the value in the dhcp lease file).
Now we remove all records that match the default value while preserving all others.
That means to make a record static set its DNS TTL to 86401 and you're done.
At the same time it makes the DNSServer Frontend happy as it is all valid.
Any thoughts? Maybe better ideas? If not I'll open a merge request (there is still one open from me. So not sure if that got missed.)

As a slightly related question:
Why are the permissions of the zonefile changed to "nobody:nobody" instead of DNSServer:DNSServer?
That prevents editing it in the frontend completly.
Or is that to prevent crosswriting/reading?

@gclayburg
Copy link
Owner

Hi @WolfspiritM I haven't looked at this part of the script in quite a while. I do remember your changes from some time ago and it worked really well for me. I'm certainly open to changes to make this better.

As far as the permissions go, that part has been there since the original version by Tim Smith. I'm assuming that just to make sure that named can still read and write the files. Under DSM 5.1, named runs as "nobody" - at least for me anyway:

DiskStation> ps | grep name
 3276 root      3772 S    grep name
31485 nobody   17008 S    /var/packages/DNSServer/target/bin/named -t /var/packages/DNSServer/target/named -u nobody

@WolfspiritM
Copy link
Contributor Author

Ah okay!
So this has been another change in DSM 6.1 it seems:

root@nas:~# ps aux|grep name
root      1094  0.0  0.0  23120   976 pts/10   S+   08:54   0:00 grep --color=auto name
DNSServ+ 13954  0.0  0.9  73400 18708 ?        Ss   Feb27   1:48 /var/packages/DNSServer/target/bin/named -t /var/packages/DNSServer/target/named -u DNSServer

While DNSServ+ is actually DNSServer.

So this should be removed or done differently otherwise DSM is having troubles editing it. Reading seems to be no problem. All the other files are like that aswell:

root@nas:/var/packages/DNSServer/target/named/etc/zone/master# ls -la
total 40
drwxr-xr-x 1 DNSServer DNSServer  398 Mar  1 00:00 .
drwxr-xr-x 1 DNSServer DNSServer   58 Feb 27 23:41 ..
-rw-r--r-- 1 DNSServer DNSServer 2596 Mar  1 00:00 178.168.192.in-addr.arpa
drwxr-xr-x 1 DNSServer DNSServer  286 Nov 15 18:08 backup
-rw-r--r-- 1 DNSServer DNSServer  243 Feb 27 23:49 domain.loc

I will take a look at it the next days :-)

@gclayburg
Copy link
Owner

BTW, as far as the ;dynamic issue goes, your fix from a while ago has been working fine for me. It was a much more elegant solution to the problem. I wonder if the issue here is just related to the file permissions?

@WolfspiritM
Copy link
Contributor Author

Yes I'd prefer keeping the ";dynamic" solution, too.
Sadly even after fixing the file permissions I wasn't able to get the DNS Server frontend to edit lines that contain ";dynamic" as it seems like they made the search for the correct line more "aggressive".
The Logfile gives me an error that it can't find the line while the frontend tells me to relog.
As soon as I remove ";dynamic" it does work again.

Will give it more tries soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants