BIND 9, chroot, named_flags = fail

Discussion related to network/web services such as Apache, BIND Sendmail, etc.

BIND 9, chroot, named_flags = fail

Postby ts_fbsd » 13 Mar 2012, 15:33

I'm running FreeBSD 9 and I recently instlaled [FILE]bind98[/FILE] from ports. Install went fine. However, my previous configuration ([FILE]bind96[/FILE]) did not work with this version of BIND. Well, the configuration was okay, but the [FILE]rc.conf[/FILE] setup didn't work. It looks like [FILE]bind98[/FILE] ignored my "[FILE]named_flags[/FILE]" settings:

Code: Select all
named_flags="-u bind -c /etc/named.conf"


That path is relative to my chroot for BIND. [FILE]bind98[/FILE] seems to only want to load [FILE]named.conf[/FILE] from the following location:
[file]/etc/namedb/named.conf[/file]

All the other [FILE]rc.conf[/FILE] settings are okay, but unless I have [file]named.conf[/file] in [file]/etc/namedb/[/file], startup fails with the message:

Code: Select all
/etc/rc.d/named: ERROR: get_pidfile_from_conf: /etc/namedb/named.conf does not exist (named)


If I start [FILE]named[/FILE] manually, it is able to pick up my configuration file. This works fine:

[cmd=]named -u bind -t /var/chroot/named -c /etc/named.conf[/cmd]

So, my question is: did something change in the way [FILE]bind98[/FILE] works in regards to the location of the configuration? Does it have to be in that specific location? Or, is there a bug in the [file]/etc/rc.d/named[/file] startup script?

Thanks for whatever information you can provide.
ts_fbsd
Junior Member
 
Posts: 2
Joined: 13 Mar 2012, 15:16

Postby SirDice » 13 Mar 2012, 15:49

The standard BIND also uses [file]/etc/named/named.conf[/file]. This has been the case for as long as I can remember.

From [file]/etc/defaults/rc.conf[/file]:
Code: Select all
named_conf="/etc/namedb/named.conf"     # Path to the configuration file
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16185
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby ts_fbsd » 13 Mar 2012, 17:50

Yes, but I used to be able to override that with the "[FILE]named_flags[/FILE]" variable in [FILE]/etc/rc.conf[/FILE]. Alas, looking in [FILE]/etc/default/rc.conf[/FILE], I see that the "[FILE]-c[/FILE]" and "[FILE]-u[/FILE]" options seem to have been deprecated from the "[FILE]named_flags[/FILE]" variable:

Code: Select all
#named_flags=""                 # Use this for flags OTHER than -u and -c


So, now if I try to use the "[FILE]named_conf[/FILE]" variable to specify the [FILE]named.conf[/FILE] file, it still doesn't work:

Code: Select all
named_conf="/etc/named.conf"

...

# /etc/rc.d/named start
/etc/rc.d/named: ERROR: get_pidfile_from_conf: /etc/named.conf does not exist (named)


And if I try to specify the full path in the "named_conf" variable, I get another error about includng the path to my chroot:
Code: Select all
named_conf="/var/chroot/named/etc/named.conf"

...

# /etc/rc.d/named start
/etc/rc.d/named: WARNING: named chroot: /var/chroot/named/etc is a directory!
rndc-confgen: create keyfile: file not found
Starting named.
named: config filename (-c /var/chroot/named/etc/named.conf) contains chroot path (-t /var/chroot/named)
/etc/rc.d/named: WARNING: failed to start named


If I leave the config file as [FILE]/etc/namedb/named.conf[/FILE] in [FILE]/etc/defaults/rc.conf[/FILE] then everything works fine and dandy. However, I've had my config file in [FILE]/etc/named.conf[/FILE] in the [FILE]named[/FILE] chroot for the past 12 years without a problem, and I just hate having to change it because a startup script isn't properly reading the value of a variable. :-/

Still, thanks for pointing out that information. At least now I know that [FILE]-u[/FILE] and [FILE]-c[/FILE] are no longer used in "[FILE]named_flags[/FILE]".
ts_fbsd
Junior Member
 
Posts: 2
Joined: 13 Mar 2012, 15:16

Postby wmoreno3 » 25 Jan 2013, 07:33

ts_fbsd, your thread help me,
Problem:
Code: Select all
root@server:/etc # /etc/rc.d/named start
/etc/rc.d/named: ERROR: get_pidfile_from_conf: /etc/namedb/named.conf does not exist (named)

Checking:
Code: Select all
root@server:/root # ls -l /var/named/etc/namedb/
total 40
drwxr-xr-x  2 bind  wheel    512 Dec  4 04:32 dynamic
drwxr-xr-x  2 root  wheel    512 Dec  4 04:34 master
-rw-r--r--  1 bind  wheel  15150 Jan 17 15:57 named.conf
-rw-r--r--  1 bind  wheel   3135 Dec  4 04:34 named.root
-rw-------  1 bind  wheel     97 Dec 22 03:49 rndc.key
drwxr-xr-x  2 bind  wheel    512 Dec  4 04:32 slave
drwxr-xr-x  2 bind  wheel    512 Jan 25 02:04 working
root@server:/root # cat /etc/defaults/rc.conf | grep named
# named.  It may be possible to run named in a sandbox, man security for
named_enable="NO"               # Run named, the DNS server (or NO).
named_program="/usr/sbin/named" # Path to named, if you want a different one.
named_conf="/etc/namedb/named.conf"     # Path to the configuration file
#named_flags=""                 # Use this for flags OTHER than -u and -c
named_uid="bind"                # User to run named as
named_chrootdir="/var/named"    # Chroot directory (or "" not to auto-chroot it)
named_chroot_autoupdate="YES"   # Automatically install/update chrooted
                                # components of named. See /etc/rc.d/named.
named_symlink_enable="YES"      # Symlink the chrooted pid file
named_wait="NO"                 # Wait for working name service before exiting
named_wait_host="localhost"     # Hostname to check if named_wait is enabled
named_auto_forward="NO"         # Set up forwarders from /etc/resolv.conf
named_auto_forward_only="NO"    # Do "forward only" instead of "forward first"
root@server:/root # cat /etc/rc.conf | grep named
named_enable="YES"

Cause:
FreeBSD 9.1 was running OK, but [FILE]named[/FILE] fails today
Solution:
Code: Select all
root@server:/etc # ln -s /var/named/etc/namedb /etc/namedb
root@server:/etc # /etc/rc.d/named start
Starting named.

I do not know what happened, any ideas ?
wmoreno3
Junior Member
 
Posts: 46
Joined: 16 Oct 2011, 22:37
Location: Bucaramanga, Colombia, South America

Postby RedErick » 30 Aug 2013, 14:45

I got the same error ten minutes ago because of unexpected power loss (bad UPS). I think that this could be a file system error.
RedErick
Junior Member
 
Posts: 30
Joined: 14 Aug 2013, 08:54


Return to Web & Network Services

Who is online

Users browsing this forum: No registered users and 1 guest