Bug 1545637 - Firefox DRM plugin crashes on encrypted homedir due to SElinux
Summary: Firefox DRM plugin crashes on encrypted homedir due to SElinux
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-15 12:01 UTC by Ronald van Zantvoort
Modified: 2018-12-12 21:08 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-12-12 14:43:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ronald van Zantvoort 2018-02-15 12:01:55 UTC
Description of problem:
When Firefox tries to start the WideVine DRM plugin, it loads the .so file from the profile dir. 
When that's on an ecryptfs volume, selinux will forbid that.

Steps to Reproduce:
1. Start Firefox with it's profile in an encrypted /home
2. Try to run e.g. Spotify web player
3. Be very sad DRM was actually (not) included in the HTML spec 

Workaround:
setsebool unconfined_mozilla_plugin_transition 0

running restorecon -RrFv on ecryptfs does grand-all nuttin':
[theloeki@murphy 1.4.8.1008]$ pwd
/home/theloeki/.mozilla/firefox/cmaeafnc.default/gmp-widevinecdm/1.4.8.1008
[theloeki@murphy 1.4.8.1008]$ ls -1Z
system_u:object_r:ecryptfs_t:s0 libwidevinecdm.so
system_u:object_r:ecryptfs_t:s0 LICENSE.txt
system_u:object_r:ecryptfs_t:s0 manifest.json


Additional info:
SELinux is preventing plugin-containe from map access on the file
/home/theloeki/.mozilla/firefox/cmaeafnc.default/gmp-
widevinecdm/1.4.8.1008/libwidevinecdm.so.

*****  Plugin restorecon (57.3 confidence)
suggests   ************************

If you want to fix the label. 
/home/theloeki/.mozilla/firefox/cmaeafnc.default/gmp-
widevinecdm/1.4.8.1008/libwidevinecdm.so default label should be
mozilla_home_t.
Then you can run restorecon. The access attempt may have been stopped
due to insufficient permissions to access a parent directory in which
case try to change the following command accordingly.
Do
# /sbin/restorecon -v
/home/theloeki/.mozilla/firefox/cmaeafnc.default/gmp-
widevinecdm/1.4.8.1008/libwidevinecdm.so

*****  Plugin mozplugger (43.1 confidence)
suggests   ************************

If you want to use the plugin package
Then you must turn off SELinux controls on the Firefox plugins.
Do
# setsebool -P unconfined_mozilla_plugin_transition 0

*****  Plugin catchall (1.06 confidence)
suggests   **************************

If you believe that plugin-containe should be allowed map access on the
libwidevinecdm.so 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 'plugin-containe' --raw | audit2allow -M my-
plugincontaine
# semodule -X 300 -i my-plugincontaine.pp

Additional Information:
Source
Context                unconfined_u:unconfined_r:mozilla_plugin_t:s0-
s0:c
                              0.c1023
Target Context                system_u:object_r:ecryptfs_t:s0
Target
Objects                /home/theloeki/.mozilla/firefox/cmaeafnc.default
/g
                              mp-
widevinecdm/1.4.8.1008/libwidevinecdm.so [ file
                              ]
Source                        plugin-containe
Source Path                   plugin-containe
Port                          <Unknown>
Host                          murphy
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-283.24.fc27.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     murphy
Platform                      Linux murphy 4.14.18-300.fc27.x86_64 #1
SMP Thu
                              Feb 8 01:35:31 UTC 2018 x86_64 x86_64
Alert Count                   3
First Seen                    2018-02-15 12:39:48 CET
Last Seen                     2018-02-15 12:40:39 CET
Local ID                      96dd3108-9c20-4aaf-8762-1186591412a5

Raw Audit Messages
type=AVC msg=audit(1518694839.270:403): avc:  denied  { map }
for  pid=13524 comm="plugin-containe"
path="/home/theloeki/.mozilla/firefox/cmaeafnc.default/gmp-
widevinecdm/1.4.8.1008/libwidevinecdm.so" dev="ecryptfs" ino=134510276
scontext=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023
tcontext=system_u:object_r:ecryptfs_t:s0 tclass=file permissive=0


Hash: plugin-containe,mozilla_plugin_t,ecryptfs_t,file,map

Comment 1 Ben Cotton 2018-11-27 16:59:39 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

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 27 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 2 Ihar Hrachyshka 2018-11-27 22:28:13 UTC
This issue affects Fedora 29 too.

type=AVC msg=audit(1543357322.820:414): avc:  denied  { map } for  pid=32046 comm="plugin-containe" path="/home/ihar/.mozilla/firefox/yuzfuiy9.default/gmp-widevinecdm/1.4.9.1088/libwidevinecdm.so" dev="dm-3" ino=6819816 scontext=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:container_file_t:s0 tclass=file permissive=0
type=ANOM_ABEND msg=audit(1543357322.839:415): auid=1000 uid=1000 gid=1000 ses=2 subj=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 pid=32046 comm="plugin-containe" exe="/usr/lib64/firefox/plugin-container" sig=11 res=1AUID="ihar" UID="ihar" GID="ihar"
type=AVC msg=audit(1543357326.032:418): avc:  denied  { map } for  pid=32073 comm="plugin-containe" path="/home/ihar/.mozilla/firefox/yuzfuiy9.default/gmp-widevinecdm/1.4.9.1088/libwidevinecdm.so" dev="dm-3" ino=6819816 scontext=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:container_file_t:s0 tclass=file permissive=0
type=ANOM_ABEND msg=audit(1543357326.050:419): auid=1000 uid=1000 gid=1000 ses=2 subj=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 pid=32073 comm="plugin-containe" exe="/usr/lib64/firefox/plugin-container" sig=11 res=1AUID="ihar" UID="ihar" GID="ihar"
type=AVC msg=audit(1543357336.967:422): avc:  denied  { map } for  pid=32261 comm="plugin-containe" path="/home/ihar/.mozilla/firefox/yuzfuiy9.default/gmp-widevinecdm/1.4.9.1088/libwidevinecdm.so" dev="dm-3" ino=6819798 scontext=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:container_file_t:s0 tclass=file permissive=0
type=ANOM_ABEND msg=audit(1543357336.984:423): auid=1000 uid=1000 gid=1000 ses=2 subj=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 pid=32261 comm="plugin-containe" exe="/usr/lib64/firefox/plugin-container" sig=11 res=1AUID="ihar" UID="ihar" GID="ihar"
type=AVC msg=audit(1543357341.297:426): avc:  denied  { map } for  pid=32284 comm="plugin-containe" path="/home/ihar/.mozilla/firefox/yuzfuiy9.default/gmp-widevinecdm/1.4.9.1088/libwidevinecdm.so" dev="dm-3" ino=6819798 scontext=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:container_file_t:s0 tclass=file permissive=0
type=ANOM_ABEND msg=audit(1543357341.314:427): auid=1000 uid=1000 gid=1000 ses=2 subj=unconfined_u:unconfined_r:mozilla_plugin_t:s0-s0:c0.c1023 pid=32284 comm="plugin-containe" exe="/usr/lib64/firefox/plugin-container" sig=11 res=1AUID="ihar" UID="ihar" GID="ihar"

Comment 3 Daniel Walsh 2018-11-28 15:26:59 UTC
This is looks like you relabled content in your home directory with a container label?

This is the wrong thing to do, if you use podman or docker and volume mount in your entire home dir, you should not relabel it.

-v /home/ihar:/home/ihar:Z

This causes the container engine (podman or docker) to relabel the directory, and other confined domains will nto be able to use the content.

You can fix the labels using restorecon

restorecon -R -F -v ~/

Comment 4 Lukas Vrabec 2018-12-12 14:43:14 UTC
Thanks Dan, 

Ronald van Zantvoort,
Please try commands from comment#3, if you're still facing this issues feel free to re-open this BZ.

Comment 5 Ihar Hrachyshka 2018-12-12 21:08:09 UTC
Thanks Daniel, the commands indeed helped. I think I screwed up my homedir when I was exposing a subdirectory into a container.


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