Bug 1004881

Summary: SELinux is preventing /usr/bin/python2.7 from 'write' accesses on the directory /srv/node/device1.
Product: [Fedora] Fedora Reporter: Mark <mark.a.sloan>
Component: openstack-swiftAssignee: Pete Zaitcev <zaitcev>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: apevec, breu, david, derekh, dominick.grift, dwalsh, itamar, jkaluza, jonathansteffan, lvrabec, mark.a.sloan, markmc, mgrepl, mmagr, mschmidt, rbryant, silas, zaitcev
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:a8fe62913ae9a8197325bd840436e9e28a217159d2336b17892556b54fd8712e
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 17:04:56 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 Mark 2013-09-05 16:14:43 UTC
Description of problem:
Running RDO - Havanna 
using packstack all in one install


 packstack --allinone --os-neutron-install=n

SELinux is preventing /usr/bin/python2.7 from 'write' accesses on the directory /srv/node/device1.

*****  Plugin restorecon (82.4 confidence) suggests  *************************

If you want to fix the label. 
/srv/node/device1 default label should be swift_data_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /srv/node/device1

*****  Plugin file (7.05 confidence) suggests  *******************************

If you think this is caused by a badly mislabeled machine.
Then you need to fully relabel.
Do
touch /.autorelabel; reboot

*****  Plugin file (7.05 confidence) suggests  *******************************

If you think this is caused by a badly mislabeled machine.
Then you need to fully relabel.
Do
touch /.autorelabel; reboot

*****  Plugin catchall_labels (4.59 confidence) suggests  ********************

If you want to allow python2.7 to have write access on the device1 directory
Then you need to change the label on /srv/node/device1
Do
# semanage fcontext -a -t FILE_TYPE '/srv/node/device1'
where FILE_TYPE is one of the following: swift_data_t, swift_var_cache_t, swift_var_run_t, var_run_t, var_t. 
Then execute: 
restorecon -v '/srv/node/device1'


*****  Plugin catchall (1.31 confidence) suggests  ***************************

If you believe that python2.7 should be allowed write access on the device1 directory 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 swift-object-re /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:swift_t:s0
Target Context                system_u:object_r:file_t:s0
Target Objects                /srv/node/device1 [ dir ]
Source                        swift-object-re
Source Path                   /usr/bin/python2.7
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           python-2.7.5-4.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-73.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.10.10-200.fc19.x86_64 #1 SMP Thu
                              Aug 29 19:05:45 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-09-05 10:12:37 MDT
Last Seen                     2013-09-05 10:12:37 MDT
Local ID                      eaecd512-df4e-4ec7-9b69-0f5d2c8780d2

Raw Audit Messages
type=AVC msg=audit(1378397557.67:5049): avc:  denied  { write } for  pid=19154 comm="swift-object-re" name="/" dev="loop1" ino=2 scontext=system_u:system_r:swift_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=dir


type=AVC msg=audit(1378397557.67:5049): avc:  denied  { add_name } for  pid=19154 comm="swift-object-re" name="objects" scontext=system_u:system_r:swift_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=dir


type=AVC msg=audit(1378397557.67:5049): avc:  denied  { create } for  pid=19154 comm="swift-object-re" name="objects" scontext=system_u:system_r:swift_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=dir


type=SYSCALL msg=audit(1378397557.67:5049): arch=x86_64 syscall=mkdir success=yes exit=0 a0=1ce6570 a1=1ff a2=7f5be1bf9f88 a3=7fff34f07820 items=0 ppid=1 pid=19154 auid=4294967295 uid=1001 gid=1002 euid=1001 suid=1001 fsuid=1001 egid=1002 sgid=1002 fsgid=1002 ses=4294967295 tty=(none) comm=swift-object-re exe=/usr/bin/python2.7 subj=system_u:system_r:swift_t:s0 key=(null)

Hash: swift-object-re,swift_t,file_t,dir,write

Additional info:
reporter:       libreport-2.1.6
hashmarkername: setroubleshoot
kernel:         3.10.10-200.fc19.x86_64
type:           libreport

Comment 1 Daniel Walsh 2013-09-05 21:48:29 UTC
If you run restorecon -R -v /srv/node as suggested in the alert?

Does this fix the problem

Comment 2 Mark 2013-09-19 20:46:33 UTC
I can't tell if it fixes the problem. 


packstack still fails to produce a working swift store after I run restorecon -R -v /srv/node 



the expectation is that RDO / packstack should be able to build all the required parts with SELinux enabled.

Comment 3 Miroslav Grepl 2013-09-20 08:24:56 UTC
Ok, what AVC are you getting now?

Comment 4 Mark 2013-09-20 20:39:08 UTC
here is the next AVC I get w/ packstack post restorecon, on a new node still related to the swift store. 



SELinux is preventing /usr/bin/python2.7 from name_bind access on the tcp_socket .

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

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

Additional Information:
Source Context                system_u:system_r:swift_t:s0
Target Context                system_u:object_r:xserver_port_t:s0
Target Objects                 [ tcp_socket ]
Source                        swift-container
Source Path                   /usr/bin/python2.7
Port                          6001
Host                          localhost.localdomain
Source RPM Packages           python-2.7.5-4.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-74.3.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain 3.11.1-200.fc19.x86_64
                              #1 SMP Sat Sep 14 15:04:51 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-09-20 14:32:22 MDT
Last Seen                     2013-09-20 14:32:22 MDT
Local ID                      db5b145e-4d95-4438-9767-c91823dea89d

Raw Audit Messages
type=AVC msg=audit(1379709142.159:4287): avc:  denied  { name_bind } for  pid=2184 comm="swift-container" src=6001 scontext=system_u:system_r:swift_t:s0 tcontext=system_u:object_r:xserver_port_t:s0 tclass=tcp_socket


type=SYSCALL msg=audit(1379709142.159:4287): arch=x86_64 syscall=bind success=yes exit=0 a0=5 a1=7fff0f51fd80 a2=10 a3=f items=0 ppid=1 pid=2184 auid=4294967295 uid=1001 gid=1002 euid=1001 suid=1001 fsuid=1001 egid=1002 sgid=1002 fsgid=1002 ses=4294967295 tty=(none) comm=swift-container exe=/usr/bin/python2.7 subj=system_u:system_r:swift_t:s0 key=(null)

Hash: swift-container,swift_t,xserver_port_t,tcp_socket,name_bind

Comment 5 Miroslav Grepl 2013-09-25 19:36:11 UTC
Why does swift-container need to use this port?

Comment 6 Jan Kaluža 2013-09-26 05:44:38 UTC
Reassigning to "right" swift.

Comment 7 Miroslav Grepl 2013-10-10 14:20:24 UTC
*** Bug 1014891 has been marked as a duplicate of this bug. ***

Comment 8 Pete Zaitcev 2014-03-11 17:44:12 UTC
See bug 1072005 to track the port problem. The /srv/node problem is
more like bug 1006497.

Comment 9 Fedora Admin XMLRPC Client 2014-08-06 15:07:59 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 10 Fedora Admin XMLRPC Client 2014-08-06 15:43:32 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 11 Fedora End Of Life 2015-01-09 19:44:34 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Fedora End Of Life 2015-02-17 17:04:56 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.