[GH-ISSUE #2065] Freedesktop dirs whitelisting works from profile but not command line #1394

Closed
opened 2026-05-05 08:03:04 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @Fred-Barclay on GitHub (Jul 25, 2018).
Original GitHub issue: https://github.com/netblue30/firejail/issues/2065

I'm seeing some interesting behavior when combining whitelist and ${DOCUMENTS}, ${DOWNLOADS}, and so on:

  1. Expected behavior:
$ firejail --whitelist=~/Documents
Reading profile /etc/firejail/default.profile
Reading profile /etc/firejail/globals.local
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-passwdmgr.inc
Reading profile /etc/firejail/disable-programs.inc

** Note: you can use --noprofile to disable default.profile **

Parent pid 29290, child pid 29291
Warning: cleaning all supplementary groups
Warning: cleaning all supplementary groups
Warning: cleaning all supplementary groups
Warning: /sbin directory link was not blacklisted
Warning: /usr/sbin directory link was not blacklisted
Warning: cleaning all supplementary groups
Warning: cleaning all supplementary groups
Warning: cleaning all supplementary groups
Child process initialized in 59.53 ms
$ ls
Documents
$ ls Documents
<lots>      <of>      <files>

Using ${DOCUMENTS} exits immediately:

$ firejail --whitelist=${DOCUMENTS}
Reading profile /etc/firejail/default.profile
Reading profile /etc/firejail/globals.local
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-passwdmgr.inc
Reading profile /etc/firejail/disable-programs.inc

** Note: you can use --noprofile to disable default.profile **

Parent pid 29404, child pid 29405
Error: invalid whitelist path 
Error: proc 29404 cannot sync with peer: unexpected EOF
Peer 29405 unexpectedly exited with status 1

And specifying a subdirectory seems to fail to whitelist anything:

$ firejail --whitelist=${DOCUMENTS}/Platypus
Reading profile /etc/firejail/default.profile
Reading profile /etc/firejail/globals.local
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-passwdmgr.inc
Reading profile /etc/firejail/disable-programs.inc

** Note: you can use --noprofile to disable default.profile **

Parent pid 29415, child pid 29416
Warning: /sbin directory link was not blacklisted
Warning: /usr/sbin directory link was not blacklisted
Warning: cleaning all supplementary groups
Child process initialized in 41.99 ms
[fred@TheUpsideDown ~]$ ls Documents
<lots>      <of>      <files>

But using a profile with only whitelist ${DOCUMENTS} works:

$ firejail --profile=/home/fred/Desktop/test.profile
Reading profile /home/fred/Desktop/test.profile
Parent pid 29819, child pid 29820
Child process initialized in 24.03 ms
$ ls
Documents

There are similar results for ${DOWNLOADS}:

  1. When used in a profile like signal-desktop, whitelist ${DOWNLOADS} works:
$ firejail --ignore=shell --profile=/etc/firejail/signal-desktop.profile
Reading profile /etc/firejail/signal-desktop.profile
Reading profile /etc/firejail/globals.local
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-devel.inc
Reading profile /etc/firejail/disable-interpreters.inc
Reading profile /etc/firejail/disable-programs.inc
Reading profile /etc/firejail/disable-passwdmgr.inc
Reading profile /etc/firejail/whitelist-common.inc
Reading profile /etc/firejail/whitelist-var-common.inc
Parent pid 29611, child pid 29612
Warning: cleaning all supplementary groups
Warning: cleaning all supplementary groups
Warning: cleaning all supplementary groups
Warning: /sbin directory link was not blacklisted
Warning: /usr/sbin directory link was not blacklisted
Warning: cleaning all supplementary groups
Child process initialized in 106.59 ms
$ ls
Downloads
  1. Running from terminal fails:
$ firejail --whitelist=${DOWNLOADS}
Reading profile /etc/firejail/default.profile
Reading profile /etc/firejail/globals.local
Reading profile /etc/firejail/disable-common.inc
Reading profile /etc/firejail/disable-passwdmgr.inc
Reading profile /etc/firejail/disable-programs.inc

** Note: you can use --noprofile to disable default.profile **

Parent pid 29641, child pid 29642
Error: invalid whitelist path 
Error: proc 29641 cannot sync with peer: unexpected EOF
Peer 29642 unexpectedly exited with status 1

It's worth noting that echo ${DOCUMENTS} or ${DOWNLOADS} returns nothing.

So as best I can tell -- and it may just be me doing something wrong -- whitelisting these directories from command line fails, but using a profile works.
I haven't tried blacklists or read-only yet.

Originally created by @Fred-Barclay on GitHub (Jul 25, 2018). Original GitHub issue: https://github.com/netblue30/firejail/issues/2065 I'm seeing some interesting behavior when combining whitelist and ${DOCUMENTS}, ${DOWNLOADS}, and so on: 1. Expected behavior: ``` $ firejail --whitelist=~/Documents Reading profile /etc/firejail/default.profile Reading profile /etc/firejail/globals.local Reading profile /etc/firejail/disable-common.inc Reading profile /etc/firejail/disable-passwdmgr.inc Reading profile /etc/firejail/disable-programs.inc ** Note: you can use --noprofile to disable default.profile ** Parent pid 29290, child pid 29291 Warning: cleaning all supplementary groups Warning: cleaning all supplementary groups Warning: cleaning all supplementary groups Warning: /sbin directory link was not blacklisted Warning: /usr/sbin directory link was not blacklisted Warning: cleaning all supplementary groups Warning: cleaning all supplementary groups Warning: cleaning all supplementary groups Child process initialized in 59.53 ms $ ls Documents $ ls Documents <lots> <of> <files> ``` Using ${DOCUMENTS} exits immediately: ``` $ firejail --whitelist=${DOCUMENTS} Reading profile /etc/firejail/default.profile Reading profile /etc/firejail/globals.local Reading profile /etc/firejail/disable-common.inc Reading profile /etc/firejail/disable-passwdmgr.inc Reading profile /etc/firejail/disable-programs.inc ** Note: you can use --noprofile to disable default.profile ** Parent pid 29404, child pid 29405 Error: invalid whitelist path Error: proc 29404 cannot sync with peer: unexpected EOF Peer 29405 unexpectedly exited with status 1 ``` And specifying a subdirectory seems to fail to whitelist anything: ``` $ firejail --whitelist=${DOCUMENTS}/Platypus Reading profile /etc/firejail/default.profile Reading profile /etc/firejail/globals.local Reading profile /etc/firejail/disable-common.inc Reading profile /etc/firejail/disable-passwdmgr.inc Reading profile /etc/firejail/disable-programs.inc ** Note: you can use --noprofile to disable default.profile ** Parent pid 29415, child pid 29416 Warning: /sbin directory link was not blacklisted Warning: /usr/sbin directory link was not blacklisted Warning: cleaning all supplementary groups Child process initialized in 41.99 ms [fred@TheUpsideDown ~]$ ls Documents <lots> <of> <files> ``` But using a profile with only `whitelist ${DOCUMENTS}` works: ``` $ firejail --profile=/home/fred/Desktop/test.profile Reading profile /home/fred/Desktop/test.profile Parent pid 29819, child pid 29820 Child process initialized in 24.03 ms $ ls Documents ``` There are similar results for ${DOWNLOADS}: 1. When used in a profile like signal-desktop, `whitelist ${DOWNLOADS}` works: ``` $ firejail --ignore=shell --profile=/etc/firejail/signal-desktop.profile Reading profile /etc/firejail/signal-desktop.profile Reading profile /etc/firejail/globals.local Reading profile /etc/firejail/disable-common.inc Reading profile /etc/firejail/disable-devel.inc Reading profile /etc/firejail/disable-interpreters.inc Reading profile /etc/firejail/disable-programs.inc Reading profile /etc/firejail/disable-passwdmgr.inc Reading profile /etc/firejail/whitelist-common.inc Reading profile /etc/firejail/whitelist-var-common.inc Parent pid 29611, child pid 29612 Warning: cleaning all supplementary groups Warning: cleaning all supplementary groups Warning: cleaning all supplementary groups Warning: /sbin directory link was not blacklisted Warning: /usr/sbin directory link was not blacklisted Warning: cleaning all supplementary groups Child process initialized in 106.59 ms $ ls Downloads ``` 2. Running from terminal fails: ``` $ firejail --whitelist=${DOWNLOADS} Reading profile /etc/firejail/default.profile Reading profile /etc/firejail/globals.local Reading profile /etc/firejail/disable-common.inc Reading profile /etc/firejail/disable-passwdmgr.inc Reading profile /etc/firejail/disable-programs.inc ** Note: you can use --noprofile to disable default.profile ** Parent pid 29641, child pid 29642 Error: invalid whitelist path Error: proc 29641 cannot sync with peer: unexpected EOF Peer 29642 unexpectedly exited with status 1 ``` It's worth noting that `echo ${DOCUMENTS}` or ${DOWNLOADS} returns nothing. So as best I can tell -- and it may just be me doing something wrong -- whitelisting these directories from command line fails, but using a profile works. I haven't tried blacklists or read-only yet.
gitea-mirror 2026-05-05 08:03:04 -06:00
Author
Owner

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

Try quoting the variable: firejail --whitelist='${DOCUMENTS}'. Most likely there's shell-expansion happening, which means firejail never receives the actual variable but instead whatever the shell expanded it to.

<!-- gh-comment-id:407628741 --> @chiraag-nataraj commented on GitHub (Jul 25, 2018): Try quoting the variable: `firejail --whitelist='${DOCUMENTS}'`. Most likely there's shell-expansion happening, which means `firejail` never receives the actual variable but instead whatever the shell expanded it to.
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#1394
No description provided.