From ab78a250dbf889898427f46f52260425ccc8eda5 Mon Sep 17 00:00:00 2001 From: Tad Date: Sat, 13 Apr 2019 10:27:47 -0400 Subject: Add a conditional to control DRM/noexec exception for browsers --- etc/chromium-common.profile | 2 +- etc/firefox-common.profile | 2 +- etc/firejail.config | 9 ++++++--- etc/midori.profile | 2 +- etc/min.profile | 2 +- src/firejail/checkcfg.c | 1 + src/firejail/firejail.h | 1 + src/firejail/profile.c | 5 +++++ src/man/firejail-profile.txt | 2 +- 9 files changed, 18 insertions(+), 8 deletions(-) diff --git a/etc/chromium-common.profile b/etc/chromium-common.profile index 3c7423316..63983d93b 100644 --- a/etc/chromium-common.profile +++ b/etc/chromium-common.profile @@ -7,7 +7,7 @@ include chromium-common.local #include globals.local # noexec ${HOME} breaks DRM binaries. -ignore noexec ${HOME} +?BROWSER_ALLOW_DRM: ignore noexec ${HOME} noblacklist ${HOME}/.pki noblacklist ${HOME}/.local/share/pki diff --git a/etc/firefox-common.profile b/etc/firefox-common.profile index a2a34f33f..080d9e81a 100644 --- a/etc/firefox-common.profile +++ b/etc/firefox-common.profile @@ -7,7 +7,7 @@ include firefox-common.local #include globals.local # noexec ${HOME} breaks DRM binaries. -ignore noexec ${HOME} +?BROWSER_ALLOW_DRM: ignore noexec ${HOME} # Uncomment the following line to allow access to common programs/addons/plugins. #include firefox-common-addons.inc diff --git a/etc/firejail.config b/etc/firejail.config index b37edf7a5..497d9633e 100644 --- a/etc/firejail.config +++ b/etc/firejail.config @@ -5,9 +5,6 @@ # Enable AppArmor functionality, default enabled. # apparmor yes -# Disable U2F in browsers, default enabled. -# browser-disable-u2f yes - # Number of ARP probes sent when assigning an IP address for --net option, # default 2. This is a partial implementation of RFC 5227. A 0.5 seconds # timeout is implemented for each probe. Increase this number to 4 if your @@ -18,6 +15,12 @@ # Enable or disable bind support, default enabled. # bind yes +# Allow (DRM) execution in browsers, default disabled. +# browser-allow-drm no + +# Disable U2F in browsers, default enabled. +# browser-disable-u2f yes + # Enable or disable cgroup support, default enabled. # cgroup yes diff --git a/etc/midori.profile b/etc/midori.profile index d59a6a16b..e4d39cd70 100644 --- a/etc/midori.profile +++ b/etc/midori.profile @@ -14,7 +14,7 @@ noblacklist ${HOME}/.pki noblacklist ${HOME}/.local/share/pki # noexec ${HOME} breaks DRM binaries. -ignore noexec ${HOME} +?BROWSER_ALLOW_DRM: ignore noexec ${HOME} include disable-common.inc include disable-devel.inc diff --git a/etc/min.profile b/etc/min.profile index eec81677d..c89df0a95 100644 --- a/etc/min.profile +++ b/etc/min.profile @@ -12,7 +12,7 @@ noblacklist ${HOME}/.pki noblacklist ${HOME}/.local/share/pki # noexec ${HOME} breaks DRM binaries. -ignore noexec ${HOME} +?BROWSER_ALLOW_DRM: ignore noexec ${HOME} include disable-common.inc include disable-devel.inc diff --git a/src/firejail/checkcfg.c b/src/firejail/checkcfg.c index 54f6ea023..7ca72bf30 100644 --- a/src/firejail/checkcfg.c +++ b/src/firejail/checkcfg.c @@ -111,6 +111,7 @@ int checkcfg(int val) { PARSE_YESNO(CFG_DISABLE_MNT, "disable-mnt") PARSE_YESNO(CFG_XPRA_ATTACH, "xpra-attach") PARSE_YESNO(CFG_BROWSER_DISABLE_U2F, "browser-disable-u2f") + PARSE_YESNO(CFG_BROWSER_ALLOW_DRM, "browser-allow-drm") #undef PARSE_YESNO // netfilter diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h index b2c18d79f..2e04084e3 100644 --- a/src/firejail/firejail.h +++ b/src/firejail/firejail.h @@ -702,6 +702,7 @@ enum { CFG_ARP_PROBES, CFG_XPRA_ATTACH, CFG_BROWSER_DISABLE_U2F, + CFG_BROWSER_ALLOW_DRM, CFG_PRIVATE_LIB, CFG_APPARMOR, CFG_DBUS, diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 667b03652..c8619f7e2 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c @@ -151,10 +151,15 @@ static int check_disable_u2f(void) { return checkcfg(CFG_BROWSER_DISABLE_U2F) != 0; } +static int check_allow_drm(void) { + return checkcfg(CFG_BROWSER_ALLOW_DRM) != 0; +} + Cond conditionals[] = { {"HAS_APPIMAGE", check_appimage}, {"HAS_NODBUS", check_nodbus}, {"BROWSER_DISABLE_U2F", check_disable_u2f}, + {"BROWSER_ALLOW_DRM", check_allow_drm}, { NULL, NULL } }; diff --git a/src/man/firejail-profile.txt b/src/man/firejail-profile.txt index dde815d05..20b547355 100644 --- a/src/man/firejail-profile.txt +++ b/src/man/firejail-profile.txt @@ -94,7 +94,7 @@ Example: "?HAS_APPIMAGE: whitelist ${HOME}/special/appimage/dir" This example will load the whitelist profile line only if the \-\-appimage option has been specified on the command line. -Currently the only conditionals supported are HAS_APPIMAGE, HAS_NODBUS and BROWSER_DISABLE_U2F. +Currently the only conditionals supported are HAS_APPIMAGE, HAS_NODBUS, BROWSER_DISABLE_U2F, and BROWSER_ALLOW_DRM. The profile line may be any profile line that you would normally use in a profile \fBexcept\fR for "quiet" and "include" lines. -- cgit v1.2.3-54-g00ecf