Bug 1698743 - Mongodb-org policy violation
Summary: Mongodb-org policy violation
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 30
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-11 07:23 UTC by Kostya Vasilyev
Modified: 2019-04-27 21:27 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-27 21:27:03 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Kostya Vasilyev 2019-04-11 07:23:02 UTC
Description of problem:

Mongodb-org causes an SELinux violation.

Now that Mongo has been removed from F30 repositories, I'm using Mongo's reps:

baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.0/x86_64/

After updating to latest (mongodb-org-server-4.0.9-1.el7.x86_64) I'm getting the below SELinux violation.

Now I understand that it's debatable whether Fedora should provide / fix an SE policy for what's now a third party package, but ...

... since Mongo was just recently dropped from official repos, I suppose there will be many developers switching to mongodb-org packages instead.

Supporting them with an up-to-date SE policy would be a nice way to ease the transition.

And them maybe - maybe - at some point Mongo starts producing Fedora packages, hopefully with SELinux policy files included.

-------

Version-Release number of selected component (if applicable):

mongodb-org-server-4.0.9-1.el7.x86_64
selinux-policy-targeted-3.14.3-27.fc30.noarch


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:

------------
SELinux is preventing mongod from search access on the directory /sys/fs/cgroup.

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

If you believe that mongod should be allowed search access on the cgroup 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:
# ausearch -c 'mongod' --raw | audit2allow -M my-mongod
# semodule -X 300 -i my-mongod.pp

Additional Information:
Source Context                system_u:system_r:mongod_t:s0
Target Context                system_u:object_r:cgroup_t:s0
Target Objects                /sys/fs/cgroup [ dir ]
Source                        mongod
Source Path                   mongod
Port                          <Unknown>
Host                          frida
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.3-27.fc30.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     frida
Platform                      Linux frida 5.0.7-300.fc30.x86_64 #1 SMP Mon Apr 8
                              18:28:09 UTC 2019 x86_64 x86_64
Alert Count                   4
First Seen                    2019-04-11 09:59:08 MSK
Last Seen                     2019-04-11 10:17:33 MSK
Local ID                      d2da1aa9-7e03-4281-a7b2-320d97761c9b

Raw Audit Messages
type=AVC msg=audit(1554967053.307:398): avc:  denied  { search } for  pid=6195 comm="mongod" name="/" dev="tmpfs" ino=15454 scontext=system_u:system_r:mongod_t:s0 tcontext=system_u:object_r:cgroup_t:s0 tclass=dir permissive=0


Hash: mongod,mongod_t,cgroup_t,dir,search
---------

Comment 1 Lukas Vrabec 2019-04-11 08:13:23 UTC
commit b78d1b1ed3768cb6241486b76edd9b473fe60e6f (HEAD -> rawhide)
Author: Lukas Vrabec <lvrabec>
Date:   Thu Apr 11 10:12:28 2019 +0200

    Allow mongod_t domain to lsearch in cgroups BZ(1698743)

Comment 2 Fedora Update System 2019-04-19 21:58:35 UTC
selinux-policy-3.14.3-31.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-3055c546d6

Comment 3 Kostya Vasilyev 2019-04-20 11:19:21 UTC
Installed Packages

selinux-policy.noarch                                   3.14.3-31.fc30                           @@commandline
selinux-policy-targeted.noarch                          3.14.3-31.fc30                           @@commandline


Rebooted the system

Did not help mongo

----

SELinux is preventing mongod from read access on the file memory.limit_in_bytes.

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

If you believe that mongod should be allowed read access on the memory.limit_in_bytes 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:
# ausearch -c 'mongod' --raw | audit2allow -M my-mongod
# semodule -X 300 -i my-mongod.pp

Additional Information:
Source Context                system_u:system_r:mongod_t:s0
Target Context                system_u:object_r:cgroup_t:s0
Target Objects                memory.limit_in_bytes [ file ]
Source                        mongod
Source Path                   mongod
Port                          <Unknown>
Host                          frida
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.3-31.fc30.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     frida
Platform                      Linux frida 5.0.8-300.fc30.x86_64 #1 SMP Wed Apr
                              17 16:55:36 UTC 2019 x86_64 x86_64
Alert Count                   38
First Seen                    2019-04-15 21:22:28 MSK
Last Seen                     2019-04-20 14:16:55 MSK
Local ID                      45ae7f2c-4d2a-4253-928d-c02cb631101c

Raw Audit Messages
type=AVC msg=audit(1555759015.407:223): avc:  denied  { read } for  pid=2024 comm="mongod" name="memory.limit_in_bytes" dev="cgroup" ino=10 scontext=system_u:system_r:mongod_t:s0 tcontext=system_u:object_r:cgroup_t:s0 tclass=file permissive=0


Hash: mongod,mongod_t,cgroup_t,file,read

Comment 4 Kostya Vasilyev 2019-04-20 11:23:01 UTC
Installed Packages

mongodb-org-server.x86_64                                 4.0.9-1.el7                                 @Mongodb
mongodb-org-shell.x86_64                                  4.0.9-1.el7                                 @Mongodb

On second sight, maybe the new violation is really new (i.e. not reported yet). Sorry about that.

Perhaps previously it was "hidden" by the "tmpfs" violation?

Comment 5 Fedora Update System 2019-04-20 14:42:15 UTC
selinux-policy-3.14.3-31.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-3055c546d6

Comment 6 Fedora Update System 2019-04-27 21:27:03 UTC
selinux-policy-3.14.3-31.fc30 has been pushed to the Fedora 30 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.