Custom dns_ns.conf

dlong500

Verified User
Joined
Nov 16, 2004
Messages
80
I have create a custom dns_ns.conf file to add a third name server by default for new accounts (and yes it is in the custom directory) but it is not using my custom template.

The file looks like the following (with my nameserver name changed, of course):
Code:
|NS1|=|DOMAIN|.
|NS2|=|DOMAIN|.
ns3.mythirdnameserver.com.=|DOMAIN|.

Is there some trick that I'm missing? I've restarted DirectAdmin, Bind, and Apache but it is acting as if my custom template doesn't exist. I'm using DirectAdmin 1.33.
 
This will only work for new domains by default. To add it to old domains as well you need to run this command from the shell as root:
Code:
# echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue
and wait about two to three minutes.

Jeff
 
This will only work for new domains by default.
I understand that it only works for new domains. That is what I was saying was not working. Adding a completely new user/domain under a reseller is still only adding the first two nameservers. I must be missing something here...
 
Did you actually add a file as you wrote, or did you copy the existing file to the custom directory and edit it there?

You may need to have someone log in to see the problem if you can't find it.

Jeff
 
I figured out the problem. DirectAdmin requires the template files to have a newline at the end of the file. Once I did this the custom template worked as expected.

This isn't exactly what I would consider a "bug", but it would probably be a good idea to either change DirectAdmin to allow templates without a newline at the end of the file or to make it very clear in the README file that a newline is necessary.

Also, unless I missed something there are no logging options regarding the template system. It would be nice to have the option to enable logging that tracks which template files are used during an operation to make it easier to track down problems like this. I still don't know if DirectAdmin actually used my custom template but threw out the last line because of no newline or ditched the entire custom template and used the default template because of the newline issue.

Also, I did a search for "newline" in the forums just before posting this and did find a post from DirectAdmin support regarding the newline issue, so the issue has come up before. Unfortunately I didn't see that post when searching for "custom templates".
 
Its also good a practice to have a newline at the end of ALL files.
 
Last edited:
Its good a practice to have a newline at the end of ALL files.
That may be true, but it still is not stated in any of the documentation. It is also not required by every other software out there so it can still be easy to miss sometimes, especially since not everyone using DirectAdmin has a programming or in-depth Linux background. Putting something in the README file would still seem prudent.
 
I was adding to your comment not contradicting you.
 
Hello,

Thanks, I've added a note in the REAME in the templates directory to ensure you add a newline.
Lines in DA are defined by having a trailing newline char.

I've also added full suite of debug output options for the tokenizer and the tokenizer scripts:
http://www.directadmin.com/features.php?id=930

Available next release.

John
 
Send me an email with your OS version if you want to try it out now, and I'll compile you a binary set.

John
 
Back
Top