[GH-ISSUE #2505] new *-common includes #1631

Closed
opened 2026-05-05 08:16:58 -06:00 by gitea-mirror · 14 comments
Owner

Originally created by @smitsohu on GitHub (Mar 2, 2019).
Original GitHub issue: https://github.com/netblue30/firejail/issues/2505

How about two more includes, one collecting various noexec directives in one place, and the other collecting some common whitelisting in /run/user/$UID?

A noexec-common.inc (or whatever the name) could for example look like

noexec ${HOME}
noexec ${RUNUSER}
noexec /dev/shm
noexec /tmp
noexec /var

(adapted from a suggestion of @Vincent43) and go to all profiles that have an apparmor option currently. As this duplicates apparmor restrictions, there is obviously only limited value for people who run firejail with apparmor enabled. But for everyone else it could be an important addition.

A simple whitelist-run-common.inc (or whatever the name)

whitelist ${RUNUSER}/bus
whitelist ${RUNUSER}/pulse

should be sufficient for most of the programs. Some profiles (those with writable-run-user option) will need an extra line whitelist ${RUNUSER}/gnupg.

Btw, what usually doesn't work is whitelist ${RUNUSER}/gvfs, because of the broken Firejail - FUSE interaction.

Originally created by @smitsohu on GitHub (Mar 2, 2019). Original GitHub issue: https://github.com/netblue30/firejail/issues/2505 How about two more includes, one collecting various noexec directives in one place, and the other collecting some common whitelisting in /run/user/$UID? A noexec-common.inc (or whatever the name) could for example look like ``` noexec ${HOME} noexec ${RUNUSER} noexec /dev/shm noexec /tmp noexec /var ``` (adapted from a suggestion of @Vincent43) and go to all profiles that have an `apparmor` option currently. As this duplicates apparmor restrictions, there is obviously only limited value for people who run firejail with apparmor enabled. But for everyone else it could be an important addition. A simple whitelist-run-common.inc (or whatever the name) ``` whitelist ${RUNUSER}/bus whitelist ${RUNUSER}/pulse ``` should be sufficient for most of the programs. Some profiles (those with `writable-run-user` option) will need an extra line `whitelist ${RUNUSER}/gnupg`. Btw, what usually doesn't work is `whitelist ${RUNUSER}/gvfs`, because of the broken Firejail - FUSE interaction.
gitea-mirror 2026-05-05 08:16:58 -06:00
Author
Owner

@Vincent43 commented on GitHub (Mar 3, 2019):

I wonder if we could sneak-in those in disable-common.inc and whitelist-common.inc.

<!-- gh-comment-id:469012332 --> @Vincent43 commented on GitHub (Mar 3, 2019): I wonder if we could sneak-in those in `disable-common.inc` and `whitelist-common.inc`.
Author
Owner

@smitsohu commented on GitHub (Mar 6, 2019):

I wonder if we could sneak-in those in disable-common.inc and whitelist-common.inc.

Good question. noexec ${HOME} and noexec /dev/shm can be problematic, I was a bit worried about breaking many profiles.

Regarding the whitelisting in /run/user, I currently cannot really overlook the consequences of removing the gvfs mount point. From what I'm reading, Gnome media players or image managers might run into issues.

<!-- gh-comment-id:470193443 --> @smitsohu commented on GitHub (Mar 6, 2019): > I wonder if we could sneak-in those in disable-common.inc and whitelist-common.inc. Good question. `noexec ${HOME}` and `noexec /dev/shm` can be problematic, I was a bit worried about breaking many profiles. Regarding the whitelisting in /run/user, I currently cannot really overlook the consequences of removing the gvfs mount point. From what I'm reading, Gnome media players or image managers might run into issues.
Author
Owner

@Vincent43 commented on GitHub (Mar 6, 2019):

Ok. Let's introduce noexec-common.inc then and use it to replace noexec rules in app profiles gradually.

<!-- gh-comment-id:470318808 --> @Vincent43 commented on GitHub (Mar 6, 2019): Ok. Let's introduce `noexec-common.inc` then and use it to replace `noexec` rules in app profiles gradually.
Author
Owner

@smitsohu commented on GitHub (Mar 11, 2019):

Or maybe disable-exec.inc? We can call it from anywhere in the profile, so it could go to the disable-* block as well.

<!-- gh-comment-id:471378263 --> @smitsohu commented on GitHub (Mar 11, 2019): Or maybe `disable-exec.inc`? We can call it from anywhere in the profile, so it could go to the disable-* block as well.
Author
Owner

@Vincent43 commented on GitHub (Mar 11, 2019):

Yes, it may fit better.

<!-- gh-comment-id:471473925 --> @Vincent43 commented on GitHub (Mar 11, 2019): Yes, it may fit better.
Author
Owner

@Boruch-Baum commented on GitHub (Mar 19, 2019):

Is it possible to have a sort-of whitelist command as an exception to noexec? For example, here I have a solution for applying cpulimits to firejails, but it only works in that case because the default profile for firefox has the noexec line commented out; when the noexec line is active, the script in ~/.local/bin can't be executed, even though it initiated the call to firejail!

I'm sure there will be other examples of a limited number of executables of interest in $HOME for a particular program, and that shouldn't be a deal-breaker for losing the noexec feature for the rest of $HOME. Maybe one example would be mutt, which calls in a strange mix of plug-ins and scripts, including indirectly calling scripts in one's $HOME. Also, the less browser has options for lesspipe and highlighting that call in scripts local to $HOME, so any program that calls the less browser will lose that functionality if noexec $HOME is enabled.

<!-- gh-comment-id:474522018 --> @Boruch-Baum commented on GitHub (Mar 19, 2019): Is it possible to have a sort-of `whitelist` command as an exception to `noexec`? For example, [here](https://github.com/netblue30/firejail/issues/2324#issuecomment-474517220) I have a solution for applying cpulimits to firejails, but it only works in that case because the default profile for firefox has the noexec line commented out; when the noexec line is active, the script in `~/.local/bin` can't be executed, even though it initiated the call to firejail! I'm sure there will be other examples of a limited number of executables of interest in `$HOME` for a particular program, and that shouldn't be a deal-breaker for losing the `noexec` feature for the rest of `$HOME`. Maybe one example would be `mutt`, which calls in a strange mix of plug-ins and scripts, including indirectly calling scripts in one's `$HOME`. Also, the `less` browser has options for `lesspipe` and highlighting that call in scripts local to `$HOME`, so any program that calls the `less` browser will lose that functionality if `noexec $HOME` is enabled.
Author
Owner

@Boruch-Baum commented on GitHub (Mar 19, 2019):

Another reason to support the idea of some sort of over-ride to noexec is so that a local unprivileged user can put it in their personal ~/.config/firejail profile without having to edit anything in /etc/firejail. Also, let's say someone does perform the edit, ie. comments out a noexec line in /etc/firejail, won't the edit be over-written on the next package update? There would need to be some command suitable for /etc/firejail/foo.local in that case, which would have to be an over-ride.

<!-- gh-comment-id:474526807 --> @Boruch-Baum commented on GitHub (Mar 19, 2019): Another reason to support the idea of some sort of over-ride to `noexec` is so that a local unprivileged user can put it in their personal `~/.config/firejail` profile without having to edit anything in `/etc/firejail`. Also, let's say someone does perform the edit, ie. comments out a `noexec` line in `/etc/firejail`, won't the edit be over-written on the next package update? There would need to be some command suitable for `/etc/firejail/foo.local` in that case, which would have to be an over-ride.
Author
Owner

@Boruch-Baum commented on GitHub (Mar 19, 2019):

Maybe a way to implement my feature-request would be a tweak to private-bin which seems to create and mount a virtual /bin to allow full path-names to over-ride the virtual remount performed by noexec? I'm not familiar with the firejail internals so that's just an idea.

<!-- gh-comment-id:474548983 --> @Boruch-Baum commented on GitHub (Mar 19, 2019): Maybe a way to implement my feature-request would be a tweak to `private-bin` which seems to create and mount a virtual `/bin` to allow full path-names to over-ride the virtual remount performed by `noexec`? I'm not familiar with the firejail internals so that's just an idea.
Author
Owner

@ghost commented on GitHub (Mar 19, 2019):

Is it possible to have a sort-of whitelist command as an exception to noexec?

Maybe you're looking for the ignore option, which is also still supported in the implementation of disable-exec.inc. For example, let's suppose /etc/firejail/foo.profile has the noexec ${HOME} option (either in the 'old' form or via the newly introduced 'include disable-exec.inc' syntax). If a user puts something like ignore noexec ${HOME} in ~/.config/firejail/foo.local, that will always have precedence and already does what (I think) you describe. But if you mean a more granular exception (use noexec ${HOME} but ignore it for ~/.local/bin/foo only), I don't think that's possible (yet).

Also, let's say someone does perform the edit, ie. comments out a noexec line in /etc/firejail, won't the edit be over-written on the next package update?

Exactly, which is why all of the .profile files in /etc/firejail have comments inside to inform the (reading) user:

...
# This file is overwritten after every install/update
# Persistent local customizations
include foo.local
# Persistent global definitions
include globals.local
...

Is this what you're refering to by feature-request?

<!-- gh-comment-id:474552765 --> @ghost commented on GitHub (Mar 19, 2019): > Is it possible to have a sort-of whitelist command as an exception to noexec? Maybe you're looking for the `ignore` option, which is also still supported in the implementation of disable-exec.inc. For example, let's suppose /etc/firejail/foo.profile has the `noexec ${HOME}` option (either in the 'old' form or via the newly introduced 'include disable-exec.inc' syntax). If a user puts something like `ignore noexec ${HOME}` in ~/.config/firejail/foo.local, that will always have precedence and already does what (I think) you describe. But if you mean a more granular exception (use noexec ${HOME} but ignore it for ~/.local/bin/foo only), I don't think that's possible (yet). > Also, let's say someone does perform the edit, ie. comments out a noexec line in /etc/firejail, won't the edit be over-written on the next package update? Exactly, which is why all of the .profile files in /etc/firejail have comments inside to inform the (reading) user: ``` ... # This file is overwritten after every install/update # Persistent local customizations include foo.local # Persistent global definitions include globals.local ... ``` Is this what you're refering to by feature-request?
Author
Owner

@Boruch-Baum commented on GitHub (Mar 19, 2019):

But if you mean a more granular exception (use noexec ${HOME} but ignore it for ~/.local/bin/foo only), I don't think that's possible (yet).
...
Is this what you're refering to by feature-request?

@glitsj16 : Yes, a more granular could allow users to do things like have personal wrapper scripts to launch firejail (see above my example for launching firefox with cpulimit), and have executables tie into personal plug-ins, (see above my example re: lessfilter, lesspipe, and it just occurred to me that midnight commander would also benefit).

Thanks for the advice about the ignore command, which I had missed.

<!-- gh-comment-id:474557310 --> @Boruch-Baum commented on GitHub (Mar 19, 2019): >But if you mean a more granular exception (use noexec ${HOME} but ignore it for ~/.local/bin/foo only), I don't think that's possible (yet). >... > Is this what you're refering to by feature-request? @glitsj16 : Yes, a more granular could allow users to do things like have personal wrapper scripts to launch firejail (see above my example for launching firefox with cpulimit), and have executables tie into personal plug-ins, (see above my example re: lessfilter, lesspipe, and it just occurred to me that midnight commander would also benefit). Thanks for the advice about the `ignore` command, which I had missed.
Author
Owner

@rusty-snake commented on GitHub (May 1, 2019):

I would suggest whitelist-usr-share-common.inc

<!-- gh-comment-id:488231186 --> @rusty-snake commented on GitHub (May 1, 2019): I would suggest `whitelist-usr-share-common.inc`
Author
Owner

@rusty-snake commented on GitHub (Jan 18, 2020):

disable-obsolete.inc for obsolete (EOL/EOS) software.(#3164)

<!-- gh-comment-id:575891615 --> @rusty-snake commented on GitHub (Jan 18, 2020): `disable-obsolete.inc` for obsolete (EOL/EOS) software.(#3164)
Author
Owner

@rusty-snake commented on GitHub (Apr 1, 2020):

Should we close here?

<!-- gh-comment-id:607285679 --> @rusty-snake commented on GitHub (Apr 1, 2020): Should we close here?
Author
Owner

@smitsohu commented on GitHub (Apr 2, 2020):

Let's close.

<!-- gh-comment-id:607867071 --> @smitsohu commented on GitHub (Apr 2, 2020): Let's close.
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#1631
No description provided.