mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #2146] Question: how can I blacklist /home for Firefox? #1455
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#1455
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 @Iggy-J on GitHub (Oct 8, 2018).
Original GitHub issue: https://github.com/netblue30/firejail/issues/2146
The aim is to make only /home/user/Downloads writeable for browser, and to deny all tries to save the file during download to another folder, especially "root" /home/user. Is it possible? I understand, that Firefox need write permission to .cache, .config and so on, but is there a way? Of course I can blacklist /Desktop, /Pictures and others, but what is with /home itself, and with folders with unpredictable names that user can create inside it? Many thanks in advance.
@chiraag-nataraj commented on GitHub (Oct 8, 2018):
This isn't exactly blacklisting, but if you use
whitelist ${DOWNLOADS}(along with other folders that firefox needs to function), any files and folders not explicitly whitelisted will not show up in the sandbox and any files saved anywhere else will be deleted when you close the browser. In fact, that's the way I normally operate my browser these days - the only permanent folder is~/Downloadsand the profile folder (which sometimes isn't even permanent - I have a script which sets up temporary profiles, for example).@Iggy-J commented on GitHub (Oct 8, 2018):
Ok, let's go further. I use ordinary Firefox profile with some extra lines.
As you can see, I use a private directory
workfor Firefox, and blacklist rules for~/Desktopetc. But it does not work as you say. I can still see the directory~/Desktop, but can't write to it. Files saved to home directory next to~/Desktopare not deleted after I close the browser. If I commentprivate ${HOME}/workthan everything is as you say - files are deleted, and I can see only~/Downloads, which is permanent. Is that ok or not?After all, is there a way to make the rest of the
/homedirectory write-protected? I mean protected at the very moment of downloading files, not just discarding changes to file system after browser is closed. And sorry for my English :) Thanks for your answer!I use Firejail version 0.9.52
@chiraag-nataraj commented on GitHub (Oct 8, 2018):
Right, because that's how
blacklistworks. It blocks access to the directory, but the directory still exists.blacklistis redundant when you have awhitelist, since awhitelistmakes only those files and directories available (so it's much stronger than ablacklist). What is the purpose of the private directory forfirefox?Personally, I see it this way. Don't use
privateand don't useblacklist. Usewhitelistto control exactly which files and directories are available in the sandbox. The only issue here is if you want to discard modifications to thefirefoxprofile at the end, in which case you may be interested in my wrapper script (firefox.common) to create a temporary firefox profile (and delete it at the end).@Vincent43 commented on GitHub (Oct 8, 2018):
I think this is duplicate of https://github.com/netblue30/firejail/issues/1743 .
whitelistandprivatearen't compatible.@chiraag-nataraj commented on GitHub (Oct 8, 2018):
@Vincent43 You're right, this is a duplicate of the issue you mentioned. I guess I also basically duplicated my answer 😂
@Iggy-J commented on GitHub (Oct 9, 2018):
Aha, now I understand, thanks a lot! You are right, the
whitelistfits best of all.I've made a little experiment and found out, that I can add
read-only ${HOME}and add lines such asread-write ${HOME}/.mozillafor each directory Firefox needs write access to. In fact I added each path withwhitelistandnoblacklistcommands from the original profile for a quick try. Looks a bit strange, but now when I download a file I can't save it to thehomedirectory, as I wanted. Success! But the whole construction looks redundant, and using onlywhitelistingis the best idea.Now there is no purpose of a private directory for Firefox, and thanks for your wrapper script! I'll read out and try it