mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1255] Modify whitelist's behaviour #854
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#854
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 @cryzed on GitHub (Apr 28, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1255
I follow this guide currently to create whitelisted profiles. My profile for PyCharm that uses a whitelist instead of a blacklist looks currently like this:
The first 2 includes basically take care of whitelisting my ~/Documents folder and including the firejail default profile and common whitelist includes. As you see, to make sure that data persists that I create using PyCharm, I make sure to create all directories and files that PyCharm might create before whitelisting them -- if I simply whitelisted them and they don't actually exist they won't survive a reboot as far as I understand.
Now having to do this comes at a slight disadvantage: having to create all possible folders and files that an application might create to make sure they are persistent, might result in many empty directories and files in the home directory where it's not even guaranteed that they have the correct permissions set, assuming the application does something special with them.
Would it be possible to modify the behavior of the whitelist command to simply copy over whitelisted files and folders to the actual home directory if they were created within the whitelisted environment during the execution? That way one wouldn't have to create all the files and folders beforehand on the off-chance that they might be used in that specific scenario and the files and folders would only be created (with the correct permissions), when they would actually be created if the program was running normally.
I know that Firejail uses bind mounts for the whitelisting feature, so I'm not sure how feasible this is -- I could imagine intercepting system calls that create directories and files, checking if they are whitelisted, and then creating them in the home-directory instead and bind mounting them inside the sandbox, that would avoid having to copy the files back to the home directory after the execution. However I don't know if something like this is outside the scope of Firejail or even easily possible, there might be an easier solution that I'm not seeing. However I do think if Firejail was able to do something like this, the whitelist feature would be almost as easy to use as the blacklist feature and be more secure by design.
I would appreciate your thoughts.
@netblue30 commented on GitHub (May 1, 2017):
No, because there is no reliable way to detect when the sandbox is closed in order to copy the files back on the real system.
@cryzed commented on GitHub (May 2, 2017):
So what about using the existing
--tracefeature's functionality to do what I suggested here:Then there would be no need to detect if the sandbox was closed.
@SYN-cook commented on GitHub (May 3, 2017):
But the fact that non-whitelisted files are discarded when the jail is closed adds significantly to the security of whitelisting... it is in fact the unique selling point of whitelisting. When you take that away, there is not much difference any more between whitelisting and what you can achieve with blacklisting.
Also blacklisting is not much less convenient if you consequently employ wildcards, something that whitelisting doesn't support as of now. Take only your example profile:
The include file might have to be a bit longer, but the actual profile is short and crisp, and whitelisting wouldn't make it much shorter.
@cryzed commented on GitHub (May 3, 2017):
The reason I prefer to use
whitelistis becauseblacklistsimply denies the access to files and folders, whilewhitelistcompletely hides them.@SYN-cook commented on GitHub (May 3, 2017):
Ok, thanks. I understand. So the use case is hiding filenames in directories that need to be accessed... but without having to create files and folders first, as would be necessary with current whitelisting
@cryzed commented on GitHub (May 6, 2017):
That seems pretty accurate yes. It's simply an additional layer of privacy. It is always possible to expose something accidentally within a file or folder-name that you really didn't want to -- hiding files and folders that really don't need to be accessed seems like a good idea in general. Whitelisting allows me to do that currently, with this (small) drawback and I had hoped to eliminate it.
@jody-frankowski commented on GitHub (May 18, 2017):
I was about to make an issue about that. It would be nice to have an option in firejail ("--whitelist-mkdir"?) that would tell firejail to create whitelisted directories.