mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3840] Temporary private home directory based on template where changes are discarded? #2417
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#2417
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 @faern on GitHub (Dec 19, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3840
Maybe this is already supported with some combination of settings I have not yet figured out.
Use case: I want to create "disposable" firefox instances that are as isolated from the rest of the system as possible and from other instances of jails of the same type. And on exit I want everything done in that jail to be discarded/deleted. Sounds like
--private, I know. But I don't want my jail to start off on a completely clean slate. I want to base it off a known good setup (.mozillaetc.) I have with add-ons and all. The use case is kind of how DisposableVMs work in Qubes-OS: https://www.qubes-os.org/doc/disposablevm/.--private=jails/firefox-disposablewill not work since everything the jail does is persisted in this separate home directory. I need a combination of--privateand--private=<path>.I currently solve this by having a script that creates a temporary directory, copies my "home template" over, runs the jail from there and deletes it on exit. But it would be waaay cleaner if firejail did this internally. It already has awesome support for overlayfs and other types of re-mounting. So everything to support it is there already as I understand it.
Current workaround: The script I'm currently solving my use case with:
I would much rather do something like:
Where
--private-template=directorywould mean:@faern commented on GitHub (Dec 19, 2020):
For a little while I thought I had found the solution in
--private=directory --overlay-tmpfs. But these flags don't seem compatible with each other. As soon as I add--overlay-tmpfsthe--private=directoryis ignored and I can see my full normal home directory from inside the jail.@ghost commented on GitHub (Dec 19, 2020):
Have you played with the
private-homeoption yet? Quoting verbatim from the man:On a side-note regarding your script, recent firejail versions support referring to a profile with the app-name only. So a line like
--profile=$HOME/.config/firejail/firefox-disposable.profile \
can be simplified to
--profile=firefox-disposable \
@reinerh commented on GitHub (Dec 19, 2020):
Maybe
--tmpfs=dirname? In firejail-git this is allowed for non-root users inside their home directories.@faern commented on GitHub (Dec 20, 2020):
--private-home=firejails/firefox-disposableerrors withError: only top files and directories in user home are allowed. I can do--private-home=firejailsand end up with a new temporary home with onlyfirejails/. Maybe I can move stuff around and just have~/.mozilla.disposable,--private-homethat dir and give firefox some flags to use it instead? But it feels like a suboptimal and more error-prone way than just giving the jail a full home dir with correctly named content to isolate itself in.It feels like the help text for
--private-homecan be improved. Because it does not copy arbitrary files to the new home. If it was expressed as "Creates a new temporary home based on a subset of the current user's home" or something along those lines it would better showcase the intended usage? When I read "expressed as relative to the current user's home" I hesitate and kind of assume that../another_userwould work, since that's technically a relative path from my home ;)For
--tmpfs=dirnameI don't really understand at all what it does. When I use--tmpfs=a_dir_with_filesI end up in an empty jail. Not sure how to proceed. Great that the root requirement is fixed. But I still don't get how it works yet :)@glitsj16 Thanks for the hint on
--profile. I think I was using it as--profile=firefox-disposable.profilebefore and that's why it did not work for me and I switched to the full path.@faern commented on GitHub (Dec 20, 2020):
Ok.
--tmpfsneeds an absolute path. But it does not print any type of error if I give it a ralative path.Anyway. I can't seem to combine
--tmpfs=directorywith--private=directoryin a way that does what I want anyway.I end up in a jail locked into the test dir. So far so good. But all changes to that dir are still persisted. For any other value I try to pass to
--tmpfsI end up in other strange states.@rusty-snake commented on GitHub (Dec 20, 2020):
Does
--chroot=foo --overlay-tmpfswork?@faern commented on GitHub (Dec 20, 2020):
Nope. I get
Error: --overlay and --chroot options are mutually exclusive(with firejail 0.9.62 this time, because I changed to an older computer now. Not sure if this has changed. All earlier posts from me was using version 0.9.64).