summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--RELNOTES1
-rw-r--r--src/firejail/main.c21
-rw-r--r--src/man/firejail.txt7
-rwxr-xr-xtest/firejail-in-firejail.exp2
-rwxr-xr-xtest/firejail-in-firejail2.exp21
-rwxr-xr-xtest/test.sh5
6 files changed, 51 insertions, 6 deletions
diff --git a/RELNOTES b/RELNOTES
index 655f3309e..b82231aca 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -9,6 +9,7 @@ firejail (0.9.36-rc1) baseline; urgency=low
9 * added opera-beta profile 9 * added opera-beta profile
10 * added --noblacklist option 10 * added --noblacklist option
11 * added --profile-path option 11 * added --profile-path option
12 * added --force option
12 * whitelist command enhancements 13 * whitelist command enhancements
13 * prevent user name enumeration 14 * prevent user name enumeration
14 * added /etc/firejail/nolocal.net network filter 15 * added /etc/firejail/nolocal.net network filter
diff --git a/src/firejail/main.c b/src/firejail/main.c
index a9ccfc9cc..3a06ec0f1 100644
--- a/src/firejail/main.c
+++ b/src/firejail/main.c
@@ -425,10 +425,21 @@ int main(int argc, char **argv) {
425 // check if we already have a sandbox running 425 // check if we already have a sandbox running
426 int rv = check_kernel_procs(); 426 int rv = check_kernel_procs();
427 if (rv == 0) { 427 if (rv == 0) {
428 // start the program directly without sandboxing 428 // if --force option is passed to the program, disregard the existing sandbox
429 run_no_sandbox(argc, argv); 429 int found = 0;
430 // it will never get here! 430 for (i = 1; i < argc; i++) {
431 assert(0); 431 if (strcmp(argv[i], "--force") == 0) {
432 found = 1;
433 break;
434 }
435 }
436
437 if (found == 0) {
438 // start the program directly without sandboxing
439 run_no_sandbox(argc, argv);
440 // it will never get here!
441 assert(0);
442 }
432 } 443 }
433 444
434 // initialize globals 445 // initialize globals
@@ -478,6 +489,8 @@ int main(int argc, char **argv) {
478 arg_debug_whitelists = 1; 489 arg_debug_whitelists = 1;
479 else if (strcmp(argv[i], "--quiet") == 0) 490 else if (strcmp(argv[i], "--quiet") == 0)
480 arg_quiet = 1; 491 arg_quiet = 1;
492 else if (strcmp(argv[i], "--force") == 0)
493 ;
481 494
482 //************************************* 495 //*************************************
483 // filtering 496 // filtering
diff --git a/src/man/firejail.txt b/src/man/firejail.txt
index cd36bead6..eed87c574 100644
--- a/src/man/firejail.txt
+++ b/src/man/firejail.txt
@@ -368,6 +368,13 @@ Example:
368$ firejail \-\-env=LD_LIBRARY_PATH=/opt/test/lib 368$ firejail \-\-env=LD_LIBRARY_PATH=/opt/test/lib
369 369
370.TP 370.TP
371\fB\-\-force
372By default, if Firejail is started in an existing sandbox, it will run the program in a bash shell.
373This option disables this behavior, and attempts to start Firejail in the existing sandbox.
374There could be lots of reasons for it to fail, for example if the existing sandbox disables
375admin capabilities, SUID binaries, or if it runs seccomp.
376
377.TP
371\fB\-\-fs.print=name 378\fB\-\-fs.print=name
372Print the filesystem log for the sandbox identified by name. 379Print the filesystem log for the sandbox identified by name.
373.br 380.br
diff --git a/test/firejail-in-firejail.exp b/test/firejail-in-firejail.exp
index 59a94a7fb..5ba18d1fa 100755
--- a/test/firejail-in-firejail.exp
+++ b/test/firejail-in-firejail.exp
@@ -18,4 +18,4 @@ expect {
18} 18}
19sleep 1 19sleep 1
20 20
21puts "\n" 21puts "\nall done\n"
diff --git a/test/firejail-in-firejail2.exp b/test/firejail-in-firejail2.exp
new file mode 100755
index 000000000..b0fed0dae
--- /dev/null
+++ b/test/firejail-in-firejail2.exp
@@ -0,0 +1,21 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --noprofile\r"
8expect {
9 timeout {puts "TESTING ERROR 1\n";exit}
10 "Child process initialized"
11}
12sleep 1
13
14send -- "firejail --force\r"
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "Child process initialized"
18}
19sleep 1
20
21puts "\nall done\n"
diff --git a/test/test.sh b/test/test.sh
index 78fc7b974..ab288cbeb 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -98,9 +98,12 @@ echo "TESTING: join"
98echo "TESTING: join profile" 98echo "TESTING: join profile"
99./option-join-profile.exp 99./option-join-profile.exp
100 100
101echo "TESTING: firejail in firejail" 101echo "TESTING: firejail in firejail - single sandbox"
102./firejail-in-firejail.exp 102./firejail-in-firejail.exp
103 103
104echo "TESTING: firejail in firejail - force new sandbox"
105./firejail-in-firejail2.exp
106
104echo "TESTING: chroot overlay" 107echo "TESTING: chroot overlay"
105./option_chroot_overlay.exp 108./option_chroot_overlay.exp
106 109