aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2022-09-26 10:56:19 -0400
committerLibravatar netblue30 <netblue30@protonmail.com>2022-09-26 10:56:19 -0400
commit4bbc9680836c3f959fac63e6c0abf4d7afb70346 (patch)
tree9cc50b7486aab5697d5ba475c9e8df1f818654b9
parentmerges (diff)
parentMerge pull request #5360 from glitsj16/ff-dbus (diff)
downloadfirejail-4bbc9680836c3f959fac63e6c0abf4d7afb70346.tar.gz
firejail-4bbc9680836c3f959fac63e6c0abf4d7afb70346.tar.zst
firejail-4bbc9680836c3f959fac63e6c0abf4d7afb70346.zip
Merge branch 'master' of ssh://github.com/netblue30/firejail
-rwxr-xr-xcontrib/gdb-firejail.sh2
-rw-r--r--etc/profile-a-l/firefox-developer-edition.profile4
-rw-r--r--etc/profile-a-l/firefox.profile3
-rw-r--r--etc/profile-m-z/signal-desktop.profile5
-rw-r--r--etc/profile-m-z/zeal.profile5
-rwxr-xr-xtest/appimage/appimage.sh2
-rwxr-xr-xtest/apps-x11-xorg/apps-x11-xorg.sh12
-rwxr-xr-xtest/apps-x11/apps-x11.sh44
-rwxr-xr-xtest/apps/apps.sh8
-rwxr-xr-xtest/chroot/chroot.sh2
-rwxr-xr-xtest/compile/compile.sh95
-rwxr-xr-xtest/environment/environment.sh24
-rwxr-xr-xtest/environment/output.sh6
-rwxr-xr-xtest/fcopy/fcopy.sh4
-rwxr-xr-xtest/features/test.sh87
-rwxr-xr-xtest/filters/filters.sh77
-rwxr-xr-xtest/fnetfilter/fnetfilter.sh2
-rwxr-xr-xtest/fs/fs.sh28
-rwxr-xr-xtest/overlay/overlay.sh24
-rwxr-xr-xtest/private-lib/private-lib.sh8
-rwxr-xr-xtest/profiles/all-profiles.sh8
-rwxr-xr-xtest/profiles/profiles.sh8
-rwxr-xr-xtest/root/root.sh21
-rwxr-xr-xtest/stress/stress.sh2
-rwxr-xr-xtest/sysutils/sysutils.sh27
-rwxr-xr-xtest/utils/catchsignal.sh26
-rwxr-xr-xtest/utils/catchsignal2.sh66
-rwxr-xr-xtest/utils/utils.sh19
28 files changed, 283 insertions, 336 deletions
diff --git a/contrib/gdb-firejail.sh b/contrib/gdb-firejail.sh
index 397438e1e..35348088e 100755
--- a/contrib/gdb-firejail.sh
+++ b/contrib/gdb-firejail.sh
@@ -17,7 +17,7 @@ if [ -z "${1##*/firejail}" ]; then
17else 17else
18 # First argument is not named firejail, then add default unless environment 18 # First argument is not named firejail, then add default unless environment
19 # variable already set. 19 # variable already set.
20 set -- ${FIREJAIL:=$(which firejail)} "$@" 20 set -- ${FIREJAIL:=$(command -v firejail)} "$@"
21fi 21fi
22 22
23bash -c "kill -STOP \$\$; exec \"\$0\" \"\$@\"" "$@" & 23bash -c "kill -STOP \$\$; exec \"\$0\" \"\$@\"" "$@" &
diff --git a/etc/profile-a-l/firefox-developer-edition.profile b/etc/profile-a-l/firefox-developer-edition.profile
index 3a9b8cf92..8c7ca3887 100644
--- a/etc/profile-a-l/firefox-developer-edition.profile
+++ b/etc/profile-a-l/firefox-developer-edition.profile
@@ -7,9 +7,5 @@ include firefox-developer-edition.local
7# added by included profile 7# added by included profile
8#include globals.local 8#include globals.local
9 9
10# Edition-specific DBus filters
11dbus-user.own org.mozilla.FirefoxDeveloperEdition.*
12dbus-user.own org.mozilla.firefoxdeveloperedition.*
13
14# Redirect 10# Redirect
15include firefox.profile 11include firefox.profile
diff --git a/etc/profile-a-l/firefox.profile b/etc/profile-a-l/firefox.profile
index 99a6db2ae..0e1d30958 100644
--- a/etc/profile-a-l/firefox.profile
+++ b/etc/profile-a-l/firefox.profile
@@ -49,8 +49,7 @@ include whitelist-usr-share-common.inc
49#private-etc firefox 49#private-etc firefox
50 50
51dbus-user filter 51dbus-user filter
52dbus-user.own org.mozilla.Firefox.* 52dbus-user.own org.mozilla.*
53dbus-user.own org.mozilla.firefox.*
54dbus-user.own org.mpris.MediaPlayer2.firefox.* 53dbus-user.own org.mpris.MediaPlayer2.firefox.*
55# Add the next line to your firefox.local to enable native notifications. 54# Add the next line to your firefox.local to enable native notifications.
56#dbus-user.talk org.freedesktop.Notifications 55#dbus-user.talk org.freedesktop.Notifications
diff --git a/etc/profile-m-z/signal-desktop.profile b/etc/profile-m-z/signal-desktop.profile
index 1166f378b..2c4bdecd8 100644
--- a/etc/profile-m-z/signal-desktop.profile
+++ b/etc/profile-m-z/signal-desktop.profile
@@ -26,9 +26,8 @@ dbus-user filter
26# allow D-Bus notifications 26# allow D-Bus notifications
27dbus-user.talk org.freedesktop.Notifications 27dbus-user.talk org.freedesktop.Notifications
28 28
29# allow D-Bus communication with firefox for opening links 29# allow D-Bus communication with Firefox browsers for opening links
30dbus-user.talk org.mozilla.Firefox.* 30dbus-user.talk org.mozilla.*
31dbus-user.talk org.mozilla.firefox.*
32 31
33ignore dbus-user none 32ignore dbus-user none
34 33
diff --git a/etc/profile-m-z/zeal.profile b/etc/profile-m-z/zeal.profile
index 62af9c6a8..84f6d52dd 100644
--- a/etc/profile-m-z/zeal.profile
+++ b/etc/profile-m-z/zeal.profile
@@ -19,7 +19,7 @@ include disable-programs.inc
19include disable-shell.inc 19include disable-shell.inc
20include disable-xdg.inc 20include disable-xdg.inc
21 21
22# Allow zeal to open links in Firefox. 22# Allow zeal to open links in Firefox browsers.
23# This also requires dbus-user filtering (see below). 23# This also requires dbus-user filtering (see below).
24noblacklist ${HOME}/.mozilla 24noblacklist ${HOME}/.mozilla
25whitelist ${HOME}/.mozilla/firefox/profiles.ini 25whitelist ${HOME}/.mozilla/firefox/profiles.ini
@@ -64,8 +64,7 @@ private-etc alternatives,ca-certificates,crypto-policies,fonts,host.conf,hostnam
64private-tmp 64private-tmp
65 65
66dbus-user filter 66dbus-user filter
67dbus-user.talk org.mozilla.Firefox.* 67dbus-user.talk org.mozilla.*
68dbus-user.talk org.mozilla.firefox.*
69?ALLOW_TRAY: dbus-user.talk org.kde.StatusNotifierWatcher 68?ALLOW_TRAY: dbus-user.talk org.kde.StatusNotifierWatcher
70dbus-system none 69dbus-system none
71 70
diff --git a/test/appimage/appimage.sh b/test/appimage/appimage.sh
index 9afacf5be..c2bdad012 100755
--- a/test/appimage/appimage.sh
+++ b/test/appimage/appimage.sh
@@ -13,7 +13,7 @@ echo "TESTING: AppImage v1 (test/appimage/appimage-v1.exp)"
13echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)" 13echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)"
14./appimage-v2.exp 14./appimage-v2.exp
15 15
16echo "TESTING: AppImage file name (test/appimage/filename.exp)"; 16echo "TESTING: AppImage file name (test/appimage/filename.exp)"
17./filename.exp 17./filename.exp
18 18
19echo "TESTING: AppImage argsv1 (test/appimage/appimage-args.exp)" 19echo "TESTING: AppImage argsv1 (test/appimage/appimage-args.exp)"
diff --git a/test/apps-x11-xorg/apps-x11-xorg.sh b/test/apps-x11-xorg/apps-x11-xorg.sh
index 9ed123979..9dcee7aff 100755
--- a/test/apps-x11-xorg/apps-x11-xorg.sh
+++ b/test/apps-x11-xorg/apps-x11-xorg.sh
@@ -7,8 +7,7 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10which firefox 2>/dev/null 10if command -v firefox
11if [ "$?" -eq 0 ];
12then 11then
13 echo "TESTING: firefox x11 xorg" 12 echo "TESTING: firefox x11 xorg"
14 ./firefox.exp 13 ./firefox.exp
@@ -16,8 +15,7 @@ else
16 echo "TESTING SKIP: firefox not found" 15 echo "TESTING SKIP: firefox not found"
17fi 16fi
18 17
19which transmission-gtk 2>/dev/null 18if command -v transmission-gtk
20if [ "$?" -eq 0 ];
21then 19then
22 echo "TESTING: transmission-gtk x11 xorg" 20 echo "TESTING: transmission-gtk x11 xorg"
23 ./transmission-gtk.exp 21 ./transmission-gtk.exp
@@ -25,8 +23,7 @@ else
25 echo "TESTING SKIP: transmission-gtk not found" 23 echo "TESTING SKIP: transmission-gtk not found"
26fi 24fi
27 25
28which transmission-qt 2>/dev/null 26if command -v transmission-qt
29if [ "$?" -eq 0 ];
30then 27then
31 echo "TESTING: transmission-qt x11 xorg" 28 echo "TESTING: transmission-qt x11 xorg"
32 ./transmission-qt.exp 29 ./transmission-qt.exp
@@ -34,8 +31,7 @@ else
34 echo "TESTING SKIP: transmission-qt not found" 31 echo "TESTING SKIP: transmission-qt not found"
35fi 32fi
36 33
37which thunderbird 2>/dev/null 34if command -v thunderbird
38if [ "$?" -eq 0 ];
39then 35then
40 echo "TESTING: thunderbird x11 xorg" 36 echo "TESTING: thunderbird x11 xorg"
41 ./thunderbird.exp 37 ./thunderbird.exp
diff --git a/test/apps-x11/apps-x11.sh b/test/apps-x11/apps-x11.sh
index a3c946ca4..b2722eed3 100755
--- a/test/apps-x11/apps-x11.sh
+++ b/test/apps-x11/apps-x11.sh
@@ -10,49 +10,42 @@ export LC_ALL=C
10echo "TESTING: no x11 (test/apps-x11/x11-none.exp)" 10echo "TESTING: no x11 (test/apps-x11/x11-none.exp)"
11./x11-none.exp 11./x11-none.exp
12 12
13 13if command -v xterm
14which xterm 2>/dev/null
15if [ "$?" -eq 0 ];
16then 14then
17 echo "TESTING: xterm x11 xorg" 15 echo "TESTING: xterm x11 xorg"
18 ./xterm-xorg.exp 16 ./xterm-xorg.exp
19 17
20 which xpra 2>/dev/null 18 if command -v xpra
21 if [ "$?" -eq 0 ];
22 then 19 then
23 echo "TESTING: xterm x11 xpra" 20 echo "TESTING: xterm x11 xpra"
24 ./xterm-xpra.exp 21 ./xterm-xpra.exp
25 fi 22 fi
26 23
27 which Xephyr 2>/dev/null 24 if command -v Xephyr
28 if [ "$?" -eq 0 ];
29 then 25 then
30 echo "TESTING: xterm x11 xephyr" 26 echo "TESTING: xterm x11 xephyr"
31 ./xterm-xephyr.exp 27 ./xterm-xephyr.exp
32 fi 28 fi
33else 29else
34 echo "TESTING SKIP: xterm not found" 30 echo "TESTING SKIP: xterm not found"
35fi 31fi
36 32
37# check xpra/xephyr 33# check xpra/xephyr
38which xpra 2>/dev/null 34if command -v xpra
39if [ "$?" -eq 0 ];
40then 35then
41 echo "xpra found" 36 echo "xpra found"
42else 37else
43 echo "xpra not found" 38 echo "xpra not found"
44 which Xephyr 2>/dev/null 39 if command -v Xephyr
45 if [ "$?" -eq 0 ];
46 then 40 then
47 echo "Xephyr found" 41 echo "Xephyr found"
48 else 42 else
49 echo "TESTING SKIP: xpra and/or Xephyr not found" 43 echo "TESTING SKIP: xpra and/or Xephyr not found"
50 exit 44 exit
51 fi 45 fi
52fi 46fi
53 47
54which firefox 2>/dev/null 48if command -v firefox
55if [ "$?" -eq 0 ];
56then 49then
57 echo "TESTING: firefox x11" 50 echo "TESTING: firefox x11"
58 ./firefox.exp 51 ./firefox.exp
@@ -60,8 +53,7 @@ else
60 echo "TESTING SKIP: firefox not found" 53 echo "TESTING SKIP: firefox not found"
61fi 54fi
62 55
63which chromium 2>/dev/null 56if command -v chromium
64if [ "$?" -eq 0 ];
65then 57then
66 echo "TESTING: chromium x11" 58 echo "TESTING: chromium x11"
67 ./chromium.exp 59 ./chromium.exp
@@ -69,8 +61,7 @@ else
69 echo "TESTING SKIP: chromium not found" 61 echo "TESTING SKIP: chromium not found"
70fi 62fi
71 63
72which transmission-gtk 2>/dev/null 64if command -v transmission-gtk
73if [ "$?" -eq 0 ];
74then 65then
75 echo "TESTING: transmission-gtk x11" 66 echo "TESTING: transmission-gtk x11"
76 ./transmission-gtk.exp 67 ./transmission-gtk.exp
@@ -78,8 +69,7 @@ else
78 echo "TESTING SKIP: transmission-gtk not found" 69 echo "TESTING SKIP: transmission-gtk not found"
79fi 70fi
80 71
81which thunderbird 2>/dev/null 72if command -v thunderbird
82if [ "$?" -eq 0 ];
83then 73then
84 echo "TESTING: thunderbird x11" 74 echo "TESTING: thunderbird x11"
85 ./thunderbird.exp 75 ./thunderbird.exp
diff --git a/test/apps/apps.sh b/test/apps/apps.sh
index 83e977ba0..0ef01bf2e 100755
--- a/test/apps/apps.sh
+++ b/test/apps/apps.sh
@@ -7,12 +7,10 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10LIST="firefox midori chromium opera transmission-qt qbittorrent uget-gtk filezilla gthumb thunderbird " 10apps=(firefox midori chromium opera transmission-qt qbittorrent uget-gtk filezilla gthumb thunderbird vlc fbreader deluge gnome-mplayer xchat wine kcalc ktorrent hexchat)
11LIST+="vlc fbreader deluge gnome-mplayer xchat wine kcalc ktorrent hexchat"
12 11
13for app in $LIST; do 12for app in "${apps[@]}"; do
14 which $app 2>/dev/null 13 if command -v "$app"
15 if [ "$?" -eq 0 ];
16 then 14 then
17 echo "TESTING: $app" 15 echo "TESTING: $app"
18 ./$app.exp 16 ./$app.exp
diff --git a/test/chroot/chroot.sh b/test/chroot/chroot.sh
index 3c3e7311b..f5ccf3549 100755
--- a/test/chroot/chroot.sh
+++ b/test/chroot/chroot.sh
@@ -17,6 +17,4 @@ echo "TESTING: chroot (test/chroot/fs_chroot.exp)"
17echo "TESTING: unchroot as root (test/chroot/unchroot-as-root.exp)" 17echo "TESTING: unchroot as root (test/chroot/unchroot-as-root.exp)"
18sudo ./unchroot-as-root.exp 18sudo ./unchroot-as-root.exp
19 19
20
21
22rm -f unchroot 20rm -f unchroot
diff --git a/test/compile/compile.sh b/test/compile/compile.sh
index 6b994ba70..0285c8935 100755
--- a/test/compile/compile.sh
+++ b/test/compile/compile.sh
@@ -31,7 +31,7 @@ arr[15]="TEST 15: compile private-home disabled"
31arr[16]="TEST 16: compile disable manpages" 31arr[16]="TEST 16: compile disable manpages"
32arr[17]="TEST 17: disable tmpfs as regular user" 32arr[17]="TEST 17: disable tmpfs as regular user"
33arr[18]="TEST 18: disable private home" 33arr[18]="TEST 18: disable private home"
34arr[18]="TEST 19: enable ids" 34arr[19]="TEST 19: enable ids"
35 35
36# remove previous reports and output file 36# remove previous reports and output file
37cleanup() { 37cleanup() {
@@ -47,23 +47,23 @@ print_title() {
47 echo 47 echo
48 echo 48 echo
49 echo "**************************************************" 49 echo "**************************************************"
50 echo $1 50 echo "$1"
51 echo "**************************************************" 51 echo "**************************************************"
52} 52}
53 53
54DIST="$1" 54DIST="$1"
55while [ $# -gt 0 ]; do # Until you run out of parameters . . . 55while [[ $# -gt 0 ]]; do # Until you run out of parameters . . .
56 case "$1" in 56 case "$1" in
57 --clean) 57 --clean)
58 cleanup 58 cleanup
59 exit 59 exit
60 ;; 60 ;;
61 --help) 61 --help)
62 echo "./compile.sh [--clean|--help]" 62 echo "./compile.sh [--clean|--help]"
63 exit 63 exit
64 ;; 64 ;;
65 esac 65 esac
66 shift # Check next set of parameters. 66 shift # Check next set of parameters.
67done 67done
68 68
69cleanup 69cleanup
@@ -76,8 +76,8 @@ cleanup
76#***************************************************************** 76#*****************************************************************
77print_title "${arr[1]}" 77print_title "${arr[1]}"
78echo "$DIST" 78echo "$DIST"
79tar -xJvf ../../$DIST.tar.xz 79tar -xJvf ../../"$DIST.tar.xz"
80mv $DIST firejail 80mv "$DIST" firejail
81 81
82cd firejail 82cd firejail
83./configure --prefix=/usr --enable-fatal-warnings 2>&1 | tee ../output-configure 83./configure --prefix=/usr --enable-fatal-warnings 2>&1 | tee ../output-configure
@@ -89,7 +89,6 @@ cp output-configure oc1
89cp output-make om1 89cp output-make om1
90rm output-configure output-make 90rm output-configure output-make
91 91
92
93#***************************************************************** 92#*****************************************************************
94# TEST 2 93# TEST 2
95#***************************************************************** 94#*****************************************************************
@@ -98,7 +97,7 @@ rm output-configure output-make
98print_title "${arr[2]}" 97print_title "${arr[2]}"
99cd firejail 98cd firejail
100make distclean 99make distclean
101./configure --prefix=/usr --disable-dbusproxy --enable-fatal-warnings 2>&1 | tee ../output-configure 100./configure --prefix=/usr --disable-dbusproxy --enable-fatal-warnings 2>&1 | tee ../output-configure
102make -j4 2>&1 | tee ../output-make 101make -j4 2>&1 | tee ../output-make
103cd .. 102cd ..
104grep Warning output-configure output-make > ./report-test2 103grep Warning output-configure output-make > ./report-test2
@@ -115,7 +114,7 @@ rm output-configure output-make
115print_title "${arr[3]}" 114print_title "${arr[3]}"
116cd firejail 115cd firejail
117make distclean 116make distclean
118./configure --prefix=/usr --disable-chroot --enable-fatal-warnings 2>&1 | tee ../output-configure 117./configure --prefix=/usr --disable-chroot --enable-fatal-warnings 2>&1 | tee ../output-configure
119make -j4 2>&1 | tee ../output-make 118make -j4 2>&1 | tee ../output-make
120cd .. 119cd ..
121grep Warning output-configure output-make > ./report-test3 120grep Warning output-configure output-make > ./report-test3
@@ -132,7 +131,7 @@ rm output-configure output-make
132print_title "${arr[4]}" 131print_title "${arr[4]}"
133cd firejail 132cd firejail
134make distclean 133make distclean
135./configure --prefix=/usr --disable-firetunnel --enable-fatal-warnings 2>&1 | tee ../output-configure 134./configure --prefix=/usr --disable-firetunnel --enable-fatal-warnings 2>&1 | tee ../output-configure
136make -j4 2>&1 | tee ../output-make 135make -j4 2>&1 | tee ../output-make
137cd .. 136cd ..
138grep Warning output-configure output-make > ./report-test4 137grep Warning output-configure output-make > ./report-test4
@@ -149,7 +148,7 @@ rm output-configure output-make
149print_title "${arr[5]}" 148print_title "${arr[5]}"
150cd firejail 149cd firejail
151make distclean 150make distclean
152./configure --prefix=/usr --disable-userns --enable-fatal-warnings 2>&1 | tee ../output-configure 151./configure --prefix=/usr --disable-userns --enable-fatal-warnings 2>&1 | tee ../output-configure
153make -j4 2>&1 | tee ../output-make 152make -j4 2>&1 | tee ../output-make
154cd .. 153cd ..
155grep Warning output-configure output-make > ./report-test5 154grep Warning output-configure output-make > ./report-test5
@@ -167,7 +166,7 @@ rm output-configure output-make
167print_title "${arr[6]}" 166print_title "${arr[6]}"
168cd firejail 167cd firejail
169make distclean 168make distclean
170./configure --prefix=/usr --disable-network --enable-fatal-warnings 2>&1 | tee ../output-configure 169./configure --prefix=/usr --disable-network --enable-fatal-warnings 2>&1 | tee ../output-configure
171make -j4 2>&1 | tee ../output-make 170make -j4 2>&1 | tee ../output-make
172cd .. 171cd ..
173grep Warning output-configure output-make > ./report-test6 172grep Warning output-configure output-make > ./report-test6
@@ -184,7 +183,7 @@ rm output-configure output-make
184print_title "${arr[7]}" 183print_title "${arr[7]}"
185cd firejail 184cd firejail
186make distclean 185make distclean
187./configure --prefix=/usr --disable-x11 --enable-fatal-warnings 2>&1 | tee ../output-configure 186./configure --prefix=/usr --disable-x11 --enable-fatal-warnings 2>&1 | tee ../output-configure
188make -j4 2>&1 | tee ../output-make 187make -j4 2>&1 | tee ../output-make
189cd .. 188cd ..
190grep Warning output-configure output-make > ./report-test7 189grep Warning output-configure output-make > ./report-test7
@@ -218,7 +217,7 @@ rm output-configure output-make
218print_title "${arr[9]}" 217print_title "${arr[9]}"
219cd firejail 218cd firejail
220make distclean 219make distclean
221./configure --prefix=/usr --disable-file-transfer --enable-fatal-warnings 2>&1 | tee ../output-configure 220./configure --prefix=/usr --disable-file-transfer --enable-fatal-warnings 2>&1 | tee ../output-configure
222make -j4 2>&1 | tee ../output-make 221make -j4 2>&1 | tee ../output-make
223cd .. 222cd ..
224grep Warning output-configure output-make > ./report-test9 223grep Warning output-configure output-make > ./report-test9
@@ -235,7 +234,7 @@ rm output-configure output-make
235print_title "${arr[10]}" 234print_title "${arr[10]}"
236cd firejail 235cd firejail
237make distclean 236make distclean
238./configure --prefix=/usr --disable-whitelist --enable-fatal-warnings 2>&1 | tee ../output-configure 237./configure --prefix=/usr --disable-whitelist --enable-fatal-warnings 2>&1 | tee ../output-configure
239make -j4 2>&1 | tee ../output-make 238make -j4 2>&1 | tee ../output-make
240cd .. 239cd ..
241grep Warning output-configure output-make > ./report-test10 240grep Warning output-configure output-make > ./report-test10
@@ -252,7 +251,7 @@ rm output-configure output-make
252print_title "${arr[11]}" 251print_title "${arr[11]}"
253cd firejail 252cd firejail
254make distclean 253make distclean
255./configure --prefix=/usr --disable-globalcfg --enable-fatal-warnings 2>&1 | tee ../output-configure 254./configure --prefix=/usr --disable-globalcfg --enable-fatal-warnings 2>&1 | tee ../output-configure
256make -j4 2>&1 | tee ../output-make 255make -j4 2>&1 | tee ../output-make
257cd .. 256cd ..
258grep Warning output-configure output-make > ./report-test11 257grep Warning output-configure output-make > ./report-test11
@@ -269,7 +268,7 @@ rm output-configure output-make
269print_title "${arr[12]}" 268print_title "${arr[12]}"
270cd firejail 269cd firejail
271make distclean 270make distclean
272./configure --prefix=/usr --enable-apparmor --enable-fatal-warnings 2>&1 | tee ../output-configure 271./configure --prefix=/usr --enable-apparmor --enable-fatal-warnings 2>&1 | tee ../output-configure
273make -j4 2>&1 | tee ../output-make 272make -j4 2>&1 | tee ../output-make
274cd .. 273cd ..
275grep Warning output-configure output-make > ./report-test12 274grep Warning output-configure output-make > ./report-test12
@@ -354,7 +353,7 @@ rm output-configure output-make
354print_title "${arr[17]}" 353print_title "${arr[17]}"
355cd firejail 354cd firejail
356make distclean 355make distclean
357./configure --prefix=/usr --disable-usertmpfs --enable-fatal-warnings 2>&1 | tee ../output-configure 356./configure --prefix=/usr --disable-usertmpfs --enable-fatal-warnings 2>&1 | tee ../output-configure
358make -j4 2>&1 | tee ../output-make 357make -j4 2>&1 | tee ../output-make
359cd .. 358cd ..
360grep Warning output-configure output-make > ./report-test17 359grep Warning output-configure output-make > ./report-test17
@@ -410,23 +409,23 @@ echo "**********************************************************"
410 409
411wc -l report-test* 410wc -l report-test*
412echo 411echo
413echo "Legend:" 412echo "Legend:"
414echo ${arr[1]} 413echo "${arr[1]}"
415echo ${arr[2]} 414echo "${arr[2]}"
416echo ${arr[3]} 415echo "${arr[3]}"
417echo ${arr[4]} 416echo "${arr[4]}"
418echo ${arr[5]} 417echo "${arr[5]}"
419echo ${arr[6]} 418echo "${arr[6]}"
420echo ${arr[7]} 419echo "${arr[7]}"
421echo ${arr[8]} 420echo "${arr[8]}"
422echo ${arr[9]} 421echo "${arr[9]}"
423echo ${arr[10]} 422echo "${arr[10]}"
424echo ${arr[11]} 423echo "${arr[11]}"
425echo ${arr[12]} 424echo "${arr[12]}"
426echo ${arr[13]} 425echo "${arr[13]}"
427echo ${arr[14]} 426echo "${arr[14]}"
428echo ${arr[15]} 427echo "${arr[15]}"
429echo ${arr[16]} 428echo "${arr[16]}"
430echo ${arr[17]} 429echo "${arr[17]}"
431echo ${arr[18]} 430echo "${arr[18]}"
432echo ${arr[19]} 431echo "${arr[19]}"
diff --git a/test/environment/environment.sh b/test/environment/environment.sh
index da9c170b9..c88c91741 100755
--- a/test/environment/environment.sh
+++ b/test/environment/environment.sh
@@ -7,7 +7,6 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10
11echo "TESTING: timeout (test/environment/timeout.exp)" 10echo "TESTING: timeout (test/environment/timeout.exp)"
12./timeout.exp 11./timeout.exp
13 12
@@ -39,13 +38,12 @@ echo "TESTING: environment variables (test/environment/env.exp)"
39echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)" 38echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)"
40./firejail-in-firejail.exp 39./firejail-in-firejail.exp
41 40
42which aplay 2>/dev/null 41if command -v aplay && [[ $(aplay -l | grep -c "List of PLAYBACK") -gt 0 ]]
43if [ "$?" -eq 0 ] && [ "$(aplay -l | grep -c "List of PLAYBACK")" -gt 0 ];
44then 42then
45 echo "TESTING: sound (test/environment/sound.exp)" 43 echo "TESTING: sound (test/environment/sound.exp)"
46 ./sound.exp 44 ./sound.exp
47else 45else
48 echo "TESTING SKIP: no aplay or sound card found" 46 echo "TESTING SKIP: no aplay or sound card found"
49fi 47fi
50 48
51echo "TESTING: nice (test/environment/nice.exp)" 49echo "TESTING: nice (test/environment/nice.exp)"
@@ -54,26 +52,24 @@ echo "TESTING: nice (test/environment/nice.exp)"
54echo "TESTING: quiet (test/environment/quiet.exp)" 52echo "TESTING: quiet (test/environment/quiet.exp)"
55./quiet.exp 53./quiet.exp
56 54
57which strace 2>/dev/null 55if command -v strace
58if [ "$?" -eq 0 ];
59then 56then
60 echo "TESTING: --allow-debuggers (test/environment/allow-debuggers.exp)" 57 echo "TESTING: --allow-debuggers (test/environment/allow-debuggers.exp)"
61 ./allow-debuggers.exp 58 ./allow-debuggers.exp
62else 59else
63 echo "TESTING SKIP: strace not found" 60 echo "TESTING SKIP: strace not found"
64fi 61fi
65 62
66# to install ibus: 63# to install ibus:
67# $ sudo apt-get install ibus-table-array30 64# $ sudo apt-get install ibus-table-array30
68# $ ibus-setup 65# $ ibus-setup
69 66
70find ~/.config/ibus/bus | grep unix-0 67if find ~/.config/ibus/bus | grep unix-0
71if [ "$?" -eq 0 ];
72then 68then
73 echo "TESTING: ibus (test/environment/ibus.exp)" 69 echo "TESTING: ibus (test/environment/ibus.exp)"
74 ./ibus.exp 70 ./ibus.exp
75else 71else
76 echo "TESTING SKIP: ibus not configured" 72 echo "TESTING SKIP: ibus not configured"
77fi 73fi
78 74
79echo "TESTING: rlimit (test/environment/rlimit.exp)" 75echo "TESTING: rlimit (test/environment/rlimit.exp)"
diff --git a/test/environment/output.sh b/test/environment/output.sh
index 329cb40c7..ba06f9184 100755
--- a/test/environment/output.sh
+++ b/test/environment/output.sh
@@ -5,8 +5,8 @@
5 5
6i="0" 6i="0"
7 7
8while [ $i -lt 150000 ] 8while [[ $i -lt 150000 ]]
9do 9do
10 echo message number $i 10 echo "message number $i"
11 i=$[$i+1] 11 i=$((i+1))
12done 12done
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh
index fca599889..72b87d14c 100755
--- a/test/fcopy/fcopy.sh
+++ b/test/fcopy/fcopy.sh
@@ -7,7 +7,7 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10if [ -f /etc/debian_version ]; then 10if [[ -f /etc/debian_version ]]; then
11 libdir=$(dirname "$(dpkg -L firejail | grep fcopy)") 11 libdir=$(dirname "$(dpkg -L firejail | grep fcopy)")
12 export PATH="$PATH:$libdir" 12 export PATH="$PATH:$libdir"
13fi 13fi
@@ -29,4 +29,4 @@ echo "TESTING: fcopy directory (test/fcopy/dircopy.exp)"
29./dircopy.exp 29./dircopy.exp
30 30
31rm -fr dest/* 31rm -fr dest/*
32rm -f src/dircopy.exp \ No newline at end of file 32rm -f src/dircopy.exp
diff --git a/test/features/test.sh b/test/features/test.sh
index b507c6d37..44677aaa7 100755
--- a/test/features/test.sh
+++ b/test/features/test.sh
@@ -8,28 +8,25 @@ OVERLAY="overlay"
8CHROOT="chroot" 8CHROOT="chroot"
9NETWORK="network" 9NETWORK="network"
10 10
11while [ $# -gt 0 ]; do # Until you run out of parameters . . . 11while [[ $# -gt 0 ]]; do # Until you run out of parameters . . .
12 case "$1" in 12 case "$1" in
13 --nooverlay) 13 --nooverlay)
14 OVERLAY="none" 14 OVERLAY="none"
15 ;; 15 ;;
16 --nochroot) 16 --nochroot)
17 CHROOT="none" 17 CHROOT="none"
18 ;; 18 ;;
19 --nonetwork) 19 --nonetwork)
20 NETWORK="none" 20 NETWORK="none"
21 ;; 21 ;;
22 --help) 22 --help)
23 echo "./test.sh [--nooverlay|--nochroot|--nonetwork|--help] | grep TESTING" 23 echo "./test.sh [--nooverlay|--nochroot|--nonetwork|--help] | grep TESTING"
24 exit 24 exit
25 ;; 25 ;;
26 esac 26 esac
27 shift # Check next set of parameters. 27 shift # Check next set of parameters.
28done 28done
29 29
30
31
32
33# 30#
34# Feature testing 31# Feature testing
35# 32#
@@ -38,85 +35,85 @@ done
38# Default features 35# Default features
39#################### 36####################
40echo "TESTING: 1.1 disable /boot" 37echo "TESTING: 1.1 disable /boot"
41./1.1.exp $OVERLAY $CHROOT 38./1.1.exp "$OVERLAY" "$CHROOT"
42 39
43echo "TESTING: 1.2 new /proc" 40echo "TESTING: 1.2 new /proc"
44./1.2.exp $OVERLAY $CHROOT 41./1.2.exp "$OVERLAY" "$CHROOT"
45 42
46echo "TESTING: 1.4 mask other users" 43echo "TESTING: 1.4 mask other users"
47./1.4.exp $OVERLAY $CHROOT 44./1.4.exp "$OVERLAY" "$CHROOT"
48 45
49echo "TESTING: 1.5 PID namespace" 46echo "TESTING: 1.5 PID namespace"
50./1.5.exp $OVERLAY $CHROOT 47./1.5.exp "$OVERLAY" "$CHROOT"
51 48
52echo "TESTING: 1.6 new /var/log" 49echo "TESTING: 1.6 new /var/log"
53./1.6.exp $OVERLAY $CHROOT 50./1.6.exp "$OVERLAY" "$CHROOT"
54 51
55echo "TESTING: 1.7 new /var/tmp" 52echo "TESTING: 1.7 new /var/tmp"
56./1.7.exp $OVERLAY $CHROOT 53./1.7.exp "$OVERLAY" "$CHROOT"
57 54
58echo "TESTING: 1.8 disable firejail config and run time information" 55echo "TESTING: 1.8 disable firejail config and run time information"
59./1.8.exp $OVERLAY $CHROOT 56./1.8.exp "$OVERLAY" "$CHROOT"
60 57
61echo "TESTING: 1.10 disable /selinux" 58echo "TESTING: 1.10 disable /selinux"
62./1.10.exp $OVERLAY $CHROOT 59./1.10.exp "$OVERLAY" "$CHROOT"
63 60
64#################### 61####################
65# networking features 62# networking features
66#################### 63####################
67if [ $NETWORK == "network" ] 64if [[ $NETWORK == "network" ]]
68then 65then
69 echo "TESTING: 2.1 hostname" 66 echo "TESTING: 2.1 hostname"
70 ./2.1.exp $OVERLAY $CHROOT 67 ./2.1.exp "$OVERLAY" "$CHROOT"
71 68
72 echo "TESTING: 2.2 DNS" 69 echo "TESTING: 2.2 DNS"
73 ./2.2.exp $OVERLAY $CHROOT 70 ./2.2.exp "$OVERLAY" "$CHROOT"
74 71
75 echo "TESTING: 2.3 mac-vlan" 72 echo "TESTING: 2.3 mac-vlan"
76 ./2.3.exp $OVERLAY $CHROOT 73 ./2.3.exp "$OVERLAY" "$CHROOT"
77 74
78 echo "TESTING: 2.4 bridge" 75 echo "TESTING: 2.4 bridge"
79 ./2.4.exp $OVERLAY $CHROOT 76 ./2.4.exp "$OVERLAY" "$CHROOT"
80 77
81 echo "TESTING: 2.5 interface" 78 echo "TESTING: 2.5 interface"
82 ./2.5.exp $OVERLAY $CHROOT 79 ./2.5.exp "$OVERLAY" "$CHROOT"
83 80
84 echo "TESTING: 2.6 Default gateway" 81 echo "TESTING: 2.6 Default gateway"
85 ./2.6.exp $OVERLAY $CHROOT 82 ./2.6.exp "$OVERLAY" "$CHROOT"
86fi 83fi
87 84
88#################### 85####################
89# filesystem features 86# filesystem features
90#################### 87####################
91echo "TESTING: 3.1 private (fails on OpenSUSE)" 88echo "TESTING: 3.1 private (fails on OpenSUSE)"
92./3.1.exp $OVERLAY $CHROOT 89./3.1.exp "$OVERLAY" "$CHROOT"
93 90
94echo "TESTING: 3.2 read-only" 91echo "TESTING: 3.2 read-only"
95./3.2.exp $OVERLAY $CHROOT 92./3.2.exp "$OVERLAY" "$CHROOT"
96 93
97echo "TESTING: 3.3 blacklist" 94echo "TESTING: 3.3 blacklist"
98./3.3.exp $OVERLAY $CHROOT 95./3.3.exp "$OVERLAY" "$CHROOT"
99 96
100echo "TESTING: 3.4 whitelist home (fails on OpenSUSE)" 97echo "TESTING: 3.4 whitelist home (fails on OpenSUSE)"
101./3.4.exp $OVERLAY $CHROOT 98./3.4.exp "$OVERLAY" "$CHROOT"
102 99
103echo "TESTING: 3.5 private-dev" 100echo "TESTING: 3.5 private-dev"
104./3.5.exp $OVERLAY $CHROOT 101./3.5.exp "$OVERLAY" "$CHROOT"
105 102
106echo "TESTING: 3.6 private-etc" 103echo "TESTING: 3.6 private-etc"
107./3.6.exp notworking $CHROOT 104./3.6.exp notworking "$CHROOT"
108 105
109echo "TESTING: 3.7 private-tmp" 106echo "TESTING: 3.7 private-tmp"
110./3.7.exp $OVERLAY $CHROOT 107./3.7.exp "$OVERLAY" "$CHROOT"
111 108
112echo "TESTING: 3.8 private-bin" 109echo "TESTING: 3.8 private-bin"
113./3.8.exp notworking notworking 110./3.8.exp notworking notworking
114 111
115echo "TESTING: 3.9 whitelist dev" 112echo "TESTING: 3.9 whitelist dev"
116./3.9.exp $OVERLAY $CHROOT 113./3.9.exp "$OVERLAY" "$CHROOT"
117 114
118echo "TESTING: 3.10 whitelist tmp" 115echo "TESTING: 3.10 whitelist tmp"
119./3.10.exp $OVERLAY $CHROOT 116./3.10.exp "$OVERLAY" "$CHROOT"
120 117
121echo "TESTING: 3.11 mkdir" 118echo "TESTING: 3.11 mkdir"
122./3.11.exp $OVERLAY $CHROOT 119./3.11.exp "$OVERLAY" "$CHROOT"
diff --git a/test/filters/filters.sh b/test/filters/filters.sh
index 04d7080d6..3b4a6b492 100755
--- a/test/filters/filters.sh
+++ b/test/filters/filters.sh
@@ -7,37 +7,37 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10if [ -f /etc/debian_version ]; then 10if [[ -f /etc/debian_version ]]; then
11 libdir=$(dirname "$(dpkg -L firejail | grep fseccomp)") 11 libdir=$(dirname "$(dpkg -L firejail | grep fseccomp)")
12 export PATH="$PATH:$libdir" 12 export PATH="$PATH:$libdir"
13fi 13fi
14export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" 14export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail"
15 15
16if [ -f /sys/kernel/security/apparmor/profiles ]; then 16if [[ -f /sys/kernel/security/apparmor/profiles ]]; then
17 echo "TESTING: apparmor (test/filters/apparmor.exp)" 17 echo "TESTING: apparmor (test/filters/apparmor.exp)"
18 ./apparmor.exp 18 ./apparmor.exp
19else 19else
20 echo "TESTING SKIP: no apparmor support in Linux kernel (test/filters/apparmor.exp)" 20 echo "TESTING SKIP: no apparmor support in Linux kernel (test/filters/apparmor.exp)"
21fi 21fi
22 22
23if [ "$(uname -m)" = "x86_64" ]; then 23if [[ $(uname -m) == "x86_64" ]]; then
24 echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)" 24 echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)"
25 ./memwrexe.exp 25 ./memwrexe.exp
26elif [ "$(uname -m)" = "i686" ]; then 26elif [[ $(uname -m) == "i686" ]]; then
27 echo "TESTING: memory-deny-write-execute (test/filters/memwrexe-32.exp)" 27 echo "TESTING: memory-deny-write-execute (test/filters/memwrexe-32.exp)"
28 ./memwrexe-32.exp 28 ./memwrexe-32.exp
29else 29else
30 echo "TESTING SKIP: memwrexe binary only running on x86_64 and i686." 30 echo "TESTING SKIP: memwrexe binary only running on x86_64 and i686."
31fi 31fi
32 32
33echo "TESTING: debug options (test/filters/debug.exp)" 33echo "TESTING: debug options (test/filters/debug.exp)"
34./debug.exp 34./debug.exp
35 35
36if [ "$(uname -m)" = "x86_64" ]; then 36if [[ $(uname -m) == "x86_64" ]]; then
37 echo "TESTING: seccomp run files (test/filters/seccomp-run-files.exp)" 37 echo "TESTING: seccomp run files (test/filters/seccomp-run-files.exp)"
38 ./seccomp-run-files.exp 38 ./seccomp-run-files.exp
39else 39else
40 echo "TESTING SKIP: seccomp-run-files test implemented only for x86_64." 40 echo "TESTING SKIP: seccomp-run-files test implemented only for x86_64."
41fi 41fi
42 42
43echo "TESTING: seccomp postexec (test/filters/seccomp-postexec.exp)" 43echo "TESTING: seccomp postexec (test/filters/seccomp-postexec.exp)"
@@ -61,33 +61,33 @@ echo "TESTING: capabilities join (test/filters/caps-join.exp)"
61./caps-join.exp 61./caps-join.exp
62 62
63rm -f seccomp-test-file 63rm -f seccomp-test-file
64if [ "$(uname -m)" = "x86_64" ]; then 64if [[ $(uname -m) == "x86_64" ]]; then
65 echo "TESTING: fseccomp (test/filters/fseccomp.exp)" 65 echo "TESTING: fseccomp (test/filters/fseccomp.exp)"
66 ./fseccomp.exp 66 ./fseccomp.exp
67else 67else
68 echo "TESTING SKIP: fseccomp test implemented only for x86_64" 68 echo "TESTING SKIP: fseccomp test implemented only for x86_64"
69fi 69fi
70rm -f seccomp-test-file 70rm -f seccomp-test-file
71 71
72 72
73if [ "$(uname -m)" = "x86_64" ]; then 73if [[ $(uname -m) == "x86_64" ]]; then
74 echo "TESTING: protocol (test/filters/protocol.exp)" 74 echo "TESTING: protocol (test/filters/protocol.exp)"
75 ./protocol.exp 75 ./protocol.exp
76else 76else
77 echo "TESTING SKIP: protocol, running only on x86_64" 77 echo "TESTING SKIP: protocol, running only on x86_64"
78fi 78fi
79 79
80echo "TESTING: seccomp bad empty (test/filters/seccomp-bad-empty.exp)" 80echo "TESTING: seccomp bad empty (test/filters/seccomp-bad-empty.exp)"
81./seccomp-bad-empty.exp 81./seccomp-bad-empty.exp
82 82
83if [ "$(uname -m)" = "x86_64" ]; then 83if [[ $(uname -m) == "x86_64" ]]; then
84 echo "TESTING: seccomp debug (test/filters/seccomp-debug.exp)" 84 echo "TESTING: seccomp debug (test/filters/seccomp-debug.exp)"
85 ./seccomp-debug.exp 85 ./seccomp-debug.exp
86elif [ "$(uname -m)" = "i686" ]; then 86elif [[ $(uname -m) == "i686" ]]; then
87 echo "TESTING: seccomp debug (test/filters/seccomp-debug-32.exp)" 87 echo "TESTING: seccomp debug (test/filters/seccomp-debug-32.exp)"
88 ./seccomp-debug-32.exp 88 ./seccomp-debug-32.exp
89else 89else
90 echo "TESTING SKIP: protocol, running only on x86_64 and i686" 90 echo "TESTING SKIP: protocol, running only on x86_64 and i686"
91fi 91fi
92 92
93echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)" 93echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)"
@@ -96,12 +96,11 @@ echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)"
96echo "TESTING: seccomp su (test/filters/seccomp-su.exp)" 96echo "TESTING: seccomp su (test/filters/seccomp-su.exp)"
97./seccomp-su.exp 97./seccomp-su.exp
98 98
99which strace 2>/dev/null 99if command -v strace; then
100if [ $? -eq 0 ]; then 100 echo "TESTING: seccomp ptrace (test/filters/seccomp-ptrace.exp)"
101 echo "TESTING: seccomp ptrace (test/filters/seccomp-ptrace.exp)" 101 ./seccomp-ptrace.exp
102 ./seccomp-ptrace.exp
103else 102else
104 echo "TESTING SKIP: ptrace, strace not found" 103 echo "TESTING SKIP: ptrace, strace not found"
105fi 104fi
106 105
107echo "TESTING: seccomp chmod - seccomp lists (test/filters/seccomp-chmod.exp)" 106echo "TESTING: seccomp chmod - seccomp lists (test/filters/seccomp-chmod.exp)"
@@ -115,16 +114,16 @@ echo "TESTING: seccomp chmod profile - seccomp lists (test/filters/seccomp-chmod
115echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)" 114echo "TESTING: seccomp empty (test/filters/seccomp-empty.exp)"
116./seccomp-empty.exp 115./seccomp-empty.exp
117 116
118if [ "$(uname -m)" = "x86_64" ]; then 117if [[ $(uname -m) == "x86_64" ]]; then
119 echo "TESTING: seccomp numeric (test/filters/seccomp-numeric.exp)" 118 echo "TESTING: seccomp numeric (test/filters/seccomp-numeric.exp)"
120 ./seccomp-numeric.exp 119 ./seccomp-numeric.exp
121else 120else
122 echo "TESTING SKIP: seccomp numeric test implemented only for x86_64" 121 echo "TESTING SKIP: seccomp numeric test implemented only for x86_64"
123fi 122fi
124 123
125if [ "$(uname -m)" = "x86_64" ]; then 124if [[ $(uname -m) == "x86_64" ]]; then
126 echo "TESTING: seccomp join (test/filters/seccomp-join.exp)" 125 echo "TESTING: seccomp join (test/filters/seccomp-join.exp)"
127 ./seccomp-join.exp 126 ./seccomp-join.exp
128else 127else
129 echo "TESTING SKIP: seccomp join test implemented only for x86_64" 128 echo "TESTING SKIP: seccomp join test implemented only for x86_64"
130fi 129fi
diff --git a/test/fnetfilter/fnetfilter.sh b/test/fnetfilter/fnetfilter.sh
index 9ad822753..52f921232 100755
--- a/test/fnetfilter/fnetfilter.sh
+++ b/test/fnetfilter/fnetfilter.sh
@@ -7,7 +7,7 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10if [ -f /etc/debian_version ]; then 10if [[ -f /etc/debian_version ]]; then
11 libdir=$(dirname "$(dpkg -L firejail | grep fcopy)") 11 libdir=$(dirname "$(dpkg -L firejail | grep fcopy)")
12 export PATH="$PATH:$libdir" 12 export PATH="$PATH:$libdir"
13fi 13fi
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index 36ff30934..697c86d3d 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -34,7 +34,7 @@ rm -f ~/_firejail_test_dir
34echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" 34echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)"
35./sys_fs.exp 35./sys_fs.exp
36 36
37if [ -c /dev/kmsg ]; then 37if [[ -c /dev/kmsg ]]; then
38 echo "TESTING: kmsg access (test/fs/kmsg.exp)" 38 echo "TESTING: kmsg access (test/fs/kmsg.exp)"
39 ./kmsg.exp 39 ./kmsg.exp
40else 40else
@@ -45,27 +45,27 @@ echo "TESTING: read/write /var/tmp (test/fs/fs_var_tmp.exp)"
45./fs_var_tmp.exp 45./fs_var_tmp.exp
46rm -f /var/tmp/_firejail_test_file 46rm -f /var/tmp/_firejail_test_file
47 47
48if [ "$(uname -m)" = "x86_64" ]; then 48if [[ $(uname -m) == "x86_64" ]]; then
49 fjconfig=/etc/firejail/firejail.config 49 fjconfig=/etc/firejail/firejail.config
50 printf 'private-lib yes\n' | sudo tee -a "$fjconfig" >/dev/null 50 printf 'private-lib yes\n' | sudo tee -a "$fjconfig" >/dev/null
51 echo "TESTING: private-lib (test/fs/private-lib.exp)" 51 echo "TESTING: private-lib (test/fs/private-lib.exp)"
52 ./private-lib.exp 52 ./private-lib.exp
53 printf '%s\n' "$(sed '/^private-lib yes$/d' "$fjconfig")" | 53 printf '%s\n' "$(sed '/^private-lib yes$/d' "$fjconfig")" |
54 sudo tee "$fjconfig" >/dev/null 54 sudo tee "$fjconfig" >/dev/null
55else 55else
56 echo "TESTING SKIP: private-lib test implemented only for x86_64." 56 echo "TESTING SKIP: private-lib test implemented only for x86_64."
57fi 57fi
58 58
59echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)" 59echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)"
60./fs_var_lock.exp 60./fs_var_lock.exp
61rm -f /var/lock/_firejail_test_file 61rm -f /var/lock/_firejail_test_file
62 62
63if [ -w /dev/shm ]; then 63if [[ -w /dev/shm ]]; then
64 echo "TESTING: read/write /dev/shm (test/fs/fs_dev_shm.exp)" 64 echo "TESTING: read/write /dev/shm (test/fs/fs_dev_shm.exp)"
65 ./fs_dev_shm.exp 65 ./fs_dev_shm.exp
66 rm -f /dev/shm/_firejail_test_file 66 rm -f /dev/shm/_firejail_test_file
67else 67else
68 echo "TESTING SKIP: /dev/shm not writable" 68 echo "TESTING SKIP: /dev/shm not writable"
69fi 69fi
70 70
71echo "TESTING: private (test/fs/private.exp)" 71echo "TESTING: private (test/fs/private.exp)"
diff --git a/test/overlay/overlay.sh b/test/overlay/overlay.sh
index 490b180e1..a0519d1ad 100755
--- a/test/overlay/overlay.sh
+++ b/test/overlay/overlay.sh
@@ -22,8 +22,7 @@ rm -fr ~/_firejail_test_*
22./fs-tmpfs.exp 22./fs-tmpfs.exp
23rm -fr ~/_firejail_test_* 23rm -fr ~/_firejail_test_*
24 24
25which firefox 2>/dev/null 25if command -v firefox
26if [ "$?" -eq 0 ];
27then 26then
28 echo "TESTING: overlay firefox" 27 echo "TESTING: overlay firefox"
29 ./firefox.exp 28 ./firefox.exp
@@ -31,8 +30,7 @@ else
31 echo "TESTING SKIP: firefox not found" 30 echo "TESTING SKIP: firefox not found"
32fi 31fi
33 32
34which firefox 2>/dev/null 33if command -v firefox
35if [ "$?" -eq 0 ];
36then 34then
37 echo "TESTING: overlay firefox x11 xorg" 35 echo "TESTING: overlay firefox x11 xorg"
38 ./firefox.exp 36 ./firefox.exp
@@ -40,26 +38,22 @@ else
40 echo "TESTING SKIP: firefox not found" 38 echo "TESTING SKIP: firefox not found"
41fi 39fi
42 40
43
44# check xpra/xephyr 41# check xpra/xephyr
45which xpra 2>/dev/null 42if command -v xpra
46if [ "$?" -eq 0 ];
47then 43then
48 echo "xpra found" 44 echo "xpra found"
49else 45else
50 echo "xpra not found" 46 echo "xpra not found"
51 which Xephyr 2>/dev/null 47 if command -v Xephyr
52 if [ "$?" -eq 0 ];
53 then 48 then
54 echo "Xephyr found" 49 echo "Xephyr found"
55 else 50 else
56 echo "TESTING SKIP: xpra and/or Xephyr not found" 51 echo "TESTING SKIP: xpra and/or Xephyr not found"
57 exit 52 exit
58 fi 53 fi
59fi 54fi
60 55
61which firefox 2>/dev/null 56if command -v firefox
62if [ "$?" -eq 0 ];
63then 57then
64 echo "TESTING: overlay firefox x11" 58 echo "TESTING: overlay firefox x11"
65 ./firefox-x11.exp 59 ./firefox-x11.exp
diff --git a/test/private-lib/private-lib.sh b/test/private-lib/private-lib.sh
index d168c2b1b..6b7d433c8 100755
--- a/test/private-lib/private-lib.sh
+++ b/test/private-lib/private-lib.sh
@@ -7,12 +7,10 @@ export MALLOC_CHECK_=3g
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10LIST="gnome-logs gnome-system-log gnome-nettool pavucontrol dig evince whois galculator gnome-calculator gedit leafpad mousepad pluma transmission-gtk xcalc atril gpicview eom eog" 10apps=(gnome-logs gnome-system-log gnome-nettool pavucontrol dig evince whois galculator gnome-calculator gedit leafpad mousepad pluma transmission-gtk xcalc atril gpicview eom eog)
11 11
12 12for app in "${apps[@]}"; do
13for app in $LIST; do 13 if command -v "$app"
14 which $app 2>/dev/null
15 if [ "$?" -eq 0 ];
16 then 14 then
17 echo "TESTING: private-lib $app" 15 echo "TESTING: private-lib $app"
18 ./$app.exp 16 ./$app.exp
diff --git a/test/profiles/all-profiles.sh b/test/profiles/all-profiles.sh
index cc17b6b00..a550afe23 100755
--- a/test/profiles/all-profiles.sh
+++ b/test/profiles/all-profiles.sh
@@ -37,11 +37,11 @@ echo "TESTING: profile read-only links (test/profiles/profile_readonly.exp)"
37echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)" 37echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)"
38./profile_noperm.exp 38./profile_noperm.exp
39 39
40PROFILES=`ls /etc/firejail/*.profile` 40profiles=( /etc/firejail/*.profile )
41echo "TESTING: default profiles installed in /etc" 41echo "TESTING: default profiles installed in /etc"
42 42
43for PROFILE in $PROFILES 43for profile in "${profiles[@]}"
44do 44do
45 echo "TESTING: $PROFILE" 45 echo "TESTING: $profile"
46 ./test-profile.exp $PROFILE 46 ./test-profile.exp "$profile"
47done 47done
diff --git a/test/profiles/profiles.sh b/test/profiles/profiles.sh
index 8808bc9d2..90c88aaf5 100755
--- a/test/profiles/profiles.sh
+++ b/test/profiles/profiles.sh
@@ -37,11 +37,11 @@ echo "TESTING: profile read-only links (test/profiles/profile_readonly.exp)"
37echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)" 37echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)"
38./profile_noperm.exp 38./profile_noperm.exp
39 39
40PROFILES=`ls /etc/firejail/transmission*.profile /etc/firejail/fi*.profile /etc/firejail/fl*.profile /etc/firejail/free*.profile` 40profiles=( /etc/firejail/transmission*.profile /etc/firejail/fi*.profile /etc/firejail/fl*.profile /etc/firejail/free*.profile )
41echo "TESTING: small number of default profiles installed in /etc" 41echo "TESTING: small number of default profiles installed in /etc"
42 42
43for PROFILE in $PROFILES 43for profile in "${profiles[@]}"
44do 44do
45 echo "TESTING: $PROFILE" 45 echo "TESTING: $profile"
46 ./test-profile.exp $PROFILE 46 ./test-profile.exp "$profile"
47done 47done
diff --git a/test/root/root.sh b/test/root/root.sh
index e8c0ec1ac..a39525b6e 100755
--- a/test/root/root.sh
+++ b/test/root/root.sh
@@ -11,8 +11,7 @@ export LC_ALL=C
11#******************************** 11#********************************
12# firecfg 12# firecfg
13#******************************** 13#********************************
14which less 2>/dev/null 14if command -v less
15if [ "$?" -eq 0 ];
16then 15then
17 echo "TESTING: firecfg (test/root/firecfg.exp)" 16 echo "TESTING: firecfg (test/root/firecfg.exp)"
18 mv /home/netblue/.local/share/applications /home/netblue/.local/share/applications-store 17 mv /home/netblue/.local/share/applications /home/netblue/.local/share/applications-store
@@ -25,24 +24,24 @@ fi
25#******************************** 24#********************************
26# servers 25# servers
27#******************************** 26#********************************
28if [ -f /etc/init.d/snmpd ] 27if [[ -f /etc/init.d/snmpd ]]
29then 28then
30 echo "TESTING: snmpd (test/root/snmpd.exp)" 29 echo "TESTING: snmpd (test/root/snmpd.exp)"
31 ./snmpd.exp 30 ./snmpd.exp
32else 31else
33 echo "TESTING SKIP: snmpd not found" 32 echo "TESTING SKIP: snmpd not found"
34fi 33fi
35 34
36 35
37if [ -f /etc/init.d/apache2 ] 36if [[ -f /etc/init.d/apache2 ]]
38then 37then
39 echo "TESTING: apache2 (test/root/apache2.exp)" 38 echo "TESTING: apache2 (test/root/apache2.exp)"
40 ./apache2.exp 39 ./apache2.exp
41else 40else
42 echo "TESTING SKIP: apache2 not found" 41 echo "TESTING SKIP: apache2 not found"
43fi 42fi
44 43
45if [ -f /etc/init.d/isc-dhcp-server ] 44if [[ -f /etc/init.d/isc-dhcp-server ]]
46then 45then
47 echo "TESTING: isc dhcp server (test/root/isc-dhscp.exp)" 46 echo "TESTING: isc dhcp server (test/root/isc-dhscp.exp)"
48 ./isc-dhcp.exp 47 ./isc-dhcp.exp
@@ -50,20 +49,20 @@ else
50 echo "TESTING SKIP: isc dhcp server not found" 49 echo "TESTING SKIP: isc dhcp server not found"
51fi 50fi
52 51
53if [ -f /etc/init.d/unbound ] 52if [[ -f /etc/init.d/unbound ]]
54then 53then
55 echo "TESTING: unbound (test/root/unbound.exp)" 54 echo "TESTING: unbound (test/root/unbound.exp)"
56 ./unbound.exp 55 ./unbound.exp
57else 56else
58 echo "TESTING SKIP: unbound not found" 57 echo "TESTING SKIP: unbound not found"
59fi 58fi
60 59
61if [ -f /etc/init.d/nginx ] 60if [[ -f /etc/init.d/nginx ]]
62then 61then
63 echo "TESTING: nginx (test/root/nginx.exp)" 62 echo "TESTING: nginx (test/root/nginx.exp)"
64 ./nginx.exp 63 ./nginx.exp
65else 64else
66 echo "TESTING SKIP: nginx not found" 65 echo "TESTING SKIP: nginx not found"
67fi 66fi
68 67
69#******************************** 68#********************************
diff --git a/test/stress/stress.sh b/test/stress/stress.sh
index 675cb0614..2b4d8147d 100755
--- a/test/stress/stress.sh
+++ b/test/stress/stress.sh
@@ -14,7 +14,7 @@ mkdir ~/fj-stress-test
14rm blacklist.profile 14rm blacklist.profile
15rm noblacklist.profile 15rm noblacklist.profile
16rm env.profile 16rm env.profile
17for i in `seq 1 100`; 17for i in {1..100}
18do 18do
19 echo "hello" > ~/fj-stress-test/testfile$i 19 echo "hello" > ~/fj-stress-test/testfile$i
20 echo "blacklist ~/fj-stress-test/testfile$i" >> blacklist.profile 20 echo "blacklist ~/fj-stress-test/testfile$i" >> blacklist.profile
diff --git a/test/sysutils/sysutils.sh b/test/sysutils/sysutils.sh
index a903c7c6b..bfe723047 100755
--- a/test/sysutils/sysutils.sh
+++ b/test/sysutils/sysutils.sh
@@ -7,8 +7,7 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10which cpio 2>/dev/null 10if command -v cpio
11if [ "$?" -eq 0 ];
12then 11then
13 echo "TESTING: cpio" 12 echo "TESTING: cpio"
14 ./cpio.exp 13 ./cpio.exp
@@ -16,8 +15,7 @@ else
16 echo "TESTING SKIP: cpio not found" 15 echo "TESTING SKIP: cpio not found"
17fi 16fi
18 17
19#which strings 18#if command -v strings
20#if [ "$?" -eq 0 ];
21#then 19#then
22# echo "TESTING: strings" 20# echo "TESTING: strings"
23# ./strings.exp 21# ./strings.exp
@@ -25,8 +23,7 @@ fi
25# echo "TESTING SKIP: strings not found" 23# echo "TESTING SKIP: strings not found"
26#fi 24#fi
27 25
28which gzip 2>/dev/null 26if command -v gzip
29if [ "$?" -eq 0 ];
30then 27then
31 echo "TESTING: gzip" 28 echo "TESTING: gzip"
32 ./gzip.exp 29 ./gzip.exp
@@ -34,8 +31,7 @@ else
34 echo "TESTING SKIP: gzip not found" 31 echo "TESTING SKIP: gzip not found"
35fi 32fi
36 33
37which xzdec 2>/dev/null 34if command -v xzdec
38if [ "$?" -eq 0 ];
39then 35then
40 echo "TESTING: xzdec" 36 echo "TESTING: xzdec"
41 ./xzdec.exp 37 ./xzdec.exp
@@ -43,8 +39,7 @@ else
43 echo "TESTING SKIP: xzdec not found" 39 echo "TESTING SKIP: xzdec not found"
44fi 40fi
45 41
46which xz 2>/dev/null 42if command -v xz
47if [ "$?" -eq 0 ];
48then 43then
49 echo "TESTING: xz" 44 echo "TESTING: xz"
50 ./xz.exp 45 ./xz.exp
@@ -52,8 +47,7 @@ else
52 echo "TESTING SKIP: xz not found" 47 echo "TESTING SKIP: xz not found"
53fi 48fi
54 49
55which less 2>/dev/null 50if command -v less
56if [ "$?" -eq 0 ];
57then 51then
58 echo "TESTING: less" 52 echo "TESTING: less"
59 ./less.exp 53 ./less.exp
@@ -61,8 +55,7 @@ else
61 echo "TESTING SKIP: less not found" 55 echo "TESTING SKIP: less not found"
62fi 56fi
63 57
64which file 2>/dev/null 58if command -v file
65if [ "$?" -eq 0 ];
66then 59then
67 echo "TESTING: file" 60 echo "TESTING: file"
68 ./file.exp 61 ./file.exp
@@ -70,8 +63,7 @@ else
70 echo "TESTING SKIP: file not found" 63 echo "TESTING SKIP: file not found"
71fi 64fi
72 65
73which tar 2>/dev/null 66if command -v tar
74if [ "$?" -eq 0 ];
75then 67then
76 echo "TESTING: tar" 68 echo "TESTING: tar"
77 ./tar.exp 69 ./tar.exp
@@ -79,8 +71,7 @@ else
79 echo "TESTING SKIP: tar not found" 71 echo "TESTING SKIP: tar not found"
80fi 72fi
81 73
82which ping 2>/dev/null 74if command -v ping
83if [ "$?" -eq 0 ];
84then 75then
85 echo "TESTING: ping" 76 echo "TESTING: ping"
86 ./ping.exp 77 ./ping.exp
diff --git a/test/utils/catchsignal.sh b/test/utils/catchsignal.sh
index 117179143..cef00b2a5 100755
--- a/test/utils/catchsignal.sh
+++ b/test/utils/catchsignal.sh
@@ -4,20 +4,20 @@
4# License GPL v2 4# License GPL v2
5 5
6_term() { 6_term() {
7 echo "Caught Signal" 7 echo "Caught Signal"
8 echo 1 8 echo 1
9 sleep 1 9 sleep 1
10 echo 2 10 echo 2
11 sleep 1 11 sleep 1
12 echo 3 12 echo 3
13 sleep 1 13 sleep 1
14 echo 4 14 echo 4
15 sleep 1 15 sleep 1
16 echo 5 16 echo 5
17 sleep 1 17 sleep 1
18 18
19 kill $pid 19 kill $pid
20 exit 20 exit
21} 21}
22 22
23trap _term SIGTERM 23trap _term SIGTERM
diff --git a/test/utils/catchsignal2.sh b/test/utils/catchsignal2.sh
index 1bd7852cd..21f299430 100755
--- a/test/utils/catchsignal2.sh
+++ b/test/utils/catchsignal2.sh
@@ -4,42 +4,42 @@
4# License GPL v2 4# License GPL v2
5 5
6_term() { 6_term() {
7 echo "Caught Signal" 7 echo "Caught Signal"
8 echo 1 8 echo 1
9 sleep 1 9 sleep 1
10 echo 2 10 echo 2
11 sleep 1 11 sleep 1
12 echo 3 12 echo 3
13 sleep 1 13 sleep 1
14 echo 4 14 echo 4
15 sleep 1 15 sleep 1
16 echo 5 16 echo 5
17 sleep 1 17 sleep 1
18 18
19 echo 10 19 echo 10
20 sleep 1 20 sleep 1
21 echo 20 21 echo 20
22 sleep 1 22 sleep 1
23 echo 30 23 echo 30
24 sleep 1 24 sleep 1
25 echo 40 25 echo 40
26 sleep 1 26 sleep 1
27 echo 50 27 echo 50
28 sleep 1 28 sleep 1
29 29
30 echo 100 30 echo 100
31 sleep 1 31 sleep 1
32 echo 200 32 echo 200
33 sleep 1 33 sleep 1
34 echo 300 34 echo 300
35 sleep 1 35 sleep 1
36 echo 400 36 echo 400
37 sleep 1 37 sleep 1
38 echo 500 38 echo 500
39 sleep 1 39 sleep 1
40 40
41 kill $pid 41 kill $pid
42 exit 42 exit
43} 43}
44 44
45trap _term SIGTERM 45trap _term SIGTERM
diff --git a/test/utils/utils.sh b/test/utils/utils.sh
index 102c8df17..647cbfb34 100755
--- a/test/utils/utils.sh
+++ b/test/utils/utils.sh
@@ -7,7 +7,7 @@ export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8export LC_ALL=C 8export LC_ALL=C
9 9
10if [ -f /etc/debian_version ]; then 10if [[ -f /etc/debian_version ]]; then
11 libdir=$(dirname "$(dpkg -L firejail | grep fcopy)") 11 libdir=$(dirname "$(dpkg -L firejail | grep fcopy)")
12 export PATH="$PATH:$libdir" 12 export PATH="$PATH:$libdir"
13fi 13fi
@@ -33,13 +33,12 @@ echo "TESTING: version (test/utils/version.exp)"
33echo "TESTING: help (test/utils/help.exp)" 33echo "TESTING: help (test/utils/help.exp)"
34./help.exp 34./help.exp
35 35
36which man 2>/dev/null 36if command -v man
37if [ "$?" -eq 0 ];
38then 37then
39 echo "TESTING: man (test/utils/man.exp)" 38 echo "TESTING: man (test/utils/man.exp)"
40 ./man.exp 39 ./man.exp
41else 40else
42 echo "TESTING SKIP: man not found" 41 echo "TESTING SKIP: man not found"
43fi 42fi
44 43
45echo "TESTING: list (test/utils/list.exp)" 44echo "TESTING: list (test/utils/list.exp)"
@@ -48,12 +47,12 @@ echo "TESTING: list (test/utils/list.exp)"
48echo "TESTING: tree (test/utils/tree.exp)" 47echo "TESTING: tree (test/utils/tree.exp)"
49./tree.exp 48./tree.exp
50 49
51if [ $(grep -c ^processor /proc/cpuinfo) -gt 1 ]; 50if [[ $(grep -c ^processor /proc/cpuinfo) -gt 1 ]]
52then 51then
53 echo "TESTING: cpu.print (test/utils/cpu-print.exp)" 52 echo "TESTING: cpu.print (test/utils/cpu-print.exp)"
54 ./cpu-print.exp 53 ./cpu-print.exp
55else 54else
56 echo "TESTING SKIP: cpu.print, not enough CPUs" 55 echo "TESTING SKIP: cpu.print, not enough CPUs"
57fi 56fi
58 57
59echo "TESTING: fs.print (test/utils/fs-print.exp)" 58echo "TESTING: fs.print (test/utils/fs-print.exp)"