Bug 904642 - SELinux is preventing /usr/sbin/unbound-anchor from 'block_suspend' accesses on the capability2 .
Summary: SELinux is preventing /usr/sbin/unbound-anchor from 'block_suspend' accesses ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 18
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:c7111b74aa73271d32376a3d22a...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-26 18:54 UTC by Jared Smith
Modified: 2013-02-08 02:24 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-08 02:24:49 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jared Smith 2013-01-26 18:54:22 UTC
Description of problem:
SELinux is preventing /usr/sbin/unbound-anchor from 'block_suspend' accesses on the capability2 .

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

If you believe that unbound-anchor should be allowed block_suspend access on the  capability2 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:named_t:s0
Target Context                system_u:system_r:named_t:s0
Target Objects                 [ capability2 ]
Source                        unbound-anchor
Source Path                   /usr/sbin/unbound-anchor
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-73.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.7.2-204.fc18.x86_64 #1 SMP Wed
                              Jan 16 16:22:52 UTC 2013 x86_64 x86_64
Alert Count                   9
First Seen                    2013-01-26 13:34:40 EST
Last Seen                     2013-01-26 13:34:40 EST
Local ID                      844d43d1-7afb-4716-8ecf-2fe2e417290f

Raw Audit Messages
type=AVC msg=audit(1359225280.971:416): avc:  denied  { block_suspend } for  pid=1375 comm="unbound-anchor" capability=36  scontext=system_u:system_r:named_t:s0 tcontext=system_u:system_r:named_t:s0 tclass=capability2


Hash: unbound-anchor,named_t,named_t,capability2,block_suspend

audit2allow

#============= named_t ==============
allow named_t self:capability2 block_suspend;

audit2allow -R

#============= named_t ==============
allow named_t self:capability2 block_suspend;


Additional info:
hashmarkername: setroubleshoot
kernel:         3.7.2-204.fc18.x86_64
type:           libreport

Potential duplicate: bug 896602

Comment 1 Miroslav Grepl 2013-01-28 11:05:02 UTC
Added to selinux-policy-3.11.1-74.fc18.noarch

Comment 2 Fedora Update System 2013-01-31 13:19:19 UTC
selinux-policy-3.11.1-74.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-74.fc18

Comment 3 Seb L. 2013-02-01 15:02:38 UTC
Stock unbound won't start with SELinux enabled

Package: (null)
OS Release: Fedora release 18 (Spherical Cow)

Comment 4 Daniel Walsh 2013-02-01 15:57:41 UTC
Did you try it with the latest policy?

Comment 5 Fedora Update System 2013-02-01 16:40:03 UTC
Package selinux-policy-3.11.1-74.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-74.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-1693/selinux-policy-3.11.1-74.fc18
then log in and leave karma (feedback).

Comment 6 Seb L. 2013-02-01 16:51:24 UTC
Sure! unbound now starts, but SELinux alerts are still thrown.
Fully reproducible on a fresh (and up-to-date) F18 x86_64 VM:

% sudo yum update
% sudo yum install unbound
% sudo systemctl start unbound.service
% sudo sealert -a

SELinux is preventing /usr/sbin/unbound-anchor from write access on the directory unbound.

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

If vous pensez que unbound-anchor devrait être autorisé à accéder write sur unbound directory par défaut.
Then vous devriez rapporter ceci en tant qu'anomalie.
Vous pouvez générer un module de stratégie local pour autoriser cet accès.
Do
autoriser cet accès pour le moment en exécutant :
# grep unbound-anchor /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_conf_t:s0
Target Objects                unbound [ dir ]
Source                        unbound-anchor
Source Path                   /usr/sbin/unbound-anchor
Port                          <Unknown>
Host                          seb-f18
Source RPM Packages           unbound-libs-1.4.19-1.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-74.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     seb-f18
Platform                      Linux seb-f18 3.7.4-204.fc18.x86_64 #1 SMP Wed Jan
                              23 16:44:29 UTC 2013 x86_64 x86_64
Alert Count                   2
First Seen                    2013-02-01 10:16:09 CET
Last Seen                     2013-02-01 17:47:34 CET
Local ID                      d9e0fa35-04b9-46e3-a603-3fce127a25be

Raw Audit Messages
type=AVC msg=audit(1359737254.148:850): avc:  denied  { write } for  pid=29252 comm="unbound-anchor" name="unbound" dev="dm-1" ino=413546 scontext=system_u:system_r:named_t:s0 tcontext=system_u:object_r:named_conf_t:s0 tclass=dir


type=SYSCALL msg=audit(1359737254.148:850): arch=x86_64 syscall=open success=no exit=EACCES a0=7fff13e5b020 a1=241 a2=1b6 a3=238 items=0 ppid=1 pid=29252 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=unbound-anchor exe=/usr/sbin/unbound-anchor subj=system_u:system_r:named_t:s0 key=(null)

Hash: unbound-anchor,named_t,named_conf_t,dir,write

audit2allow

#============= named_t ==============
#!!!! The source type 'named_t' can write to a 'dir' of the following types:
# named_log_t, var_run_t, named_tmp_t, krb5_host_rcache_t, tmp_t, named_cache_t, var_log_t, named_var_run_t

allow named_t named_conf_t:dir write;

audit2allow -R

#============= named_t ==============
#!!!! The source type 'named_t' can write to a 'dir' of the following types:
# named_log_t, var_run_t, named_tmp_t, krb5_host_rcache_t, tmp_t, named_cache_t, var_log_t, named_var_run_t

allow named_t named_conf_t:dir write;

Comment 7 Seb L. 2013-02-01 16:54:27 UTC
For reference, the following, audit2allow-generated policy (after numerous passes!) allows unbound to start smoothly:

module unbound 1.0;

require {
	type named_conf_t;
	type named_t;
	class dir { write remove_name add_name };
	class file { write rename create unlink };
	class capability2 block_suspend;
}

#============= named_t ==============
allow named_t named_conf_t:dir { write remove_name add_name };
allow named_t named_conf_t:file unlink;
allow named_t named_conf_t:file { write rename create };
allow named_t self:capability2 block_suspend;

Comment 8 Miroslav Grepl 2013-02-01 17:31:36 UTC
#============= named_t ==============
allow named_t named_conf_t:dir { write remove_name add_name };
allow named_t named_conf_t:file unlink;
allow named_t named_conf_t:file { write rename create };

these should be fixed in the unbound.

I see

# rpm -q selinux-policy
selinux-policy-3.11.1-74.fc18.noarch

# sesearch -A -s named_t -t named_t -c capability2
Found 1 semantic av rules:
   allow named_t named_t : capability2 block_suspend 


Could you try to reinstall selinux-policy-targeted?

Comment 9 Seb L. 2013-02-01 23:49:15 UTC
Dear Miroslav,

The policy was against selinux-policy-3.11.1-73.fc18.noarch.

Only:
  allow named_t named_conf_t:dir { write remove_name add_name };
  allow named_t named_conf_t:file unlink;
  allow named_t named_conf_t:file { write rename create };

are required after applying selinux-policy-3.11.1-74.fc18.noarch.


Best regards,
Sébastien

Comment 10 Tom Hughes 2013-02-03 11:43:03 UTC
This alert happens once each time I boot the machine.

Package: (null)
OS Release: Fedora release 18 (Spherical Cow)

Comment 11 Miroslav Grepl 2013-02-04 11:20:34 UTC
Yes, these are not fixed. They should be fixed in the unbound.
 
Please add a local policy with these rules for now. Thank you.

Comment 12 Fedora Update System 2013-02-08 02:24:51 UTC
selinux-policy-3.11.1-74.fc18 has been pushed to the Fedora 18 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.