Bug 984548 - SELinux is preventing /usr/sbin/named from 'rename' accesses on the file /var/named/chroot/var/log/named.run.
Summary: SELinux is preventing /usr/sbin/named from 'rename' accesses on the file /var...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 19
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:29f95a66029b51fd57c2a88da95...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-15 13:18 UTC by Doug Maxey
Modified: 2013-08-22 00:51 UTC (History)
7 users (show)

Fixed In Version: selinux-policy-3.12.1-71.fc19
Clone Of:
Environment:
Last Closed: 2013-08-22 00:51:40 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
named.conf (2.25 KB, text/plain)
2013-07-16 23:45 UTC, Doug Maxey
no flags Details

Description Doug Maxey 2013-07-15 13:18:52 UTC
Description of problem:
SELinux is preventing /usr/sbin/named from 'rename' accesses on the file /var/named/chroot/var/log/named.run.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that named should be allowed rename access on the named.run file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep named /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:named_t:s0
Target Context                system_u:object_r:named_log_t:s0
Target Objects                /var/named/chroot/var/log/named.run [ file ]
Source                        named
Source Path                   /usr/sbin/named
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           bind-9.9.3-3.P1.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-63.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.9.9-302.fc19.x86_64 #1 SMP Sat
                              Jul 6 13:41:07 UTC 2013 x86_64 x86_64
Alert Count                   256036
First Seen                    2013-07-11 16:03:35 CDT
Last Seen                     2013-07-15 08:17:07 CDT
Local ID                      470de5cb-c0d5-4771-b547-972b74f2776c

Raw Audit Messages
type=AVC msg=audit(1373894227.97:16959): avc:  denied  { rename } for  pid=1741 comm="named" name="named.run" dev="dm-1" ino=652861 scontext=system_u:system_r:named_t:s0 tcontext=system_u:object_r:named_log_t:s0 tclass=file


type=SYSCALL msg=audit(1373894227.97:16959): arch=x86_64 syscall=rename success=no exit=EACCES a0=7f6283bf26b8 a1=7f627eb47c80 a2=7f627eb47c94 a3=12 items=0 ppid=1 pid=1741 auid=4294967295 uid=25 gid=25 euid=25 suid=25 fsuid=25 egid=25 sgid=25 fsgid=25 ses=4294967295 tty=(none) comm=named exe=/usr/sbin/named subj=system_u:system_r:named_t:s0 key=(null)

Hash: named,named_t,named_log_t,file,rename

Additional info:
reporter:       libreport-2.1.5
hashmarkername: setroubleshoot
kernel:         3.9.9-302.fc19.x86_64
type:           libreport

Comment 1 Daniel Walsh 2013-07-15 21:23:44 UTC
Is this normal bind/named behaviour?

Comment 2 Tomáš Hozza 2013-07-16 07:24:16 UTC
(In reply to Doug Maxey from comment #0)
> Description of problem:
> SELinux is preventing /usr/sbin/named from 'rename' accesses on the file
> /var/named/chroot/var/log/named.run.

Can you please provide your named.conf?

Thank you!

Comment 3 Doug Maxey 2013-07-16 23:45:10 UTC
Created attachment 774552 [details]
named.conf

domain names are genericized, but other than that, this is the conf file.
Nothing else other than the zone info, and the keys are in the "included" files, that is to say conf or path related info.

# ll -Zd /var/named/chroot/var/log
drwxrwx---. named named unconfined_u:object_r:var_log_t:s0 /var/named/chroot/var/log/
# ll -ZR /var/named/chroot/var/log
/var/named/chroot/var/log:
-rw-r--r--. named named system_u:object_r:named_log_t:s0 named.auth
-rw-r--r--. named named unconfined_u:object_r:named_log_t:s0 named.dnssec
-rw-r--r--. named named system_u:object_r:named_log_t:s0 named.run
-rw-r--r--. named named system_u:object_r:named_log_t:s0 named.update-debug

# cat /etc/selinux/targeted/contexts/files/file_contexts.local
/var/named/chroot/etc/named/named\.conf	--	system_u:object_r:named_conf_t:s0

/var/named/chroot/var/log(/.*)?	system_u:object_r:named_log_t:s0
/var/named/chroot/var/named/keys(/.*)?	system_u:object_r:named_cache_t:s0
(reverse-i-search)`chcon': ^Ccon unconfined_u:object_r:var_log_t:s0 /var/named/chroot/var/log

Comment 4 Tomáš Hozza 2013-08-14 11:09:08 UTC
(In reply to Daniel Walsh from comment #1)
> Is this normal bind/named behaviour?

Yes, this is normal BIND behaviour in case it is configures to keep multiple
versions of log files in case they exceed the configures size. In this case
the configuration contains

logging {

	...

	channel named_run {
		file "/var/log/named.run" versions 3 size 20m;
		 severity  dynamic;
		 print-category yes;
		 print-severity yes;
		 print-time     yes;
	 };

	...

	 category default { named_run; };
};

which means that if /var/log/named.run exceeds size of 20 MB named will rename
/var/log/named.run to /var/log/named.run.0 etc. It will keep 3 versions of the
log file.

While in BIND default configuration we use /var/named/data/named.run for logging
and distribute configuration for logrotate, the attached named.conf if fully
legal.

I think SELinux policy should permit named to rename its log files.

Changing back to selinux-policy.

Comment 5 Fedora Update System 2013-08-20 08:25:03 UTC
selinux-policy-3.12.1-71.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-71.fc19

Comment 6 Fedora Update System 2013-08-21 00:14:13 UTC
Package selinux-policy-3.12.1-71.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-71.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-15088/selinux-policy-3.12.1-71.fc19
then log in and leave karma (feedback).

Comment 7 Doug Maxey 2013-08-21 16:53:49 UTC
yessir.  Looks good.  

Restarted named-chroot.service post the update, there were no log messages about not being able to rename the log files and the renamed files were present as wanted.  Consider it fixed.

There were several selinux messages that it failed with the above messages *during* the update, although the fix does appear to be working post the update completion.

Comment 8 Fedora Update System 2013-08-22 00:51:40 UTC
selinux-policy-3.12.1-71.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.