Bug 1770279 - SELinux is preventing firewalld from 'read' accesses on the directory site-packages.
Summary: SELinux is preventing firewalld from 'read' accesses on the directory site-pa...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 31
Hardware: x86_64
OS: Unspecified
low
low
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:bf254c1b20c055d256064da0d5e...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-08 15:35 UTC by Francesco Nicoletta
Modified: 2020-05-10 21:09 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-20 16:02:35 UTC
Type: ---


Attachments (Terms of Use)

Description Francesco Nicoletta 2019-11-08 15:35:59 UTC
Description of problem:
I installed KDE group an rebooted
SELinux is preventing firewalld from 'read' accesses on the directory site-packages.

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

If you believe that firewalld should be allowed read access on the site-packages 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 'firewalld' --raw | audit2allow -M my-firewalld
# semodule -X 300 -i my-firewalld.pp

Additional Information:
Source Context                system_u:system_r:firewalld_t:s0
Target Context                unconfined_u:object_r:gconf_home_t:s0
Target Objects                site-packages [ dir ]
Source                        firewalld
Source Path                   firewalld
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.4-39.fc31.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.3.8-300.fc31.x86_64 #1 SMP Tue
                              Oct 29 14:28:41 UTC 2019 x86_64 x86_64
Alert Count                   2
First Seen                    2019-11-08 16:33:29 CET
Last Seen                     2019-11-08 16:33:29 CET
Local ID                      459204b2-26af-48fb-bd94-8ef660f7794b

Raw Audit Messages
type=AVC msg=audit(1573227209.826:95): avc:  denied  { read } for  pid=1598 comm="firewalld" name="site-packages" dev="dm-1" ino=4330565 scontext=system_u:system_r:firewalld_t:s0 tcontext=unconfined_u:object_r:gconf_home_t:s0 tclass=dir permissive=0


Hash: firewalld,firewalld_t,gconf_home_t,dir,read

Version-Release number of selected component:
selinux-policy-3.14.4-39.fc31.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.10.1
hashmarkername: setroubleshoot
kernel:         5.3.8-300.fc31.x86_64
type:           libreport

Comment 1 Zdenek Pytela 2020-01-30 17:42:24 UTC
Hi Francesco,

From this report we can only see the directory name: site-packages. Do you happen to know its full path? Based on the result, we can better assess if or how this can be fixed.

Comment 2 John Freed 2020-02-06 14:17:09 UTC
I just got the same error. It's a python directory.

$ python -c "import site; print(site.getsitepackages())"
['/usr/local/lib64/python3.7/site-packages', '/usr/local/lib/python3.7/site-packages', '/usr/lib64/python3.7/site-packages', '/usr/lib/python3.7/site-packages']

I don't have a /usr/local/lib64 directory.

For the other three, I did a restorecon -vR site-packages/, no output (but it did take some time, so apparently the contexts were OK).

ls -Z produced a lot of system_u:object_r:lib_t:s0 for /usr/lib64/python3.7 and /usr/lib/python3.7

However, for /usr/local/lib/python3.7, I got
unconfined_u:object_r:lib_t:s0

These were for babelfish and diskcache. I believe I recently installed those manually via pip.

Next I did a sudo pip uninstall babelfish and sudo pip uninstall diskcache.

Finally, sudo dnf install python3-babelfish. This installed babelfish into /usr/lib/python3.7/site-packages, and ls -Z produced
system_u:object_r:lib_t:s0

I don't find a python3 diskcache package, and don't know if it's required by the app that needed babelfish. But I hope this solved this particular problem.

The root of it seems to be Python packages manually installed via pip.

Comment 3 John Freed 2020-02-06 14:21:22 UTC
additional info: the above info doesn't seem to pertain directly to firewalld

When I followed the suggestion to generate a module, the .te file is:


module my-firewalld 1.0;

require {
        type gconf_home_t;
        type firewalld_t;
        class dir read;
}

#============= firewalld_t ==============
allow firewalld_t gconf_home_t:dir read;

... so perhaps the site-packages was a red herring, or perhaps there is a deeper permissions problem.

Comment 4 John Freed 2020-02-06 14:24:53 UTC
here is the raw AVC:

type=AVC msg=audit(1580903533.768:35021): avc:  denied  { read } for  pid=134160 comm="firewalld" name="site-packages" dev="sda13" ino=787078 scontext=system_u:system_r:firewalld_t:s0 tcontext=unconfined_u:object_r:gconf_home_t:s0 tclass=dir permissive=0

Comment 5 Zdenek Pytela 2020-02-06 16:39:38 UTC
John,

gconf_home_t type is assigned to files in .gconf, .gconfd and .local directories in users home. If files were downloaded first to one of those and then moved to other destination, the context needs to be restored to match the path.

Can you locate the path of the directory from the last AVC? It has inode number 787078, filesystem is on device sda13.

Comment 6 John Freed 2020-02-07 19:25:38 UTC
well, sda13 is /, so I did
sudo find / -inum 787078 -print
... and let it run for a minute. The result:

/root/.local/lib/python3.7/site-packages

This no doubt came from using pip as a superuser. The directory is currently empty; I will delete it.

Comment 7 Zdenek Pytela 2020-04-20 16:02:35 UTC
John,

If I understand correctly, your issue now can be considered as solved, so I am also closing this bz.

Feel free to open a new bugzilla or to reopen this one and attach the needed information if the issue persists.


Note You need to log in before you can comment on or make changes to this bug.