mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1569] Why do we have blacklist, noblacklist, and whitelist in the same profile? #1043
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#1043
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 @Fred-Barclay on GitHub (Sep 21, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1569
Is there a particular reason or historical significance for including disable-programs.inc, then noblacklisting the files we need, and then whitelisting those files?
Take the firefox profile for instance. We blacklist quite a few files in ${HOME} with
include /etc/firejail/disable-programs.inc, and then noblacklist the ones we need:We then whitelist these files:
Instead of having to blacklist so many files, then noblacklist the ones we need, and then whitelist the those files, why not just keep the whitelist filter and do away with including disable-programs.inc and the noblacklist filter? Since whitelist effectively blacklists all files except the ones it's given, this would have the same effect as what we're already doing but greatly reduce the complexity of many profiles.
Thoughts? Am I missing something?
(Credits to this poster for pointing this out.)
@SkewedZeppelin commented on GitHub (Sep 21, 2017):
If a user wants to let a program access files in another directory and they decide to disable the whitelist in a local copy, the profile will still be restricted from reading the contents of other programs (which is good!). If blacklist wasn't included and they disabled whitelist, it'd have (near) full access to their home directory (which is very bad!).
At least that is why I always do both. Even when I create a profile with
privateenabled I'll still try to do both blacklist and whitelist.Also in response to
Some profiles will simply never ever be whitelisted. If you whitelisted your photo viewer then you would only ever be able to view pictures in ~/Photos, what about everywhere else on your system? Same for a music player, yes some people might have music in ~/Music, but others might have an entire drive for music (or three!) or even a nas.
So please anyone reading this, don't make a PR removing blacklist from all the whitelisted profiles.
@Fred-Barclay commented on GitHub (Sep 22, 2017):
Good point. I already responded much to the same effect. Whitelisting is really good when we only need to access a (relatively) static portion of the filesystem. It's less than useful for other cases.
I like your perspective! I hadn't thought about a user taking the profile and disabling whitelists - definitely the blacklist provides a fail-safe and keeps files that really should be secret, secret. The question now is if it's worth the extra complexity to protect against this edge case. I'm tending to think that it is.
@SkewedZeppelin commented on GitHub (Sep 22, 2017):
I think it is, but that doesn't mean we can't simplify it. Since the files that are whitelisted are usually noblacklisted adding a
whitelist-noblacklistedwould remove the redundancy of having both noblacklist and whitelist for a file/folder.Example here
The gain isn't much, distribution wise text compresses extremely well, and as for installed disk space an extra 20kb savings isn't much benefit. I guess it could somewhat help with manageability of the profile however.
@Fred-Barclay commented on GitHub (Sep 22, 2017):
It might not save too much space but that's a really cool idea! It would also reduce the chance of typos when whitelisting a profile.
@SkewedZeppelin commented on GitHub (Sep 22, 2017):
I think I've done it now, see
b0ccd3ffd3. Its dependent on12fb6c82c7.@Fred-Barclay commented on GitHub (Sep 22, 2017):
@SpotComms Looks really good. That being said, I think it might be more logical to place
whitelist-noblacklistright after themkdircommands and just before anywhitelistcommands, just to keep all the whitelist operations in the same place in the profile. What do you think?@SkewedZeppelin commented on GitHub (Sep 22, 2017):
@Fred-Barclay
ifwhitelist-noblacklistwasn't placed where it was, it'd whitelist everything blacklisted by all of theinclude /etc/firejail/disable-*.inc's. Placing it anywhere else would make the code side of this much harder to implement.Edit: I'm bad, I think we can move it to be with the rest.
@Fred-Barclay commented on GitHub (Sep 22, 2017):
Would it? I was assuming that wnb would only whitelist files explicitly noblacklisted in the profile. Including blacklists shouldn't change this.
@SkewedZeppelin commented on GitHub (Sep 22, 2017):
It wouldn't, here it is fixed
07e52cff9a@Fred-Barclay commented on GitHub (Sep 22, 2017):
I like it! Is wnb psuedo-code or do we have a working implementation?
@smitsohu commented on GitHub (Sep 22, 2017):
Hi all! Shouldn't it be easy to simply interpret
whitelistalso asnoblacklist? I think this has been proposed already elsewhere, but I can't find it right now.@SkewedZeppelin commented on GitHub (Sep 22, 2017):
@Fred-Barclay We'll need someone to implement it. Just store the noblacklist paths in an array temporarily and if whitelist-noblacklist is detected to loop through the array and whitelist them.
@smitsohu that would be a different approach, but then disable-*.inc would have to be after whitelist. And again keeping the ability to disable whitelist and still have stuff blacklisted is a goal.
Edit: see the latest version here
@smitsohu commented on GitHub (Sep 22, 2017):
@SpotComms Blacklisting files in whitelisted folders would be still possible. And even though the whitelist block could move in front of disable-*.inc and replace noblacklist there, we would keep our backwards compatibility.
The downside is indeed, that if someone decided to remove whitelisting from a profile, the fallback level would not be a safe and working blacklisted profile, as with your proposal, but a safe and broken one (this is what you meant in your previous post, right?). The "profile-ergonomics" would be worse in such a case.
@SkewedZeppelin commented on GitHub (Sep 22, 2017):
@smitsohu I'm a bit confused reading that, especially the last part.
Ignoring everything:
noblacklistanddisable-programs.incfrom all profiles withwhitelist(eg.c307fd7691)whitelistin a local copy of a profilewhitelist-noblacklistedwhitelist-noblacklistedoption simply whitelists everything that was noblacklistedc04dbefdccwhitelistperform whatnoblacklistdoes would be bad for the same reason as 2, and would also require movingwhitelistbefore all of thedisable-*.inc'sAssuming I'm not overlooking anything there:
Which proposal breaks backwards compatibility?
?
In which case?
@smitsohu commented on GitHub (Sep 22, 2017):
@SpotComms sorry for being confusing (night was short). Let me try to shed some light:
to 7: No, it is neutral from a security perspective, because disable-programs.inc can be left in place. It just takes away some command atomicity (instead of noblacklist-blacklist-whitelist, it is enough to have whitelist-blacklist).... and I don't see the use case for explicitly whitelisting a blacklisted path. Note that everything else with regard to blacklisting and whitelisting is still possible.
Backwards compatibility with profiles is kept, because if the whitelist block is not moved in front of disable-*.inc, a condition
noblacklist OR whitelistfalls back to the old behaviour.Disabling the whitelisting inside a profile altogether would make it necessary to rename whitelist to noblacklist. This is less ergonomic (and intuitive) than just commenting an option, and insofar your proposal is better.
I hope it is a little clearer now.
@ghost commented on GitHub (Sep 24, 2017):
Two questions:
Does the new approach means that using
noblacklist ~/fooin profile would be equivalent ofwhitelist ~/foo? Usingwhitelistoption in profile means that you have to do it for all needed files. What if we want to exclude only one specific file from blacklist without using whitelist approach?As whitelists works per top directory does using
noblacklist /var/foowould mean that all/vardirectory is in whitelist mode (see above)BTW: why this?
5370f65d77@smitsohu commented on GitHub (Sep 24, 2017):
@VladimirSchowalter20 No, everything would stay the same as it is now. Except that if you put whitelist in front of blacklist, you can skip the noblacklist step.
Whitelist would imply noblacklist, not the other way round, as you put it in your comment.
But again, the proposal has its drawbacks, another one being that currently noblacklist is often only a subset of whitelist. This means that if we rewrite profiles accordingly, to some degree the transparency is lost which paths are actually blacklisted in disable-*.inc, and which paths are whitelisted only. After thinking it over, I guess I also tend to a new option instead.
@SkewedZeppelin commented on GitHub (Sep 24, 2017):
@VladimirSchowalter20
No. If a profile has
noblacklist ~/fooand you want to make it whitelist instead of addingwhitelist ~/fooyou can simply addwhitelist-noblacklist, meaning if you have 5 noblacklists instead of whitelisting each of them you can just addwhitelist-noblacklist. It doesn't change any functionality of blacklist or whitelist, it would just make it easier to maintain the profile.And
5370f65d77was necessary for the script I made to createc04dbefdcc@smitsohu my proposal wouldn't change anything about placement or about skipping noblacklist.
All my proposal does is remove the redundancy of whitelisting a path when it is already noblacklisted by specifying an option
whitelist-noblacklisted. No more, no less.@ghost commented on GitHub (Sep 24, 2017):
@smitsohu @SpotComms Thx for explanations!
@netblue30 commented on GitHub (Sep 25, 2017):
The idea is simple: first, we build the whitelisted filesystem, then we blacklist top secret files on the whitelisted filesystem. The order they appear in the profile is important only for "noblacklist". "whitelist" will always be done before "blacklist".
For example if you have a KDE application, you whitelist ~/.kde directory, than you blacklist ~/.kde/share/apps/kwallet.
@Fred-Barclay commented on GitHub (Sep 28, 2017):
Thanks everyone! I think we can close this now.
@SpotComms I think whitelist-noblacklist would be awesome!