Replies: 6 comments 3 replies
-
Have you tried using |
Beta Was this translation helpful? Give feedback.
-
Without knowing how your $ cat ~/.config/firejail/myapp.profile# Firejail profile for https://github.com/netblue30/firejail/discussions/6005
# This file is overwritten after every install/update
quiet
# Persistent local customizations
include myapp.local
# Persistent global definitions
include globals.local
blacklist ${RUNUSER}
blacklist /usr/libexec
# blacklisting example
blacklist ${HOME}/this.is.blacklisted
ignore noexec ${HOME}
# Allow java (blacklisted by disable-devel.inc)
include allow-java.inc
include disable-common.inc
include disable-devel.inc
include disable-exec.inc
include disable-interpreters.inc
include disable-proc.inc
include disable-programs.inc
include disable-shell.inc
include disable-xdg.inc
# whitelisting <cwd> via (scripted) CLI flag
#include whitelist-common.inc
#include whitelist-run-common.inc
#include whitelist-runuser-common.inc
#include whitelist-usr-share-common.inc
#include whitelist-var-common.inc
apparmor
caps.drop all
hostname myapp
ipc-namespace
machine-id
net none
no3d
nodvd
nogroups
noinput
nonewprivs
noroot
noprinters
nosound
notv
nou2f
novideo
protocol unix
seccomp
seccomp.block-secondary
tracelog
x11 none
disable-mnt
# private <cwd> via (scripted) CLI flag
private-bin java,myapp
private-cache
private-dev
private-etc
private-opt none
private-tmp
dbus-user none
dbus-system none
deterministic-exit-code
memory-deny-write-execute
#read-only ${HOME}
#read-write ${HOME}
restrict-namespaces
# sandbox name (for easy file transfer, shutting down the sandbox,...)
myapp
With that in place you can try the below from CLI $ firejail --output-stderr=logfile --private=. --whitelist=${PWD} -- myapp --nogui --nosplash |
Beta Was this translation helpful? Give feedback.
-
Hello, I gave it another try today. I kept having the same results.
I will keep trying and reading the manual, Any hints will be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
-
Firstly, what are the distribution version and firejail version?
Note that:
Is "myapp" in Does it work if you put it in Example: firejail --private="$PWD" ./myapp --nogui --nosplash Do the following commands output any errors? firejail --noprofile --private="$PWD" which -a myapp
firejail --noprofile --private="$PWD" ls $(which -a myapp) |
Beta Was this translation helpful? Give feedback.
-
Hi and thank you for your reply, I am using firejail version 0.9.72 on Centos Stream 8. Thank you for clarifying the use of --private. I use --private=. because I want myapp to create files and folders only on $PWD and keep them after the process ends. I tried --private in desperation. Yes, myapp is located in ~/myapp_repo/bin/myapp. This path is included in the $PATH. Here are the results of the commands you wrote:
We can conclude that, inside the sandbox, myapp does not exist. I continued doing some testing. I did:
So, inside the sandbox myapp exists but it starts looking for other configuration folders and files in ~/myapp_repo and it fails to start. Therefore I did:
Wow, I am feeling lost. Probably I should try --private-bin? |
Beta Was this translation helpful? Give feedback.
-
Hi, I thought that creating a firejail profile for myapp could solve the problem. It didn't work. What I did:
That was it. Now I can run myapp in firejail issuing:
About the noprofile flag. I did try to create a profile using the Thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I want to run a java application contained in Firejail. I didn't write the java application and I want to make sure the application only has access to the directory from which it is launched. What I did is:
Myapp is installed in ~/myapp_project/bin/myapp
The directory is on the path env variable, so I can call myapp easily.
I created the firejail profile file by doing
Then I try to use the profile file when calling myapp and use the private argument to define the current directory as the home of the sand box.
Unfortunately I get Error: no suitable myapp executable found
If I remove the private argument everything works fine. I opened myapp.profile and I checked for the whitelists folders which I believe are the necessary folders to find and execute myapp inside the sand box.
I also tried adding the following lines in the profile file.
ignore apparmor
ignore noexec ${HOME}
Being a little frustrated I didn't check in depth how this parameters change the sandbox environment.
Can you please help me with this issue? I a nutshell, I want to execute myapp and allow write access only to the current directory.
Beta Was this translation helpful? Give feedback.
All reactions