Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 471908 - www-client/firefox-21.0 wants access to ~/.cache/mozilla on selinux
Summary: www-client/firefox-21.0 wants access to ~/.cache/mozilla on selinux
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: SELinux (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sven Vermeulen (RETIRED)
URL:
Whiteboard: sec-policy r2
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-31 14:12 UTC by Amadeusz Sławiński
Modified: 2013-08-15 07:45 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amadeusz Sławiński 2013-05-31 14:12:39 UTC
% firefox
Error: Access was denied while trying to open files in your profile directory.

% ls -laZ ~ | grep .cache
drwx------. 18 amade amade staff_u:object_r:xdg_cache_home_t            4096 May 31 16:07 .cache
drwxr-xr-x.  2 amade amade staff_u:object_r:user_fonts_cache_t          4096 May 25 21:54 .fontconfig
drwx------.  2 amade amade staff_u:object_r:user_home_t                 4096 Sep 11  2012 .zcompcache
% ls -laZ ~/.cache | grep mozilla
drwx------.  3 amade amade staff_u:object_r:xdg_cache_home_t  4096 May 31 16:04 mozilla
% ls -laZ ~/.cache/mozilla        
total 12
drwx------.  3 amade amade staff_u:object_r:xdg_cache_home_t 4096 May 31 16:04 .
drwx------. 18 amade amade staff_u:object_r:xdg_cache_home_t 4096 May 31 16:07 ..
drwx------.  3 amade amade staff_u:object_r:xdg_cache_home_t 4096 May 31 16:04 firefox
% ls -laZ ~/.cache/mozilla/firefox 
total 12
drwx------. 3 amade amade staff_u:object_r:xdg_cache_home_t 4096 May 31 16:04 .
drwx------. 3 amade amade staff_u:object_r:xdg_cache_home_t 4096 May 31 16:04 ..
drwx------. 6 amade amade staff_u:object_r:xdg_cache_home_t 4096 May 31 16:04 9pth3023.default

Enforcing:

May 31 16:09:09 localhost kernel: [ 9068.072493] type=1400 audit(1370009349.494:2971): avc:  denied  { search } for  pid=24521 comm="firefox" name=".cache" dev="dm-0" ino=20851162 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir
May 31 16:09:09 localhost kernel: [ 9068.072509] type=1400 audit(1370009349.494:2972): avc:  denied  { search } for  pid=24521 comm="firefox" name=".cache" dev="dm-0" ino=20851162 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir

Permissive:

May 31 16:09:24 localhost kernel: [ 9082.716524] type=1400 audit(1370009364.135:2974): avc:  denied  { read } for  pid=2208 comm="X" name="cmdline" dev="proc" ino=1116050 scontext=staff_u:staff_r:xserver_t tcontext=staff_u:staff_r:staff_t tclass=file
May 31 16:09:24 localhost kernel: [ 9082.716538] type=1400 audit(1370009364.135:2975): avc:  denied  { open } for  pid=2208 comm="X" path="/proc/24584/cmdline" dev="proc" ino=1116050 scontext=staff_u:staff_r:xserver_t tcontext=staff_u:staff_r:staff_t tclass=file
May 31 16:09:27 localhost kernel: [ 9086.536980] type=1400 audit(1370009367.954:2976): avc:  denied  { read } for  pid=2208 comm="X" name="cmdline" dev="proc" ino=1119260 scontext=staff_u:staff_r:xserver_t tcontext=staff_u:staff_r:mozilla_t tclass=file
May 31 16:09:27 localhost kernel: [ 9086.536994] type=1400 audit(1370009367.954:2977): avc:  denied  { open } for  pid=2208 comm="X" path="/proc/24587/cmdline" dev="proc" ino=1119260 scontext=staff_u:staff_r:xserver_t tcontext=staff_u:staff_r:mozilla_t tclass=file
May 31 16:09:29 localhost kernel: [ 9087.635244] type=1400 audit(1370009369.052:2978): avc:  denied  { read } for  pid=24586 comm="firefox" name="startupCache.8.little" dev="dm-0" ino=21760317 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=file
May 31 16:09:29 localhost kernel: [ 9087.635260] type=1400 audit(1370009369.052:2979): avc:  denied  { open } for  pid=24586 comm="firefox" path="/home/amade/.cache/mozilla/firefox/9pth3023.default/startupCache/startupCache.8.little" dev="dm-0" ino=21760317 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=file
May 31 16:09:29 localhost kernel: [ 9087.635280] type=1400 audit(1370009369.052:2980): avc:  denied  { getattr } for  pid=24586 comm="firefox" path="/home/amade/.cache/mozilla/firefox/9pth3023.default/startupCache/startupCache.8.little" dev="dm-0" ino=21760317 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=file
May 31 16:09:30 localhost kernel: [ 9088.823491] type=1400 audit(1370009370.240:2981): avc:  denied  { read } for  pid=24613 comm=436163686520492F4F name="9pth3023.default" dev="dm-0" ino=21758799 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir
May 31 16:09:30 localhost kernel: [ 9088.823515] type=1400 audit(1370009370.240:2982): avc:  denied  { open } for  pid=24613 comm=436163686520492F4F path="/home/amade/.cache/mozilla/firefox/9pth3023.default" dev="dm-0" ino=21758799 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir
May 31 16:09:30 localhost kernel: [ 9088.823655] type=1400 audit(1370009370.240:2983): avc:  denied  { write } for  pid=24613 comm=436163686520492F4F name="_CACHE_MAP_" dev="dm-0" ino=21758821 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=file
May 31 16:09:30 localhost kernel: [ 9088.838583] type=1400 audit(1370009370.255:2984): avc:  denied  { write } for  pid=24586 comm="firefox" name="startupCache" dev="dm-0" ino=21758802 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir
May 31 16:09:30 localhost kernel: [ 9088.838602] type=1400 audit(1370009370.255:2985): avc:  denied  { remove_name } for  pid=24586 comm="firefox" name="startupCache.8.little" dev="dm-0" ino=21760317 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir
May 31 16:09:30 localhost kernel: [ 9088.838614] type=1400 audit(1370009370.255:2986): avc:  denied  { unlink } for  pid=24586 comm="firefox" name="startupCache.8.little" dev="dm-0" ino=21760317 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=file
May 31 16:09:33 localhost kernel: [ 9091.632104] type=1400 audit(1370009373.048:2987): avc:  denied  { getattr } for  pid=24634 comm=55524C20436C6173736966696572 path="/home/amade/.cache/mozilla/firefox/9pth3023.default/safebrowsing" dev="dm-0" ino=21760325 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir
May 31 16:09:34 localhost kernel: [ 9092.956985] type=1400 audit(1370009374.373:2988): avc:  denied  { rename } for  pid=24634 comm=55524C20436C6173736966696572 name="safebrowsing" dev="dm-0" ino=21760325 scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir
May 31 16:09:34 localhost kernel: [ 9092.957000] type=1400 audit(1370009374.373:2989): avc:  denied  { add_name } for  pid=24634 comm=55524C20436C6173736966696572 name="safebrowsing-backup" scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir
May 31 16:09:34 localhost kernel: [ 9092.957097] type=1400 audit(1370009374.373:2990): avc:  denied  { create } for  pid=24634 comm=55524C20436C6173736966696572 name="safebrowsing" scontext=staff_u:staff_r:mozilla_t tcontext=staff_u:object_r:xdg_cache_home_t tclass=dir






Reproducible: Always




Portage 2.1.12.2 (hardened/linux/amd64/selinux, gcc-4.7.3, glibc-2.17, 3.9.4-hardened x86_64)
=================================================================
System uname: Linux-3.9.4-hardened-x86_64-Intel-R-_Core-TM-_i3_CPU_M_350_@_2.27GHz-with-gentoo-2.2
KiB Mem:     2997004 total,    141440 free
KiB Swap:    3145724 total,   3145724 free
Timestamp of tree: Wed, 29 May 2013 00:45:01 +0000
ld GNU gold (GNU Binutils 2.23.1) 1.11
app-shells/bash:          4.2_p45
dev-lang/python:          2.7.5, 3.2.5, 3.3.2
dev-util/cmake:           2.8.10.2-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.6, 1.13.2
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.7.3
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo hardened-dev my_local_overlay
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch webrsync-gpg xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/hardened-development /usr/local/portage"
SYNC=""
USE="X acpi alsa amd64 apache2 bash-completion berkdb bluetooth bzip2 cli cracklib crypt cups cxx dbus dri dvd flac gdbm gif gold gpm hardened iconv icu ipv6 jpeg jpeg2k justify libnotify mmx mng modules mp3 mudflap multilib mysql ncurses nls nptl open_perms opengl openmp pam pax_kernel pcre png readline selinux session sse sse2 sse4_1 sse4_2 ssl ssse3 tcpd threads tiff udev unicode urandom usb v4l vim-syntax wacom xattr xft xinerama zlib zsh-completion" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_GB pl" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" QEMU_SOFTMMU_TARGETS="x86_64 ppc" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Sven Vermeulen (RETIRED) gentoo-dev 2013-06-22 19:36:53 UTC
I've added the following to the repo:

"""
diff --git a/policy/modules/contrib/mozilla.te b/policy/modules/contrib/mozilla.te
index 3255a31..aedcc00 100644
--- a/policy/modules/contrib/mozilla.te
+++ b/policy/modules/contrib/mozilla.te
@@ -624,6 +624,9 @@ gen_tunable(mozilla_bind_all_unreserved_ports, false)
 ## </desc>
 gen_tunable(mozilla_plugin_connect_all_unreserved, false)
 
+       type mozilla_xdg_cache_t;
+       xdg_cache_home_content(mozilla_xdg_cache_t)
+
        #####################
        #
        # Mozilla policy
@@ -634,6 +637,10 @@ gen_tunable(mozilla_plugin_connect_all_unreserved, false)
 
        manage_fifo_files_pattern(mozilla_t, mozilla_tmp_t, mozilla_tmp_t)
 
+       manage_files_pattern(mozilla_t, mozilla_xdg_cache_t, mozilla_xdg_cache_t) 
+       manage_dirs_pattern(mozilla_t, mozilla_xdg_cache_t, mozilla_xdg_cache_t)
+       xdg_cache_home_filetrans(mozilla_t, mozilla_xdg_cache_t, dir, "mozilla")
+
        corenet_dontaudit_tcp_bind_generic_port(mozilla_t)
        corenet_dontaudit_tcp_sendrecv_generic_port(mozilla_t)
        corenet_sendrecv_tor_client_packets(mozilla_t)
"""

and a context definition:

"""
diff --git a/policy/modules/contrib/mozilla.fc b/policy/modules/contrib/mozilla.fc
index 9e74bfa..54e1ba4 100644
--- a/policy/modules/contrib/mozilla.fc
+++ b/policy/modules/contrib/mozilla.fc
@@ -1,3 +1,4 @@
+HOME_DIR/\.cache/mozilla(/.*)? gen_context(system_u:object_r:mozilla_xdg_cache_t,s0)
 HOME_DIR/\.galeon(/.*)?        gen_context(system_u:object_r:mozilla_home_t,s0)
 HOME_DIR/\.mozilla(/.*)?       gen_context(system_u:object_r:mozilla_home_t,s0)
 HOME_DIR/\.mozilla/plugins(/.*)?       gen_context(system_u:object_r:mozilla_plugin_home_t,s0)
"""

I believe this is sufficient to resolve this (you might need to relabel ~/.cache/mozilla first if that directory still exists, or remove/rename it). Can you try with the repo build (live ebuilds) or with the above patches in place locally?
Comment 2 Amadeusz Sławiński 2013-06-22 20:44:06 UTC
Looks like it works (seeing as I post it from firefox in enforcing ;) ), thanks!
Comment 3 Sven Vermeulen (RETIRED) gentoo-dev 2013-07-21 16:25:37 UTC
In repo, ~arch (rev 2 of the policies)
Comment 4 Sven Vermeulen (RETIRED) gentoo-dev 2013-08-15 07:45:52 UTC
r2 is now stable