mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #459] Patch to bind user home directories #325
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#325
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 @lepasserby on GitHub (Apr 19, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/459
Hi!
Perhaps a silly question, but it was mentioned that --x11 is not available for root.
Would it work for cases where firejail is called like
sudo firejail --x11 --user=non-root-user --net=br1 program-name
?
Reason for sudoing: need to bind a "host" directory into the sandbox at startup (so the jailed program's output is available to certain processes at host), thus plan to have whitelist directory directive in the profile and it requires root.
program that needs to be jailed can run as non-root (hence --user=non-root-user)
@netblue30 commented on GitHub (Apr 20, 2016):
The order Firejail applies the commands will prevent you from doing it. This is something that will work:
Start with a naked root sandbox where you apply the bind:
Switch to your user:
Start the real x11 sandbox using --force:
Or you can do all in one line:
@lepasserby commented on GitHub (Apr 20, 2016):
I assume if I want to apply secomp filters or something like that, I'd best do that in the "last" firejail (the --force one) ?
Should first firejail come with --noprofile, or could it have one?
If "naked" firejail is started with a specific profile, would the second (--force) one honor the profile (esp whitelist directive) ?
@netblue30 commented on GitHub (Apr 20, 2016):
Yes, seccomp is applied to the second sandbox. If you put it in the first sandbox, the second one will not start.
And yes, you can use also use a profile for the first sandbox, but don't put in anything that might prevent the second sandbox from starting, such as seccomp, caps etc. Whitelisting should work in the first profile.
@lepasserby commented on GitHub (Apr 20, 2016):
Okay, thanks!
Last (maybe) question (tangentially related, but might deserve own issue)
Let's say I want to run program in a "hollow" non-persistent homedir (as achieved by --private) but want to make one specific directory in the new homedir available to host and/or persistent.
What profile and command line directives and in what order would achieve that ?
@netblue30 commented on GitHub (Apr 21, 2016):
You would use --whitelist. Example:
will create a "hollow" /home/user directory with /home/user/somedir imported form the filesystem and it will be persistent.
@djfd commented on GitHub (Dec 13, 2016):
just a couple of cents,
there is a patch allowing to mount a few home subdirectories in bind mode, thus their content is fully synchronized between a host and sandbox.
I do not know how secure it is, is it possible to escape somehow using such kind of binding or not...
Experts advises and thoughts related to this approach are very welcome!
binding-home-subdir.patch.txt
@netblue30 commented on GitHub (Dec 13, 2016):
Thanks, I'll look into it.
@chiraag-nataraj commented on GitHub (Jul 15, 2018):
Isn't
--forcedeprecated now? So how would one do this with the newerfirejailversions?@tonsimple commented on GitHub (Sep 12, 2018):
@netblue30 @chiraag-nataraj
I too have an interest in launching firejailed apps from a limited user, but in a firejail environment that was initially set up using "root-stuff"
"--force" still works for me (version 0.9.44.8 Debian 8) but if it is "on its way out" that may cause issues for me later on so I would like to know what's best practice is for the kind of thing I'm doing
P.S.:
Also, I would like to humbly request the return of --user command line switch. I realize there are probably practical reasons for its removal, but it was so comfy
@Vincent43 commented on GitHub (Sep 12, 2018):
It was removed due to security concerns so I doubt it will be ever restored.
@tonsimple commented on GitHub (Sep 22, 2018):
@Vincent43
Woah, that sounds bad.
@netblue30 , is running firejail "as someone else" unsafe in principle, or is it just --user implementation that was not very safe?
I'm currently doing
run firejail as root, set up environment, then use daemonize binary (easy to build on most platforms) to run another firejail with --force and proper profile (including seccomp and capability filters) . Seems to be working fine and daemonize offers a few neat bells and whistles.
using su to launch second firejail also works, I just kind of like daemonize more.
Is such a methodology somehow bad?
@rusty-snake commented on GitHub (Jan 25, 2020):
Something like
--bind-home=s,twould allow a lot of workarounds, I'm thinking #3139, …