Bug 1013550

Summary: SELinux is preventing /usr/lib/erlang/erts-5.10.2/bin/beam.smp from 'write' accesses on the directory couchdb.
Product: [Fedora] Fedora Reporter: Christopher Meng <i>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dominick.grift, dwalsh, lvrabec, mgrepl, redhat2
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Unspecified   
Whiteboard: abrt_hash:ec6cfb7cd1a56f1c35e817ef75bcc801723b9d1486d66797edc3061090aff192
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-04 14:40:42 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 Christopher Meng 2013-09-30 10:31:15 UTC
Description of problem:
1. Pure install couchdb
2. Building couchdbkit
3. Running tests of couchdbkit
SELinux is preventing /usr/lib/erlang/erts-5.10.2/bin/beam.smp from 'write' accesses on the directory couchdb.

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

If you believe that beam.smp should be allowed write access on the couchdb 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 beam.smp /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:rabbitmq_beam_t:s0
Target Context                system_u:object_r:couchdb_log_t:s0
Target Objects                couchdb [ dir ]
Source                        beam.smp
Source Path                   /usr/lib/erlang/erts-5.10.2/bin/beam.smp
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           erlang-erts-R16B-01.1.fc20.1.i686
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-83.fc21.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.12.0-0.rc2.git2.2.fc21.i686+PAE
                              #1 SMP Thu Sep 26 15:21:52 UTC 2013 i686 i686
Alert Count                   5
First Seen                    2013-09-30 18:29:49 CST
Last Seen                     2013-09-30 18:29:52 CST
Local ID                      29a508ff-a851-44a4-b19c-c2bcbd443578

Raw Audit Messages
type=AVC msg=audit(1380536992.615:687): avc:  denied  { write } for  pid=23350 comm="beam.smp" name="couchdb" dev="sda6" ino=23655 scontext=system_u:system_r:rabbitmq_beam_t:s0 tcontext=system_u:object_r:couchdb_log_t:s0 tclass=dir


type=SYSCALL msg=audit(1380536992.615:687): arch=i386 syscall=open success=no exit=EACCES a0=b6740f84 a1=8441 a2=1b6 a3=0 items=0 ppid=1 pid=23350 auid=4294967295 uid=985 gid=980 euid=985 suid=985 fsuid=985 egid=980 sgid=980 fsgid=980 ses=4294967295 tty=(none) comm=beam.smp exe=/usr/lib/erlang/erts-5.10.2/bin/beam.smp subj=system_u:system_r:rabbitmq_beam_t:s0 key=(null)

Hash: beam.smp,rabbitmq_beam_t,couchdb_log_t,dir,write

Additional info:
reporter:       libreport-2.1.7
hashmarkername: setroubleshoot
kernel:         3.12.0-0.rc2.git2.2.fc21.i686+PAE
type:           libreport

Comment 1 Miroslav Grepl 2013-10-07 11:58:08 UTC
We need to revisit  rabbitmq_* policies in rawhide. 

Lukas,
AFAIK we have another bug where is has been requested(re-write this policy).

Christopher,
if you add a local policy, does it work then?

Comment 2 Christopher Meng 2013-10-07 13:57:04 UTC
Hmm..I forgot how to reproduce it..... Ooops.. Any hints?

Comment 3 Egon Kastelijn 2013-12-01 07:55:46 UTC
I did a clean CouchDB, tried to start it and got the same message.
CouchDB does not start if selinux is enforcing.

# getenforce 
Enforcing

# uname -r
3.11.7-200.fc19.x86_64

-----------------------------------
# sealert -l bad3ce79-d946-4446-a11c-d0b457378900
SELinux is preventing /usr/lib64/erlang/erts-5.10.3/bin/beam from write access on the directory couchdb.

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

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


Additional Information:
Source Context                system_u:system_r:rabbitmq_beam_t:s0
Target Context                system_u:object_r:couchdb_log_t:s0
Target Objects                couchdb [ dir ]
Source                        beam
Source Path                   /usr/lib64/erlang/erts-5.10.3/bin/beam
Port                          <Unknown>
Host                          myhost.iginet.local
Source RPM Packages           erlang-erts-R16B-02.3.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-74.13.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     myhost.iginet.local
Platform                      Linux srv1902.iginet.local 3.11.7-200.fc19.x86_64
                              #1 SMP Mon Nov 4 14:09:03 UTC 2013 x86_64 x86_64
Alert Count                   10
First Seen                    2013-12-01 07:58:39 CET
Last Seen                     2013-12-01 08:25:38 CET
Local ID                      bad3ce79-d946-4446-a11c-d0b457378900

Raw Audit Messages
type=AVC msg=audit(1385882738.25:4194): avc:  denied  { write } for  pid=9081 comm="beam" name="couchdb" dev="dm-1" ino=396317 scontext=system_u:system_r:rabbitmq_beam_t:s0 tcontext=system_u:object_r:couchdb_log_t:s0 tclass=dir


type=SYSCALL msg=audit(1385882738.25:4194): arch=x86_64 syscall=open success=no exit=EACCES a0=7f79b1101f10 a1=441 a2=1b6 a3=0 items=0 ppid=1 pid=9081 auid=4294967295 uid=996 gid=995 euid=996 suid=996 fsuid=996 egid=995 sgid=995 fsgid=995 ses=4294967295 tty=(none) comm=beam exe=/usr/lib64/erlang/erts-5.10.3/bin/beam subj=system_u:system_r:rabbitmq_beam_t:s0 key=(null)

Hash: beam,rabbitmq_beam_t,couchdb_log_t,dir,write
-----------------------------------

-> Can you tell met what commands I should run to provide the extra information you need?

kind regards,

   Egon

Comment 4 Lukas Vrabec 2014-04-04 14:40:42 UTC
#============= rabbitmq_beam_t ==============

#!!!! This avc is allowed in the current policy
allow rabbitmq_beam_t couchdb_log_t:dir write;