[GH-ISSUE #2039] [enhancement] Allow more fine-grained ignore predicates #1377

Closed
opened 2026-05-05 07:58:43 -06:00 by gitea-mirror · 8 comments
Owner

Originally created by @chiraag-nataraj on GitHub (Jul 14, 2018).
Original GitHub issue: https://github.com/netblue30/firejail/issues/2039

So right now, the way ignore works is that you use ignore <predicate> and it ignores all predicates of that type. I'm wondering if we can fine-tune this a bit to select which specific instance of the predicate to ignore. As an example, in my profiles, I have a common.inc which does most of the common stuff. But occasionally, I need to ignore one or two predicates (otherwise the program will break). Two predicates I have in this file are noexec ${HOME} and noexec /tmp. I want to ignore noexec /tmp while preserving noexec ${HOME}. Of course, one way would be to split this up into two different files (or more) to allow more granularity in my imports. But the nice thing about the current system is that I just have one import command which is easy to remember. @netblue30, what would it take to ignore a specific instance of a predicate instead of every instance?

Originally created by @chiraag-nataraj on GitHub (Jul 14, 2018). Original GitHub issue: https://github.com/netblue30/firejail/issues/2039 So right now, the way ignore works is that you use `ignore <predicate>` and it ignores all predicates of that type. I'm wondering if we can fine-tune this a bit to select which specific instance of the predicate to ignore. As an example, in my profiles, I have a `common.inc` which does most of the common stuff. But occasionally, I need to ignore one or two predicates (otherwise the program will break). Two predicates I have in this file are `noexec ${HOME}` and `noexec /tmp`. I want to ignore `noexec /tmp` while preserving `noexec ${HOME}`. Of course, one way would be to split this up into two different files (or more) to allow more granularity in my imports. But the nice thing about the current system is that I just have one import command which is easy to remember. @netblue30, what would it take to ignore a specific instance of a predicate instead of every instance?
gitea-mirror 2026-05-05 07:58:43 -06:00
Author
Owner

@netblue30 commented on GitHub (Jul 15, 2018):

I kind of run into this problem all the time with the networking commands when I move profiles from one computer to another. The code for ignore is in profile.c. It is something very simple in this moment, if you have an idea we can expand it.

<!-- gh-comment-id:405116764 --> @netblue30 commented on GitHub (Jul 15, 2018): I kind of run into this problem all the time with the networking commands when I move profiles from one computer to another. The code for ignore is in profile.c. It is something very simple in this moment, if you have an idea we can expand it.
Author
Owner

@chiraag-nataraj commented on GitHub (Jul 15, 2018):

@netblue30 How about matching the full line rather than just the predicate itself? That way, you can select specific instances of the predicate to ignore. If only the predicate is given, all instances are ignored (as is the current behavior).

<!-- gh-comment-id:405123610 --> @chiraag-nataraj commented on GitHub (Jul 15, 2018): @netblue30 How about matching the full line rather than just the predicate itself? That way, you can select specific instances of the predicate to ignore. If only the predicate is given, all instances are ignored (as is the current behavior).
Author
Owner

@netblue30 commented on GitHub (Jul 17, 2018):

What if we add another option, --ignore-match? We can add it on top of the regular ignore code, and if we need we can always add more similar options.

<!-- gh-comment-id:405557041 --> @netblue30 commented on GitHub (Jul 17, 2018): What if we add another option, --ignore-match? We can add it on top of the regular ignore code, and if we need we can always add more similar options.
Author
Owner

@chiraag-nataraj commented on GitHub (Jul 21, 2018):

That seems like an okay idea. Personally, I don't see why we can't change the behavior of the current ignore predicate, but if this seems like a better idea to you, let's go with it :)

<!-- gh-comment-id:406819549 --> @chiraag-nataraj commented on GitHub (Jul 21, 2018): That seems like an okay idea. Personally, I don't see why we can't change the behavior of the current ignore predicate, but if this seems like a better idea to you, let's go with it :)
Author
Owner

@startx2017 commented on GitHub (Jul 26, 2018):

I'll take over and implement it, unless you guys have already something going.

<!-- gh-comment-id:408109030 --> @startx2017 commented on GitHub (Jul 26, 2018): I'll take over and implement it, unless you guys have already something going.
Author
Owner

@startx2017 commented on GitHub (Aug 3, 2018):

Funny, the current code already allows ignoring full profile lines. Example:

firejail --ignore="net eth0" program
firejail --ignore="blacklist /dev/null" program

In profile file use

ignore net eth0
ignore blacklist /dev/null

I'll modify man pages.

<!-- gh-comment-id:410318416 --> @startx2017 commented on GitHub (Aug 3, 2018): Funny, the current code already allows ignoring full profile lines. Example: ````` firejail --ignore="net eth0" program firejail --ignore="blacklist /dev/null" program ````` In profile file use ````` ignore net eth0 ignore blacklist /dev/null ````` I'll modify man pages.
Author
Owner

@chiraag-nataraj commented on GitHub (Aug 6, 2018):

@startx2017 Oh man...let me try this now.

<!-- gh-comment-id:410695702 --> @chiraag-nataraj commented on GitHub (Aug 6, 2018): @startx2017 Oh man...let me try this now.
Author
Owner

@chiraag-nataraj commented on GitHub (Aug 6, 2018):

Oh man, it does work! Awesome.

<!-- gh-comment-id:410696102 --> @chiraag-nataraj commented on GitHub (Aug 6, 2018): Oh man, it _does_ work! Awesome.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#1377
No description provided.