Bind error dumping master file

BIND 9.11.4-3 Ubuntu 18.10 The error is seen in the journal after the following which seems to indicate success, though there is an apparmor error which I don't understand Lines are ordered with
BIND 9.11.4-3 Ubuntu 18.10 

The error is seen in the journal after the following which seems to indicate success, though there is an apparmor error which I don’t understand

Lines are ordered with most recent at top :

 ....
Jan 15 16:00:21 vaio named[25553]: transfer of '0.0.10.in- 
addr.arpa/IN' from 10.0.0.110#53: Transfer status: success
....

 Jan 15 16:00:20 vaio audit[25553]: AVC apparmor="DENIED" 
 operation="mknod" profile="/usr/sbin/named" 
  name="/etc/bind/zones/tmp-wTjV9cpi5S" pid=25553 comm="isc- 
  worker0000" requested_mask="c" denied_mask="c" fsuid=126 ouid=126

 Jan 15 16:00:20 vaio named[25553]: dumping master file: 
 /etc/bind/zones/tmp-wTjV9cpi5S: open: permission denied

The zone files are in /etc/bind/zones, the permissions on that directory are :

drwxrwsr-x   2 bind bind  4096 2019-01-15 15:20 zones

asked Jan 16, 2019 at 0:12

Stephen Boston's user avatar

Stephen BostonStephen Boston

3,7047 gold badges37 silver badges69 bronze badges

The correct location to store the slaves zone is /var/lib/bind, /etc/bind is the user configuration location. As you can see, apparmor denied the write in /etc/bind folder.

Update your slave zone to use any file in /var/lib/bind.

answered Jan 16, 2019 at 15:42

ob2's user avatar

ob2ob2

3,41216 silver badges15 bronze badges

The path you define to store slave zone is defined in /etc/bind/named.conf.options, which is directory "var/cache/bind".

Make sure bind group have the write access to that directory which you will store your db zones;

What I suggest to do is :

define file slaves/$db_file_name in /etc/named.conf.local.

And add a directory in /var/cache/bind

sudo mkdir /var/cache/bind/slaves

Then change ownership to bind group

sudo chown bind:bind /var/cache/bind/slaves

answered Oct 15, 2019 at 15:56

Yong Yang's user avatar

Yong YangYong Yang

811 silver badge3 bronze badges

trslagle1801

Posts: 13
Joined: 2017/10/24 13:21:00

dumping master file permission denied

I setup a new secondary DNS server and I am getting the following errors in the log file. the zone files do not appear to be coming over from the primary DNS server. The secondary does not seem to be working at all. Below is a sample of the error I am getting any help would be appreciated.

zone —.—.—.IN-ADDR.ARPA/IN: transferred serial 3000000036
Oct 24 08:33:55 dns named[29458]: transfer of ‘—.—.—.IN-ADDR.ARPA/IN’ from —.—.—.—#53: Transfer completed: 1 messages, 257 records, 9192 bytes, 0.007 secs (1313142 bytes/sec)
Oct 24 08:33:55 dns named[29458]: dumping master file: tmp-cdlatX2xAY: open: permission denied


User avatar

avij

Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: dumping master file permission denied

Post

by avij » 2017/10/24 14:04:42

named needs write permission to the directory where the slave zone files will be written. Looks like you have not specified a subdirectory, so named will try to write the files to /var/named, which might not work. It would be a good idea to put the slave zone files into their own subdirectory. This means there would be file «slaves/example.com» in your named.conf for the zone in question. This (and the default directory «/var/named») would make named write the files to /var/named/slaves.


User avatar

TrevorH

Site Admin
Posts: 32527
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: dumping master file permission denied

Post

by TrevorH » 2017/10/24 15:33:12

There is also a named_write_master_zones seboolean that will need turning on.


trslagle1801

Posts: 13
Joined: 2017/10/24 13:21:00

Re: dumping master file permission denied

Post

by trslagle1801 » 2017/10/24 19:33:07

I have directory set in named.conf to directory «/var/named»; and in from of all of the zones i have the following.

zone «example.com» {
type slave;
masters {—.—.—.— ;};
file «slaves/example.com»;

What else should I be looking for, or what am I missing?

permissions are as follows.

drwxr-x—. 7 root named 61 Aug 23 08:32 chroot
drwxrwx—. 2 root named 6 Aug 23 08:32 data
drwxrwx—. 2 root named 6 Oct 20 14:00 dynamic
-rw-r——. 1 root named 2281 May 22 04:51 named.ca
-rw-r——. 1 root named 152 Dec 15 2009 named.empty
-rw-r——. 1 root named 152 Jun 21 2007 named.localhost
-rw-r——. 1 root named 168 Dec 15 2009 named.loopback
drwxrwxr-x. 2 root named 6 Aug 23 08:32 slaves


trslagle1801

Posts: 13
Joined: 2017/10/24 13:21:00

Re: dumping master file permission denied

Post

by trslagle1801 » 2017/10/24 19:56:11

I also ran the named boolean and I am still getting the same error, when it is trying to write.


trslagle1801

Posts: 13
Joined: 2017/10/24 13:21:00

permission denied on zone transfer

Post

by trslagle1801 » 2017/11/01 16:03:05

I setup a new secondary DNS server under bind chroot and I am getting the following errors in the log file. the zone files do not appear to be coming over from the primary DNS server. The secondary does not seem to be working at all. Below is a sample of the error I am getting any help would be appreciated. I have matched permissions with my old server that is working fine and I have ran the SELinux to allow master zone writes. Permissions are listed below

zone —.—.—.IN-ADDR.ARPA/IN: transferred serial 3000000036
Oct 24 08:33:55 dns named[29458]: transfer of ‘—.—.—.IN-ADDR.ARPA/IN’ from —.—.—.—#53: Transfer completed: 1 messages, 257 records, 9192 bytes, 0.007 secs (1313142 bytes/sec)
Oct 24 08:33:55 dns named[29458]: dumping master file: tmp-cdlatX2xAY: open: permission denied

drwxrwxrwx. 8 root named 75 Oct 24 15:07 chroot
drwxrwxrwx. 2 named named 6 Aug 23 08:32 data
drwxrwxrwx. 2 root named 6 Oct 20 14:00 dynamic
-rw-rw-rw-. 1 root named 2281 May 22 04:51 named.ca
-rw-rw-rw-. 1 root named 152 Dec 15 2009 named.empty
-rw-rw-rw-. 1 root named 152 Jun 21 2007 named.localhost
-rw-rw-rw-. 1 root named 168 Dec 15 2009 named.loopback
drwxrwxrwx. 2 named named 6 Aug 23 08:32 slaves


User avatar

avij

Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: dumping master file permission denied

Post

by avij » 2017/11/01 16:11:03

Please don’t open multiple topics for the same problem. I moved your above post to this topic.





Skip to navigation
Skip to main content

Red Hat Customer Portal

Infrastructure and Management

  • Red Hat Enterprise Linux

  • Red Hat Virtualization

  • Red Hat Identity Management

  • Red Hat Directory Server

  • Red Hat Certificate System

  • Red Hat Satellite

  • Red Hat Subscription Management

  • Red Hat Update Infrastructure

  • Red Hat Insights

  • Red Hat Ansible Automation Platform

Cloud Computing

  • Red Hat OpenShift

  • Red Hat CloudForms

  • Red Hat OpenStack Platform

  • Red Hat OpenShift Container Platform

  • Red Hat OpenShift Data Science

  • Red Hat OpenShift Online

  • Red Hat OpenShift Dedicated

  • Red Hat Advanced Cluster Security for Kubernetes

  • Red Hat Advanced Cluster Management for Kubernetes

  • Red Hat Quay

  • OpenShift Dev Spaces

  • Red Hat OpenShift Service on AWS

Storage

  • Red Hat Gluster Storage

  • Red Hat Hyperconverged Infrastructure

  • Red Hat Ceph Storage

  • Red Hat OpenShift Data Foundation

Runtimes

  • Red Hat Runtimes

  • Red Hat JBoss Enterprise Application Platform

  • Red Hat Data Grid

  • Red Hat JBoss Web Server

  • Red Hat Single Sign On

  • Red Hat support for Spring Boot

  • Red Hat build of Node.js

  • Red Hat build of Thorntail

  • Red Hat build of Eclipse Vert.x

  • Red Hat build of OpenJDK

  • Red Hat build of Quarkus

Integration and Automation

  • Red Hat Process Automation

  • Red Hat Process Automation Manager

  • Red Hat Decision Manager

All Products

Issue

  • During doing a zone transfer between master and slave bind servers we received the following error messages in the /var/log/messages on the slave server:
./messages.1:Jun 21 20:55:14 station6 named[11532]: dumping master file: slaves/tmp-FvkXGhn6Jq: open: permission denied
./messages.1:Jun 21 20:55:14 station6 named[11532]: transfer of 'example.com/IN' from 192.168.0.5#53: failed while receiving responses: permission denied
./messages.1:Jun 21 20:56:00 station6 named[11532]: dumping master file: slaves/tmp-p5nVF49JHA: open: permission denied
./messages.1:Jun 21 20:56:00 station6 named[11532]: transfer of '0.168.192.in-addr.arpa/IN' from 192.168.0.5#53: failed while receiving responses: permission denied
./messages.1:Jun 21 20:56:12 station6 named[11532]: dumping master file: slaves/tmp-EItAES6X3p: open: permission denied
./messages.1:Jun 21 20:56:12 station6 named[11532]: transfer of 'example.com/IN' from 192.168.0.5#53: failed while receiving responses: permission denied

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6.4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

Twin Apples

Using BIND as a Master and a Slave simultaneously

I got BIND on two servers (the named service). Each server is at the same time a master and a slave depending on the domain name. For instance, I host http://www.alexishouses.com on my server and http://www.m2osw.com on my company’s server.

Up to here, easy.

The slaves are expected to update themselves whenever the master emits a change in a zone.

Somehow, one of my domain names would not work at all on the slave (company’s server). I searched and searched and I just couldn’t find out why it was not working. Finally, I tried to search the named.conf.local of the slave using the master domain name (i.e. copy & paste). That’s how I discovered that I misspelled the name in the slave!!!

As you can see this error was not clear. The problem was that lorusso is one R and two S’s…

Now that was not all. I was getting another kind of error too:

As we can see the BIND tool wants to update the domain name by sending a notification. But that notification is being refused. This happens since BIND 9.3 apparently. The concept is simple but quite a gotcha! The server is actually sending a notification to itself and chances are if you are reading this you have the same problem:

You need to allow the server to notify itself!

I had a hard time to see that with that error because of the other error I had before. I found a site where someone else ran in that problem and had a simple solution:

https://benjamin.sonntag.fr/a37-named_zone_sonntag_eu_org_refused_notify_from_non-master.html

Add a notify-allow { <myself>; } where <myself> is your slave server IP address. If you are like me, you want to add that to both your servers.

More info about BIND (but really no solution to any of your everyday problems…):

http://www.bind9.net/manuals

Determining whether BIND is running as Master or Slave

By default, BIND will be a master.

It is possible to always run BIND as a master and simply duplicate your zones by hand (with a mechanism of your own such as an rsync) on all your servers.

However, the named service offers a way to copy zones between servers. In that case, one server is called the master and the others are slaves. The number of servers is not limited, although you probably want to keep it small to keep it manageable.

Slave servers are good if you have several offices or when you own domain names in which case you need at least two servers. (You do not need your own DNS, though, most domain name resellers will offer you free access to their DNS).

To transform a master named server into a slave, you use the allow-update option. When this option is used in the global space of named.conf, then the BIND service runs 100% as a slave.

If, like me, you want to run as a Master for some domains and as a Slave for others, then you want to be very careful on how you use the allow-update option.

I suggest that you use the option only in the zones marked as slave (i.e. type slave;). Yet, if you have just one or two masters, you can as well write one global allow-update and then cancel that declaration in your master entries as in:

zone "alexishouses.com" {
    type master;
    file "/etc/bind/alexis/alexishouses.com";
    allow-update { none; };
};

An example of allow-update with an IP address appears below. allow-update can include several IP addresses separated by semi-colons.

Today I noticed that the bind server was working in only one direction. Wondering, I looked at the logs (after I turned on the feature) and noticed that the tool was telling me that it did not have permissions to write to the alexis folder (often called slave although in our case we have several people and used several folders to segregate the names). I verified all the folders and files, made sure they were owned by bind, just like on the other server, and it still did not work.

So I search on the Internet and found a post on Ubuntu that gave up the answer:

Although all the permissions look correct as per the old days,
they are not correct for the new days of apparmor.
Yes! apparmor will prevent the write whether you want it or not.

Look at the settings of apparmor and see that the /etc/bind folder is a read-only folder now (which is a GREAT thing, since that’s how it should always have been!)

Instead, BIND is expected to write dynamic files in /var/cache/bind/*

However, if you are like me, you probably have something like this in your configuration file:

zone "alexishouses.com" {
    type slave;
    file "/etc/bind/alexis/alexishouses.com";
    masters { 64.166.38.38; };
    allow-update { 64.166.38.38; };
};

When such a zone configuration on your server, the zone is considered a slave. Here we also tell that slave that the master is at a specific IP address. That IP address is the only trusted source. Good.

Then, in between, we notice the file specification. This is a path and file name of the zone used to save the slave server version of the zone…

In your apparmor /etc/apparmor.d/usr.sbin.named configuration file you will see this:

/etc/bind/** r,
/var/lib/bind/** rw,
/var/lib/bind/ rw,
/var/cache/bind/** rw,
/var/cache/bind/ rw,

As you can see, anything under /etc/bind will be write protected from bind (DO NOT CHANGE IT!). Whether or not bind wants it that way does not matter here.

On the other hand, we have two read-write folders: /var/lib/bind and /var/cache/bind. The second one is where dynamic slave files are saved once you fix you configuration. The file «…» specification needs not include a path at all and the system automatically puts the files under the right folder.

zone "alexishouses.com" {
    type slave;
    file "alexishouses.com";
    masters { 64.166.38.38; };
    allow-update { 64.166.38.38; };
};

As you can see, that is nearly the same as the previous configuration, we just removed the path in the file specification.

Now everything works! Don’t forget, if you want immediate update of slave name servers you’ve got to restart your name servers AND bump up the serial number of zone files that you modify. This is how they know that it was bumped up.

Allowing Recursion

You may notice that you get a warning about recursion:

WARNING: recursion requested but not available

You can allow recursion between your DNS server, which is safe, but you must make sure to prevent anyone else from using your recursion mechanism.

In most cases, recursion is only necessary on an Intranet where a server on your LAN queries your DNS on the main server connected to the Internet. In that case, you want your DNS to accept such requests.

BIND still allows us to open up widely like so:

allow-recursion { any; };  # NEVER DO THAT!!!

I had that on one of my BIND servers and I got the massive surprise of a DNS Amplification Attack.

Instead, you want to limit the computers that can use recursion to only your trusted network:

allow-recursion { trusted-servers; };

where trusted-servers is an ACL where you can enter all of your computer IP addresses.

No Error, but still not accessible?

I have had problems with perfectly valid zones, but getting no proper reply when I try to ping the DNS server.

So for example, say I have a problem with m2osw.com and I check the following:

dig @ns1.m2osw.com www.m2osw.com

Then you would expect the usuall answer giving us the IP address of www.m2osw.com sub-domain, but instead we get:

; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> @ns1.m2osw.com www.m2osw.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 13338
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.m2osw.com.            IN    A

;; Query time: 15 msec
;; SERVER: 138.197.205.139#53(138.197.205.139)
;; WHEN: Fri Jun 05 15:21:41 PDT 2020
;; MSG SIZE  rcvd: 42

which more or less says «I kind of understand what you’re telling me, but I don’t really get it.»

The fact is that on startup, BIND reads the data of a zone from the corresponding journal and depending on something or other (I would imagine a couple of dates somewhere?), it decides to use the journal rather than the new definitions but there is a form of conflict and in the end it uses neither.

To resolve this problem, you need to delete the BIND cache file. These are saved in the /var/lib/bind folder and have a name equivalent to the zone plus the .jnl as the extension to that file.

sudo rm /var/lib/bind/m2osw.com.zone.jnl

Then restart the service so it works as expected (until you restart, it will use the old data it has in memory and still won’t work):

sudo systemctl restart bind9

Try the dig command again and you shall see the correct response. Something like this:

$ dig @ns1.m2osw.com www.m2osw.com

; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> @ns1.m2osw.com www.m2osw.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31538
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.m2osw.com.            IN    A

;; ANSWER SECTION:
www.m2osw.com.        300    IN    A    138.197.205.139

;; AUTHORITY SECTION:
m2osw.com.        86400    IN    NS    ns1.m2osw.com.
m2osw.com.        86400    IN    NS    ns2.m2osw.com.

;; ADDITIONAL SECTION:
ns1.m2osw.com.        86400    IN    A    138.197.205.139
ns2.m2osw.com.        86400    IN    A    96.67.192.225

;; Query time: 19 msec
;; SERVER: 138.197.205.139#53(138.197.205.139)
;; WHEN: Fri Jun 05 15:30:26 PDT 2020
;; MSG SIZE  rcvd: 126

Side Note:

Why do things go bad?

I’m not too sure. Especially, if I modify my zone manually and try again, it doesn’t change the fact that it’s going to use the invalid journal. My take would be that there is some other process which updates the journal, somehow, and it’s not 100% properly synchronized if we receive a restart at about the same time. Either that or the journal was given a date of validity which will make it last a long time.

Other errors?

Got another error and don’t know how to fix it? Post a comment below with the info.

BIND 9.11.4-3 Ubuntu 18.10 

Ошибка замечена в журнале после следующего, которое, кажется, указывает на успех, хотя существует apparmor ошибка, которую я не понимаю

Строки заказаны с новым в вершине:

 ....
Jan 15 16:00:21 vaio named[25553]: transfer of '0.0.10.in- 
addr.arpa/IN' from 10.0.0.110#53: Transfer status: success
....

 Jan 15 16:00:20 vaio audit[25553]: AVC apparmor="DENIED" 
 operation="mknod" profile="/usr/sbin/named" 
  name="/etc/bind/zones/tmp-wTjV9cpi5S" pid=25553 comm="isc- 
  worker0000" requested_mask="c" denied_mask="c" fsuid=126 ouid=126

 Jan 15 16:00:20 vaio named[25553]: dumping master file: 
 /etc/bind/zones/tmp-wTjV9cpi5S: open: permission denied

Зональные файлы находятся в /etc/bind/zones, полномочия на том каталоге:

drwxrwsr-x   2 bind bind  4096 2019-01-15 15:20 zones

задан
16 January 2019 в 07:10

поделиться

2 ответа

Корректное местоположение для хранения ведомой зоны является/var/lib/bind,/etc/bind является пользовательским местоположением конфигурации. Как Вы видите, apparmor отклонил запись в/etc/bind папке.

Обновите свою ведомую зону для использования любого файла в/var/lib/bind.

ответ дан ob2
26 October 2019 в 13:05

поделиться

Путь, который Вы определяете для хранения ведомой зоны, определяется в /etc/bind/named.conf.options, который является directory "var/cache/bind".

Удостоверяются, связывают группу, имеют доступ для записи к тому каталогу, который Вы сохраните свои зоны дб;

то, Что я предлагаю сделать:

определяют file slaves/$db_file_name в /etc/named.conf.local.

И добавляют каталог в /var/cache/bind

sudo mkdir /var/cache/bind/slaves

Затем владение изменения для привязки группы

sudo chown bind:bind /var/cache/bind/slaves

ответ дан Yong Yang
26 October 2019 в 13:05

поделиться

Другие вопросы по тегам:

Похожие вопросы:

Всем доброго времени суток,

Поднял 2 DNS bind9, по мануалам все настроил, все вроде работает. ОС используется Debian 7. Проблема в том что в логах бинда появляются вот такие записи:

Bash
1
general: error: dumping master file: /etc/bind/master/tmp-9G6zkeSSfP: open: file not found

Гугление навело только на то что такая ошибка появляется если путь к файлу зоны не полностью прописать. И еще, эти записи падают в лог slave сервера, на master сервере все тихо.
Права на директории bind стоят 2777 bind:bind. Если кто-то сталкивался, подскажите как решить проблему.

ЗЫ. Сервера нормально работают, slave сервер нормально получает данные от master сервера. Просто как-то не приятно что в логи падает всякая гадость, хотелось бы разобраться в причине. (Вариант переключения логов на critical не подойдет )

Добавлено через 22 часа 33 минуты
Извиняюсь, сам накосячил. В named.conf 2 записи были с не правильными путями, а именно в пути вместо slave было прописано master. Всему виной моя невнимательность, но за то много полезной информации прочитал =)

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

Понравилась статья? Поделить с друзьями:
  • Bind error 10013 tftpd
  • Binascii error non hexadecimal digit found
  • Binascii error non base32 digit found
  • Binary domain ошибка при запуске
  • Binary domain critical error configuration