Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Dec 19, 2016
1 parent d94f357 commit 759dc6a
Show file tree
Hide file tree
Showing 9 changed files with 191 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ valoq (https://github.com/valoq)
- added skanlite, ssh-agent, transmission-cli, tracker, transmission-show, w3m, xfburn, xpra profiles
- added wget profile
- disable gnupg and systemd directories under /run/user
thewisenerd (https://github.com/thewisenerd)
- appimage: pass commandline arguments
KOLANICH (https://github.com/KOLANICH)
- added symlink fixer
Jesse Smith (https://github.com/slicer69)
- added QupZilla profile
Lari Rauno (https://github.com/tuutti)
Expand Down Expand Up @@ -317,6 +321,7 @@ Peter Millerchip (https://github.com/pmillerchip)
- support for files and directories starting with ~ in blacklist option
- support for files and directories with spaces in blacklist option
- lots of other fixes
- implement the --allow-private-blacklist option
sarneaud (https://github.com/sarneaud)
- rewrite globbing code to fix various minor issues
- added noblacklist command for profile files
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ Use this issue to request new profiles: https://github.com/netblue30/firejail/is
Example:
$ firejail --machine-id
--allow-private-blacklist
Allow blacklisting files in private home directory. By default
these blacklists are disabled.
Example:
$ firejail --allow-private-blacklist --private=~/priv-dir
--blacklist=~/.mozilla
`````
## New Profiles
xiphos, Tor Browser Bundle, display (imagemagik), Wire, mumble, zoom, Guayadeque, qemu, keypass2,
Expand Down
4 changes: 3 additions & 1 deletion RELNOTES
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ firejail (0.9.45) baseline; urgency=low
* feature: private /opt directory (--private-opt, profile support)
* feature: private /srv directory (--private-srv, profile support)
* feature: spoof machine-id
* feature: config support for firejail prompt in terminal
* feature: config support for firejail prompt in terminals
* feature: pass command line arguments to appimages
* feature: --allow-private-blacklist option
* new profiles: xiphos, Tor Browser Bundle, display (imagemagik), Wire,
* new profiles: mumble, zoom, Guayadeque, qemu, keypass2, xed, pluma,
* new profiles: Cryptocat, Bless, Gnome 2048, Gnome Calculator,
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/firejail/usage.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ void usage(void) {
printf("Options:\n");
printf(" -- - signal the end of options and disables further option processing.\n");
printf(" --allow-debuggers - allow tools such as strace and gdb inside the sandbox.\n");
printf(" --allow-private-blacklist - allow blacklisting things in private\n");
printf("\tdirectories.\n");
printf(" --allow-private-blacklist - allow blacklisting files in private\n");
printf("\thome directories.\n");
printf(" --allusers - all user home directories are visible inside the sandbox.\n");
printf(" --apparmor - enable AppArmor confinement.\n");
printf(" --appimage - sandbox an AppImage application.\n");
Expand Down
9 changes: 9 additions & 0 deletions src/man/firejail.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ Example:
.br
$ firejail --allow-debuggers --profile=/etc/firejail/firefox.profile strace -f firefox
.TP
\fB\-\-allow-private-blacklist
Allow blacklisting files in private home directory. By default these blacklists are disabled.
.br

.br
Example:
.br
$ firejail --allow-private-blacklist --private=~/priv-dir --blacklist=~/.mozilla
.TP
\fB\-\-allusers
All directories under /home are visible inside the sandbox. By default, only current user home directory is visible.
.br
Expand Down
97 changes: 97 additions & 0 deletions test/appimage/appimage-args.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2

set timeout 10
spawn $env(SHELL)
match_max 100000

send -- "firejail --name=appimage-test --debug --appimage Leafpad-0.8.17-x86_64.AppImage testfile\r"
expect {
timeout {puts "TESTING ERROR 1\n";exit}
"execvp argument 2"
}
expect {
timeout {puts "TESTING ERROR 2\n";exit}
"AppRun"
}
expect {
timeout {puts "TESTING ERROR 3\n";exit}
"testfile"
}
expect {
timeout {puts "TESTING ERROR 4\n";exit}
"Child process initialized"
}
sleep 2

spawn $env(SHELL)
send -- "firejail --list\r"
expect {
timeout {puts "TESTING ERROR 5\n";exit}
":firejail"
}
expect {
timeout {puts "TESTING ERROR 6\n";exit}
"appimage Leafpad"
}
after 100

# grsecurity exit
send -- "file /proc/sys/kernel/grsecurity\r"
expect {
timeout {puts "TESTING ERROR - grsecurity detection\n";exit}
"grsecurity: directory" {puts "grsecurity present, exiting...\n";exit}
"cannot open" {puts "grsecurity not present\n"}
}


send -- "firejail --name=blablabla\r"
expect {
timeout {puts "TESTING ERROR 7\n";exit}
"Child process initialized"
}
sleep 2

spawn $env(SHELL)
send -- "firemon --seccomp\r"
expect {
timeout {puts "TESTING ERROR 8\n";exit}
"need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
"appimage Leafpad"
}
expect {
timeout {puts "TESTING ERROR 9 (seccomp)\n";exit}
"Seccomp: 2"
}
expect {
timeout {puts "TESTING ERROR 10\n";exit}
"name=blablabla"
}
after 100
send -- "firemon --caps\r"
expect {
timeout {puts "TESTING ERROR 11\n";exit}
"appimage Leafpad"
}
expect {
timeout {puts "TESTING ERROR 12\n";exit}
"CapBnd:"
}
expect {
timeout {puts "TESTING ERROR 13\n";exit}
"0000000000000000"
}
expect {
timeout {puts "TESTING ERROR 14\n";exit}
"name=blablabla"
}
after 100

spawn $env(SHELL)
send -- "firejail --shutdown=appimage-test\r"
sleep 3

puts "\nall done\n"

6 changes: 5 additions & 1 deletion test/appimage/appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)"
./appimage-v2.exp

echo "TESTING: AppImage file name (test/appimage/filename.exp)";
./filename.exp
./filename.exp

echo "TESTING: AppImage argsv1 (test/appimage/appimage-args.exp)"
./appimage-args.exp

62 changes: 61 additions & 1 deletion test/fs/private-home-dir.exp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ if {[file exists ~/.Xauthority]} {
send -- "touch ~/.Xauthority\r"
}
after 100
send -- "rm -fr ~/_firejail_test_dir_\r"
after 100
send -- "mkdir ~/_firejail_test_dir_\r"
sleep 1

Expand Down Expand Up @@ -65,6 +67,64 @@ expect {
"private directory should be owned by the current user"
}
sleep 1
send -- "mkdir ~/_firejail_test_dir_/test_dir_2\r"
after 100
send -- "touch ~/_firejail_test_dir_/test_dir_2/testfile\r"
sleep 1

send -- "firejail --debug --noprofile --blacklist=~/test_dir_2 --private=~/_firejail_test_dir_\r"
expect {
timeout {puts "TESTING ERROR 6\n";exit}
"Not blacklist"
}
expect {
timeout {puts "TESTING ERROR 7\n";exit}
"test_dir_2"
}
expect {
timeout {puts "TESTING ERROR 8\n";exit}
"Child process initialized"
}

sleep 1

send -- "find ~\r"
expect {
timeout {puts "TESTING ERROR 9\n";exit}
"testfile"
}
after 100

send -- "exit\r"
sleep 1

send -- "firejail --debug --noprofile --allow-private-blacklist --blacklist=~/test_dir_2 --private=~/_firejail_test_dir_\r"
expect {
timeout {puts "TESTING ERROR 10\n";exit}
"Disable"
}
expect {
timeout {puts "TESTING ERROR 11\n";exit}
"test_dir_2"
}
expect {
timeout {puts "TESTING ERROR 12\n";exit}
"Child process initialized"
}

sleep 1

send -- "ls ~/test_dir_2\r"
expect {
timeout {puts "TESTING ERROR 13\n";exit}
"cannot open directory"
}
after 100

send "exit\r"
sleep 1

send -- "rm -fr ~/_firejail_test_dir_\r"
after 100

puts "all done\n"
puts "\nall done\n"

0 comments on commit 759dc6a

Please sign in to comment.