Bug 990974

Summary: SELinux is preventing /usr/sbin/unbound-anchor from 'name_bind' accesses on the udp_socket .
Product: [Fedora] Fedora Reporter: Moez Roy <moez.roy>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, mgrepl, pwouters
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:8c940b1aea3491128e59a34b35455c1a81bfd0df02e733d442179fe1a1c1ad69
Fixed In Version: selinux-policy-3.11.1-103.fc18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-23 00:44:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Moez Roy 2013-08-01 10:17:02 UTC
Description of problem:
SELinux is preventing /usr/sbin/unbound-anchor from 'name_bind' accesses on the udp_socket .

*****  Plugin bind_ports (92.2 confidence) suggests  *************************

If you want to allow /usr/sbin/unbound-anchor to bind to network port 26783
Then you need to modify the port type.
Do
# semanage port -a -t  -p udp 26783

*****  Plugin catchall_boolean (7.83 confidence) suggests  *******************

If you want to allow system to run with NIS
Then you must tell SELinux about this by enabling the 'nis_enabled' boolean.
You can read 'None' man page for more details.
Do
setsebool -P nis_enabled 1

*****  Plugin catchall (1.41 confidence) suggests  ***************************

If you believe that unbound-anchor should be allowed name_bind access on the  udp_socket 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 unbound-anchor /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:system_cronjob_t:s0-s0:c0.c1023
Target Context                system_u:object_r:unreserved_port_t:s0
Target Objects                 [ udp_socket ]
Source                        unbound-anchor
Source Path                   /usr/sbin/unbound-anchor
Port                          26783
Host                          (removed)
Source RPM Packages           unbound-libs-1.4.20-3.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-98.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.9.11-200.fc18.x86_64 #1 SMP Mon
                              Jul 22 21:04:50 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-08-01 03:10:01 PDT
Last Seen                     2013-08-01 03:10:01 PDT
Local ID                      62f00997-4d9e-4eb0-bcb2-3ff1a6afa82d

Raw Audit Messages
type=AVC msg=audit(1375351801.910:169): avc:  denied  { name_bind } for  pid=5145 comm="unbound-anchor" src=26783 scontext=system_u:system_r:system_cronjob_t:s0-s0:c0.c1023 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=udp_socket


type=AVC msg=audit(1375351801.910:169): avc:  denied  { node_bind } for  pid=5145 comm="unbound-anchor" src=26783 scontext=system_u:system_r:system_cronjob_t:s0-s0:c0.c1023 tcontext=system_u:object_r:node_t:s0 tclass=udp_socket


type=SYSCALL msg=audit(1375351801.910:169): arch=x86_64 syscall=bind success=yes exit=0 a0=a a1=7f07363ffa20 a2=10 a3=7fff930cca4c items=0 ppid=5143 pid=5145 auid=991 uid=991 gid=989 euid=991 suid=991 fsuid=991 egid=989 sgid=989 fsgid=989 ses=10 tty=(none) comm=unbound-anchor exe=/usr/sbin/unbound-anchor subj=system_u:system_r:system_cronjob_t:s0-s0:c0.c1023 key=(null)

Hash: unbound-anchor,system_cronjob_t,unreserved_port_t,udp_socket,name_bind

audit2allow

#============= system_cronjob_t ==============
#!!!! This avc can be allowed using one of the these booleans:
#     nis_enabled, kerberos_enabled

allow system_cronjob_t node_t:udp_socket node_bind;
#!!!! This avc can be allowed using the boolean 'nis_enabled'

allow system_cronjob_t unreserved_port_t:udp_socket name_bind;

audit2allow -R
require {
	type system_cronjob_t;
}

#============= system_cronjob_t ==============
corenet_udp_bind_generic_node(system_cronjob_t)
corenet_udp_bind_generic_port(system_cronjob_t)


Additional info:
reporter:       libreport-2.1.6
hashmarkername: setroubleshoot
kernel:         3.9.11-200.fc18.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-08-02 08:38:36 UTC
*** Bug 990971 has been marked as a duplicate of this bug. ***

Comment 2 Miroslav Grepl 2013-08-02 09:10:03 UTC
So you have a cronjob which runs unbound-anchor, right?

Comment 3 Moez Roy 2013-08-02 13:28:01 UTC
(In reply to Miroslav Grepl from comment #2)
> So you have a cronjob which runs unbound-anchor, right?

No

Comment 4 Daniel Walsh 2013-08-02 14:56:07 UTC
Well it does at somepoint.  Probably need a transition from system_cronjob_t to named_t

Comment 5 Moez Roy 2013-08-02 15:15:11 UTC
(In reply to Daniel Walsh from comment #4)
> Well it does at somepoint.  Probably need a transition from system_cronjob_t
> to named_t

Is it part of dnssec-trigger?

Comment 6 Paul Wouters 2013-08-05 10:55:09 UTC
unbound-anchor is doing DNS queries directly without using the system resolver (it might not be running yet or might contain an old broken root key)

So it does need the same permissions as a "dns server" would, so perhaps allowing it named_t is the right choice here. That might also apply to more applicatins that use libunbound directly (i.e. libreswan)

Comment 7 Daniel Walsh 2013-08-05 19:04:15 UTC
bab047a27315a0eb0f781543dab89d1139841a5c fixes this in git.

Comment 8 Miroslav Grepl 2013-08-07 14:49:39 UTC
Back ported.

Comment 9 Fedora Update System 2013-09-02 15:28:11 UTC
selinux-policy-3.11.1-101.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-101.fc18

Comment 10 Fedora Update System 2013-09-02 23:26:53 UTC
Package selinux-policy-3.11.1-101.fc18:
* should fix your issue,
* was pushed to the Fedora 18 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.11.1-101.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-15645/selinux-policy-3.11.1-101.fc18
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2013-09-10 11:17:02 UTC
selinux-policy-3.11.1-103.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-103.fc18

Comment 12 Fedora Update System 2013-09-23 00:44:02 UTC
selinux-policy-3.11.1-103.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.