diff options
author | Aidan Gauland <aidalgol@users.noreply.github.com> | 2021-01-09 09:51:41 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 20:51:41 +0000 |
commit | 3203dd23a83fc45924b0b46e1bf204bafa878b33 (patch) | |
tree | 68a46d9fdff2212a45cfea0e76b291e36608dc6d /etc | |
parent | fbuilder: check Yama permissions (diff) | |
download | firejail-3203dd23a83fc45924b0b46e1bf204bafa878b33.tar.gz firejail-3203dd23a83fc45924b0b46e1bf204bafa878b33.tar.zst firejail-3203dd23a83fc45924b0b46e1bf204bafa878b33.zip |
Add profile for npm (#3866)
* Add profile for npm
* Apply suggestions from code review
* Remove redundant blacklisting of Wayland.
* Remove unnecessary noblacklist lines for nodejs.
* Replace absolute paths to .inc files with filenames.
* Remove unneeded dbus whitelisting.
Co-authored-by: rusty-snake <41237666+rusty-snake@users.noreply.github.com>
* Remove empty line
To keep consistent with other profiles, remove the blank line after the header comment.
Co-authored-by: rusty-snake <41237666+rusty-snake@users.noreply.github.com>
* Add npm files to add-common-devel
So that our addition of npm paths to disable-programs.inc dose not break IDEs,
we need to unblacklist these same paths in allow-common-devel.inc.
* Remove extra blank line
* Add common whitelist includes to npm profile
* Tighten npm profile
Include disable-exec.inc, but allowing ${HOME}.
* Remove whitelist-common.inc from npm profile
whitelist-common breaks npm, and since we don't know where the user's npm
projects will be, leave the whitelist-common include in a comment with a note
about how to enable it for their setup.
* Fix inverted commands
Co-authored-by: rusty-snake <41237666+rusty-snake@users.noreply.github.com>
* Fixes for whitelisting
* Add login.defs to npm profile's private-etc
Co-authored-by: Aidan Gauland <aidalgol+git@fastmail.net>
Co-authored-by: rusty-snake <41237666+rusty-snake@users.noreply.github.com>
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/allow-common-devel.inc | 4 | ||||
-rw-r--r-- | etc/inc/allow-nodejs.inc | 6 | ||||
-rw-r--r-- | etc/inc/disable-programs.inc | 2 | ||||
-rw-r--r-- | etc/profile-m-z/npm.profile | 64 |
4 files changed, 76 insertions, 0 deletions
diff --git a/etc/inc/allow-common-devel.inc b/etc/inc/allow-common-devel.inc index 7cd087b14..68e91a09b 100644 --- a/etc/inc/allow-common-devel.inc +++ b/etc/inc/allow-common-devel.inc | |||
@@ -25,3 +25,7 @@ noblacklist ${HOME}/.cargo/registry | |||
25 | noblacklist ${HOME}/.cargo/.crates.toml | 25 | noblacklist ${HOME}/.cargo/.crates.toml |
26 | noblacklist ${HOME}/.cargo/.crates2.json | 26 | noblacklist ${HOME}/.cargo/.crates2.json |
27 | noblacklist ${HOME}/.cargo/.package-cache | 27 | noblacklist ${HOME}/.cargo/.package-cache |
28 | |||
29 | # npm | ||
30 | noblacklist ${HOME}/.npm | ||
31 | noblacklist ${HOME}/.npmrc | ||
diff --git a/etc/inc/allow-nodejs.inc b/etc/inc/allow-nodejs.inc new file mode 100644 index 000000000..78a4bed80 --- /dev/null +++ b/etc/inc/allow-nodejs.inc | |||
@@ -0,0 +1,6 @@ | |||
1 | # This file is overwritten during software install. | ||
2 | # Persistent customizations should go in a .local file. | ||
3 | include allow-nodejs.local | ||
4 | |||
5 | noblacklist ${PATH}/node | ||
6 | noblacklist /usr/include/node | ||
diff --git a/etc/inc/disable-programs.inc b/etc/inc/disable-programs.inc index 74d45c4ca..2112c9b4f 100644 --- a/etc/inc/disable-programs.inc +++ b/etc/inc/disable-programs.inc | |||
@@ -760,6 +760,8 @@ blacklist ${HOME}/.neverball | |||
760 | blacklist ${HOME}/.newsbeuter | 760 | blacklist ${HOME}/.newsbeuter |
761 | blacklist ${HOME}/.newsboat | 761 | blacklist ${HOME}/.newsboat |
762 | blacklist ${HOME}/.nicotine | 762 | blacklist ${HOME}/.nicotine |
763 | blacklist ${HOME}/.npm | ||
764 | blacklist ${HOME}/.npmrc | ||
763 | blacklist ${HOME}/.nv | 765 | blacklist ${HOME}/.nv |
764 | blacklist ${HOME}/.nylas-mail | 766 | blacklist ${HOME}/.nylas-mail |
765 | blacklist ${HOME}/.openarena | 767 | blacklist ${HOME}/.openarena |
diff --git a/etc/profile-m-z/npm.profile b/etc/profile-m-z/npm.profile new file mode 100644 index 000000000..2136fb443 --- /dev/null +++ b/etc/profile-m-z/npm.profile | |||
@@ -0,0 +1,64 @@ | |||
1 | # Firejail profile for npm | ||
2 | # Description: The Node.js Package Manager | ||
3 | # This file is overwritten after every install/update | ||
4 | # Persistent local customizations | ||
5 | include npm.local | ||
6 | # Persistent global definitions | ||
7 | include globals.local | ||
8 | |||
9 | blacklist /tmp/.X11-unix | ||
10 | blacklist ${RUNUSER} | ||
11 | |||
12 | noblacklist ${HOME}/.npm | ||
13 | noblacklist ${HOME}/.npmrc | ||
14 | |||
15 | noblacklist ${PATH}/bash | ||
16 | noblacklist ${PATH}/dash | ||
17 | noblacklist ${PATH}/sh | ||
18 | |||
19 | ignore noexec ${HOME} | ||
20 | |||
21 | include disable-common.inc | ||
22 | include disable-exec.inc | ||
23 | include disable-passwdmgr.inc | ||
24 | include disable-programs.inc | ||
25 | include disable-shell.inc | ||
26 | include disable-xdg.inc | ||
27 | |||
28 | # If you want whitelisting, change the line below to your npm projects directory | ||
29 | # and uncomment the lines below. | ||
30 | #mkdir ${HOME}/.npm | ||
31 | #mkfile ${HOME}/.npmrc | ||
32 | #whitelist ${HOME}/.npm | ||
33 | #whitelist ${HOME}/.npmrc | ||
34 | #whitelist ${HOME}/Projects | ||
35 | #include whitelist-common.inc | ||
36 | include whitelist-runuser-common.inc | ||
37 | include whitelist-usr-share-common.inc | ||
38 | include whitelist-var-common.inc | ||
39 | |||
40 | caps.drop all | ||
41 | ipc-namespace | ||
42 | machine-id | ||
43 | netfilter | ||
44 | no3d | ||
45 | nodvd | ||
46 | nogroups | ||
47 | nonewprivs | ||
48 | noroot | ||
49 | nosound | ||
50 | notv | ||
51 | nou2f | ||
52 | novideo | ||
53 | protocol unix,inet,inet6,netlink | ||
54 | seccomp | ||
55 | seccomp.block-secondary | ||
56 | shell none | ||
57 | |||
58 | disable-mnt | ||
59 | private-dev | ||
60 | private-etc alternatives,ca-certificates,crypto-policies,host.conf,hostname,hosts,ld.so.cache,ld.so.conf,ld.so.conf.d,ld.so.preload,locale,locale.alias,locale.conf,localtime,login.defs,mime.types,nsswitch.conf,pki,protocols,resolv.conf,rpc,services,ssl,xdg | ||
61 | private-tmp | ||
62 | |||
63 | dbus-user none | ||
64 | dbus-system none | ||