How to set the logging clause for a chrooted BIND?

0

This question is a bit similar to this one but the answer that seemed to help the most is Ubuntu specific, and this is running on OSX 10.6.8.

With this logging clause:

logging {
         category default {
                 _default_log;
         };

         channel _default_log  {
                 file "/var/chroot/named/var/log/query.log";
                 severity info;
                 print-time yes;
         };
 };

I get this error in the system.log:

isc_log_open '/var/chroot/named/var/log/query.log' failed: file not found

This article on bind9's logging clause in the conf file says:

file 'path_name' is a quoted string defining the absolute path to the logging file e.g. "/var/log/named/namedlog.log".

But the conf is inside the jail at /var/chroot/named/etc/named.conf and I'd like the log to be written to either /var/chroot/named/var/log/query.log, which is inside the jail, or /Library/Logs/named.log which is outside the jail (and is where the log was pointing to before the chrooting). Whichever I can get to work is fine.

Any help is much appreciated!

Iain

Posted 2013-01-13T01:51:10.063

Reputation: 232

Answers

1

Since your bind is running inside a jail chroot, your path should be relative to it.

For your chrooted bind, the / directory starts at /var/chroot/named, being so you should change the filename to /var/log/query.log and make sure bind has permission to write into /var/log.

Also, you may have your logs written on both files. If the above change work out, you may link the two files (/var/chroot/named/var/log/query.log and /Library/Logs/named.log) into one using, outside the chroot, the command:

$ ln /var/chroot/named/var/log/query.log /Library/Logs/named.log

Doing so will give you the same content at both locations. But, be warned that removing one file won't remove the other, but emptying it, will do it for both. So, if you use logrotate, or similar program, you will need to rotate both files and make sure the link is recreated every time.

fboaventura

Posted 2013-01-13T01:51:10.063

Reputation: 163

1

Change the filename in the directive to /var/log/query.log.....You are on a chroot'd area which has /var/chroot/named as its root.

mdpc

Posted 2013-01-13T01:51:10.063

Reputation: 4 176

fboaventura gave a little bit more info so I gave that answer the tick, but I really appreciate the help, thanks. – Iain – 2013-01-13T16:58:43.210