mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1130] mkdir and whitelist enhancements #778
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#778
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @msva on GitHub (Mar 6, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1130
It will be nice if directives like
whitelist/mkdir/blacklist/noblacklist(and so on) support variables like${USER}and${UID}, and also allowed to use them "in-line" (look below).For example, firefox uses
/tmp/mozilla_mva0as temp download dir (to download files, for opening in external programs) on my system.Here,
mvais a username of system user running firefox.I'd very like to
whitelist(andmkdir, since it can to not exist at the timefirefoxstarts) it, but it seems to be impossible without hardcoding username...Also, it is paths like
/run/user/1000/<...>. And in some cases I'd very like to hide/runfrom application (so it can't see foreign pids, sockets and so on), but allow it to use some sockets under/run/user/<uid>/So, I'd like to use
for first case, and
for second.
===
Also, it will be nice to have regex/pcre support for the path-related directives (as I mentioned above, things like
[0-9]can be useful, but much more useful thing in the paths is wildcards).mkdircan (and probably should) not support expressions in last particle (since it is useless), but it should support them for0topre-lastparticles.===
Also, you mentioned in one of the previous issues, that you have plans to allow all paths under
/bewhitelist'ed.And that's great!
But they also should be allowed to be
mkdir'ed,blacklist'ed (especially/run), and so on.Thanks for the attention :)
@netblue30 commented on GitHub (Mar 7, 2017):
You can blacklist individual files or directories under /run today:
To blacklist /run is not possible, this is where firejail keeps its runtime data. I'll add support to whitelist /run. I can add mkdir support in /tmp directory, but not in other places. The directory will be created as the regular user starting the sandbox. I'll look into extending regx support.
@msva commented on GitHub (Mar 7, 2017):
So, I guess, allowing whitelisting /run (as any other dir in
/) and auto-whitelisting /run/firejail will do the trick...How about making it possible in general, but disabled by default (as you did for symlinks in private-bin)? And also forbid to enable it in user's configuration (only in system-wide config)
I agree, that it can be potentially dangerous (although, I do not see the exact unavoidable flaw), but it is also situations where it can be useful (especially for the soft that wants to be run as root), and some users can take responsibility for their actions :-D.
Thanks!
// and don't forget about variables, please ;) As I initially mentioned, it is good to whitelist
/tmp/mozilla_${USER}0directory (even in default Fx profile), but it is impossible without hardcoding username.And same for
/run/user/${UID}condition.Or even
/tmp/tmux-${UID}. And it it tons of examples where it can be useful ;)Thanks in advance ;)
@netblue30 commented on GitHub (Mar 7, 2017):
I added support for mkdir under /tmp directory. You can try it out.
For private-bin the symlinks already exist, and is assumed root user put them there. The problem is allowing the regular user to create directories as root.
I'll add /run to whitelist options. What other directories would you need?
@msva commented on GitHub (Mar 7, 2017):
ok, let's forget about
mkdirfor now, and talk aboutwhitelist:For
whitelist, I think it should be possible to set any path. You can't predict filesystem paths user decided to use on his/her fs: it can be anything:/usr/*for hiding /usr stuff (compilers, linkers, includes and many other info) except for needed one, or/data,/systemand so on on androids,Or there is CoreOS and its friends with totally different filesystem hierarchy.
So, as I said, it can be absolutelly any random path that user might want to whitelist for some reasons.
So, I'd ask you to not hardcode every single condition in fj's sources, but just allow to whitelist everything under
/. Anyway, I can't imagine how it can be used for bad.@msva commented on GitHub (Mar 7, 2017):
Also, a bit offtop: am I missing something, or there is no option like
touchor something like it? Expected behaviour is likemkdir, but create empty files, but not directories. Would be useful in situations:bind'ing (while file doesn't exist on host system)blacklist'ing (to pretend like file do exist, but is unavailable because of 'Permission denied') also, for cases where file doesn't exist on host system@netblue30 commented on GitHub (Mar 8, 2017):
Use "mkfile" in profile files.
Until I figure out the random whitelisting, I'll add support for /run and /usr.