jdhf99

Well-Known Member
Mar 16, 2004
54
0
156
Is there anyway to have this output the new named.conf to something besides named.conf? I have about 31,000 zones and it takes 2-3 hours to rebuild. During the rebuild named no longer functions on the server. It would be great if I could have it rebuild to something like named.new.conf then just swap it out once it's done.

Is there any option for this?

Thanks
 

jdhf99

Well-Known Member
Mar 16, 2004
54
0
156
I did try that... it looks like it built 'one of the views'. I'm not really up to date on my named stuff, I just know a year ago it started making the named file with multiple views. When I changed the fixnamedconf and fixrndc scripts to use named.new.conf it only built one view. When I replaced the named.conf with the newly generayed named.new.conf (half the size) my messages log was spammed with all the zones saying they're not authoritative.
 

stdout

Well-Known Member
Apr 10, 2003
189
7
168
Nelspruit, Mpumalanga, South Africa
cPanel Access Level
Root Administrator
Copy /scripts/rebuildnamedconf to /scripts/rebuildnamedconf2
eg. cp -fp /scripts/rebuildnamedconf /scripts/rebuildnamedconf2

Modify line 50 in /scripts/rebuildnamedconf2, changing the /etc/named.conf path to /etc/named.conf.new
Touch /etc/named.conf.new - eg. touch /etc/named.conf.new

Execute the command:
"/scripts/rebuildnamedconf2; cp -fp /etc/named.conf /etc/named.conf.orig; mv /etc/named.conf.new /etc/named.conf"

The command will:
* generate a new named.conf (named.conf.new)
* copy the original named.conf to named.conf.orig
* rename /etc/named.conf.new to /etc/named.conf
 

rhenderson

Well-Known Member
Apr 21, 2005
778
2
168
Oklahoma
cPanel Access Level
Root Administrator
Just curious if you tested this?

When I first read this post I thought the same thing, so before I posted I did just what you said.

cp the script to /scripts/rebuildnamedconfnew, changed line 50 to read named.conf.new cp the /etc/named.conf to /etc/named.conf.new then ran /scripts/rebuildnamedconfnew and it still only updated the /etc/named.conf so I figured there was something in the include file.

Just curious if I missed something or if something untested was assumed and posted.
 

sirotex

Well-Known Member
Jul 10, 2008
121
0
66
Just curious if you tested this?

When I first read this post I thought the same thing, so before I posted I did just what you said.

cp the script to /scripts/rebuildnamedconfnew, changed line 50 to read named.conf.new cp the /etc/named.conf to /etc/named.conf.new then ran /scripts/rebuildnamedconfnew and it still only updated the /etc/named.conf so I figured there was something in the include file.

Just curious if I missed something or if something untested was assumed and posted.
Wow... re-read what was said, it isn't brain surgery. Why would you pico /scripts/rebuildnamedconfnew to change /etc/named.conf to /etc/named.conf.new then cp /etc/named.conf to /etc/named.conf.new? The whole point is that the script rebuilds in /etc/named.conf.new So you can cp named.conf.new to named.conf once it finishes...
 

stdout

Well-Known Member
Apr 10, 2003
189
7
168
Nelspruit, Mpumalanga, South Africa
cPanel Access Level
Root Administrator
It was just an untested assumption. Looks like even renaming line 44 and commenting out from lins 45 - 58 makes no difference either. Here's a workaround though.

Simply copy/paste this into your CLI:
Code:
cd /var/cpanel/users; grep DNS * | cut -d= -f2 | awk {'print "zone \""$1"\" { type master; file \"/var/named/"$1".db\"; };"'}
You want to pipe the output to a file and include it in named.conf, or just append it to the existing (empty named.conf). It should be alot less CPU usage and alot faster.

* It only generates the zone lines - you'll want the original "top section" of named.conf where the settings are kept as well as the first 1-3 relevant local dns zones.
 
  • Like
Reactions: rhenderson

rhenderson

Well-Known Member
Apr 21, 2005
778
2
168
Oklahoma
cPanel Access Level
Root Administrator
Wow... re-read what was said, it isn't brain surgery. Why would you pico /scripts/rebuildnamedconfnew to change /etc/named.conf to /etc/named.conf.new then cp /etc/named.conf to /etc/named.conf.new? The whole point is that the script rebuilds in /etc/named.conf.new So you can cp named.conf.new to named.conf once it finishes...
Your right it is not brain surgery. No need to re-read I know what was stated. And then again if you wanted to post something useful why dont you instead of acting offended or something.

You have to either cp the named.conf to the new name or touch the new named file, it needs to exist, because on line 50 it is looking for the file to determine if it is *nix of BSD if it cannot find it, it wil error out and not run. I choose to cp the original fie so I can compare sizes and time stamps, but to each his own on that. The other point I was making is that is not where the named.conf output name comes from.

It was just an untested assumption. Looks like even renaming line 44 and commenting out from lins 45 - 58 makes no difference either. Here's a workaround though.

Simply copy/paste this into your CLI:
Code:
cd /var/cpanel/users; grep DNS * | cut -d= -f2 | awk {'print "zone \""$1"\" { type master; file \"/var/named/"$1".db\"; };"'}
You want to pipe the output to a file and include it in named.conf, or just append it to the existing (empty named.conf). It should be alot less CPU usage and alot faster.

* It only generates the zone lines - you'll want the original "top section" of named.conf where the settings are kept as well as the first 1-3 relevant local dns zones.
Very nice!! Thanks for that. I was just curious because initailly I made the same assumption. I added a positive reputation to you for the post.
 
Last edited:

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
/scripts/rebuildnamedconf has long been deprecated. In 11.24 the functionality is replaced by /scripts/rebuilddnsconfig which is more reliable than the older script.

The new script uses a temporary file, rather than updating named.conf in place. At the end, it then overwrites named.conf with the new one.
 

Kasper

Active Member
Aug 26, 2004
28
0
151
Chicago
/scripts/rebuildnamedconf has long been deprecated. In 11.24 the functionality is replaced by /scripts/rebuilddnsconfig which is more reliable than the older script.

The new script uses a temporary file, rather than updating named.conf in place. At the end, it then overwrites named.conf with the new one.
Actually it updates the existing named.conf if you run /scripts/rebuilddnsconfig and even if you specify

$def_namedconf = '/etc/namedb/named.conf.whatever';

on clearcache() sub it still pushes updates to /etc/named.conf

So, if you change it to another one, the cached entries don't get added
If you don't change it, it updates the file /etc/named.conf directly

Using
cpanel-dnsonly(Update for Tue Jan 20 17:03:59 2009)