aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README3
-rw-r--r--README.md3
-rw-r--r--RELNOTES2
-rw-r--r--etc/XMind.profile38
-rw-r--r--etc/android-studio.profile1
-rw-r--r--etc/anydesk.profile34
-rw-r--r--etc/baloo_filemetadata_temp_extractor.profile4
-rw-r--r--etc/disable-programs.inc4
-rw-r--r--etc/gajim.profile16
-rw-r--r--etc/kodi.profile2
-rw-r--r--etc/libreoffice.profile12
-rw-r--r--etc/rhythmbox.profile3
-rw-r--r--etc/vlc.profile2
-rw-r--r--etc/webstorm.profile36
-rw-r--r--platform/rpm/firejail.spec4
-rw-r--r--src/firecfg/firecfg.config8
-rw-r--r--src/firecfg/util.c12
-rw-r--r--src/firejail/firejail.h10
-rw-r--r--src/firejail/fs_bin.c8
-rw-r--r--src/firejail/fs_lib.c18
-rw-r--r--src/firejail/fs_whitelist.c19
-rw-r--r--src/firejail/util.c36
-rw-r--r--src/fldd/main.c6
-rw-r--r--src/lib/firejail_user.c3
-rwxr-xr-xtest/apps-x11-xorg/apps-x11-xorg.sh6
-rwxr-xr-xtest/apps-x11/apps-x11.sh18
-rwxr-xr-xtest/apps/apps.sh2
-rwxr-xr-xtest/arguments/arguments.sh4
-rwxr-xr-xtest/environment/environment.sh10
-rwxr-xr-xtest/fcopy/fcopy.sh2
-rwxr-xr-xtest/filters/filters.sh6
-rwxr-xr-xtest/fnetfilter/fnetfilter.sh2
-rwxr-xr-xtest/fs/invalid_filename.exp79
-rwxr-xr-xtest/overlay/overlay.sh10
-rwxr-xr-xtest/private-lib/gedit.exp83
-rwxr-xr-xtest/private-lib/pluma.exp83
-rwxr-xr-xtest/private-lib/private-lib.sh4
-rwxr-xr-xtest/root/root.sh2
-rwxr-xr-xtest/sysutils/sysutils.sh16
-rwxr-xr-xtest/utils/utils.sh4
40 files changed, 457 insertions, 158 deletions
diff --git a/README b/README
index b85aa0208..8cd2f6c7a 100644
--- a/README
+++ b/README
@@ -303,6 +303,9 @@ James Elford (https://github.com/jelford)
303 - blacklist sensitive cloud provider files in disable-common 303 - blacklist sensitive cloud provider files in disable-common
304Jean Lucas (https://github.com/flacks) 304Jean Lucas (https://github.com/flacks)
305 - fix Discord profile 305 - fix Discord profile
306 - add AnyDesk profile
307 - add WebStorm profile
308 - add XMind profile
306Jericho (https://github.com/attritionorg) 309Jericho (https://github.com/attritionorg)
307 - spelling 310 - spelling
308Jesse Smith (https://github.com/slicer69) 311Jesse Smith (https://github.com/slicer69)
diff --git a/README.md b/README.md
index e072231f4..2718c4d79 100644
--- a/README.md
+++ b/README.md
@@ -369,4 +369,5 @@ tilp, vivaldi-snapshot, bitcoin-qt, VS Code, falkon, gnome-builder, lobase, asun
369gnome-recipes, akonadi_control, evince-previewer, evince-thumbnailer, blender-2.8, 369gnome-recipes, akonadi_control, evince-previewer, evince-thumbnailer, blender-2.8,
370thunderbird-beta, ncdu, gnome-logs, gcloud, musixmatch, gunzip, bunzip2, enchant, 370thunderbird-beta, ncdu, gnome-logs, gcloud, musixmatch, gunzip, bunzip2, enchant,
371enchant-2, enchant-lsmod, enchant-lsmod-2, Discord, acat, adiff, als, apack, arepack, 371enchant-2, enchant-lsmod, enchant-lsmod-2, Discord, acat, adiff, als, apack, arepack,
372aunpack profiles, ppsspp, scallion, clion, baloo_filemetadata_temp_extractor 372aunpack profiles, ppsspp, scallion, clion, baloo_filemetadata_temp_extractor,
373AnyDesk, webstorm, xmind
diff --git a/RELNOTES b/RELNOTES
index 03e0bf41e..3d03e659c 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -43,7 +43,7 @@ firejail (0.9.53) baseline; urgency=low
43 * new profiles: musixmatch, gunzip, bunzip2, enchant-lsmod, enchant-lsmod-2, 43 * new profiles: musixmatch, gunzip, bunzip2, enchant-lsmod, enchant-lsmod-2,
44 * new profiles: enchant, enchant-2, Discord, acat, adiff, als, apack, 44 * new profiles: enchant, enchant-2, Discord, acat, adiff, als, apack,
45 * new profiles: arepack, aunpack profiles, ppsspp, scallion, clion, 45 * new profiles: arepack, aunpack profiles, ppsspp, scallion, clion,
46 * new profiles: baloo_filemetadata_temp_extractor 46 * new profiles: baloo_filemetadata_temp_extractor, AnyDesk, webstorm, xmind
47 -- netblue30 <netblue30@yahoo.com> Thu, 1 Mar 2018 08:00:00 -0500 47 -- netblue30 <netblue30@yahoo.com> Thu, 1 Mar 2018 08:00:00 -0500
48 48
49firejail (0.9.52) baseline; urgency=low 49firejail (0.9.52) baseline; urgency=low
diff --git a/etc/XMind.profile b/etc/XMind.profile
new file mode 100644
index 000000000..ff6258ca2
--- /dev/null
+++ b/etc/XMind.profile
@@ -0,0 +1,38 @@
1# Firejail profile for XMind
2# This file is overwritten after every install/update
3# Persistent local customizations
4include /etc/firejail/XMind.local
5# Persistent global definitions
6include /etc/firejail/globals.local
7
8noblacklist ${HOME}/.xmind
9
10include /etc/firejail/disable-common.inc
11include /etc/firejail/disable-devel.inc
12include /etc/firejail/disable-interpreters.inc
13include /etc/firejail/disable-passwdmgr.inc
14include /etc/firejail/disable-programs.inc
15
16mkdir ${HOME}/.xmind
17whitelist ${HOME}/.xmind
18whitelist ${DOWNLOADS}
19include /etc/firejail/whitelist-common.inc
20
21caps.drop all
22netfilter
23nodvd
24nogroups
25nonewprivs
26noroot
27notv
28protocol unix,inet,inet6
29seccomp
30shell none
31
32disable-mnt
33private-bin XMind,sh,cp
34private-tmp
35private-dev
36
37noexec ${HOME}
38noexec /tmp
diff --git a/etc/android-studio.profile b/etc/android-studio.profile
index b87635ce3..5ff0b7c3a 100644
--- a/etc/android-studio.profile
+++ b/etc/android-studio.profile
@@ -32,7 +32,6 @@ protocol unix,inet,inet6
32seccomp 32seccomp
33shell none 33shell none
34 34
35private-dev
36# private-tmp 35# private-tmp
37 36
38# noexec /tmp breaks 'Android Profiler' 37# noexec /tmp breaks 'Android Profiler'
diff --git a/etc/anydesk.profile b/etc/anydesk.profile
new file mode 100644
index 000000000..17e083f4e
--- /dev/null
+++ b/etc/anydesk.profile
@@ -0,0 +1,34 @@
1# Firejail profile for AnyDesk
2# This file is overwritten after every install/update
3# Persistent local customizations
4include /etc/firejail/anydesk.local
5# Persistent global definitions
6include /etc/firejail/globals.local
7
8noblacklist ${HOME}/.anydesk
9
10include /etc/firejail/disable-common.inc
11include /etc/firejail/disable-devel.inc
12include /etc/firejail/disable-passwdmgr.inc
13include /etc/firejail/disable-programs.inc
14include /etc/firejail/disable-interpreters.inc
15
16mkdir ${HOME}/.anydesk
17whitelist ${HOME}/.anydesk
18include /etc/firejail/whitelist-common.inc
19
20caps.drop all
21netfilter
22nodvd
23nogroups
24nonewprivs
25noroot
26notv
27protocol unix,inet,inet6
28seccomp
29shell none
30
31disable-mnt
32private-bin anydesk
33private-dev
34private-tmp
diff --git a/etc/baloo_filemetadata_temp_extractor.profile b/etc/baloo_filemetadata_temp_extractor.profile
index 6d09ecf40..87f2949e6 100644
--- a/etc/baloo_filemetadata_temp_extractor.profile
+++ b/etc/baloo_filemetadata_temp_extractor.profile
@@ -1,11 +1,13 @@
1# Firejail profile for baloo_filemetadata_temp_extractor 1# Firejail profile for baloo_filemetadata_temp_extractor
2# This file is overwritten after every install/update 2# This file is overwritten after every install/update
3# Persistent local customizations
4quiet 3quiet
4# Persistent local customizations
5include /etc/firejail/baloo_filemetadata_temp_extractor.local 5include /etc/firejail/baloo_filemetadata_temp_extractor.local
6# Persistent global definitions 6# Persistent global definitions
7include /etc/firejail/globals.local 7include /etc/firejail/globals.local
8 8
9ignore read-write
10read-only ${HOME}
9 11
10# Redirect 12# Redirect
11include /etc/firejail/baloo_file.profile 13include /etc/firejail/baloo_file.profile
diff --git a/etc/disable-programs.inc b/etc/disable-programs.inc
index d3dc87089..ea334c289 100644
--- a/etc/disable-programs.inc
+++ b/etc/disable-programs.inc
@@ -23,10 +23,12 @@ blacklist ${HOME}/.Steampid
23blacklist ${HOME}/.TelegramDesktop 23blacklist ${HOME}/.TelegramDesktop
24blacklist ${HOME}/.ViberPC 24blacklist ${HOME}/.ViberPC
25blacklist ${HOME}/.VirtualBox 25blacklist ${HOME}/.VirtualBox
26blacklist ${HOME}/.WebStorm*
26blacklist ${HOME}/.Wolfram Research 27blacklist ${HOME}/.Wolfram Research
27blacklist ${HOME}/.ZAP 28blacklist ${HOME}/.ZAP
28blacklist ${HOME}/.aMule 29blacklist ${HOME}/.aMule
29blacklist ${HOME}/.android 30blacklist ${HOME}/.android
31blacklist ${HOME}/.anydesk
30blacklist ${HOME}/.arduino15 32blacklist ${HOME}/.arduino15
31blacklist ${HOME}/.arm 33blacklist ${HOME}/.arm
32blacklist ${HOME}/.asunder_album_genre 34blacklist ${HOME}/.asunder_album_genre
@@ -346,7 +348,6 @@ blacklist ${HOME}/.kodi
346blacklist ${HOME}/.linphone-history.db 348blacklist ${HOME}/.linphone-history.db
347blacklist ${HOME}/.linphonerc 349blacklist ${HOME}/.linphonerc
348blacklist ${HOME}/.lmmsrc.xml 350blacklist ${HOME}/.lmmsrc.xml
349blacklist ${HOME}/.local/lib/python2.7/site-packages
350blacklist ${HOME}/.local/share/0ad 351blacklist ${HOME}/.local/share/0ad
351blacklist ${HOME}/.local/share/3909/PapersPlease 352blacklist ${HOME}/.local/share/3909/PapersPlease
352blacklist ${HOME}/.local/share/Empathy 353blacklist ${HOME}/.local/share/Empathy
@@ -504,6 +505,7 @@ blacklist ${HOME}/.wine
504blacklist ${HOME}/.wireshark 505blacklist ${HOME}/.wireshark
505blacklist ${HOME}/.wine64 506blacklist ${HOME}/.wine64
506blacklist ${HOME}/.xiphos 507blacklist ${HOME}/.xiphos
508blacklist ${HOME}/.xmind
507blacklist ${HOME}/.xmms 509blacklist ${HOME}/.xmms
508blacklist ${HOME}/.xmr-stak 510blacklist ${HOME}/.xmr-stak
509blacklist ${HOME}/.xonotic 511blacklist ${HOME}/.xonotic
diff --git a/etc/gajim.profile b/etc/gajim.profile
index 02c818443..8e76352f4 100644
--- a/etc/gajim.profile
+++ b/etc/gajim.profile
@@ -9,9 +9,9 @@ noblacklist ${HOME}/.cache/gajim
9noblacklist ${HOME}/.config/gajim 9noblacklist ${HOME}/.config/gajim
10noblacklist ${HOME}/.local/share/gajim 10noblacklist ${HOME}/.local/share/gajim
11 11
12# Allow python2.7 (blacklisted by disable-interpreters.inc) 12# Allow Python (blacklisted by disable-interpreters.inc)
13noblacklist ${PATH}/python2* 13noblacklist ${PATH}/python3*
14noblacklist /usr/lib/python2* 14noblacklist /usr/lib/python3*
15 15
16include /etc/firejail/disable-common.inc 16include /etc/firejail/disable-common.inc
17include /etc/firejail/disable-devel.inc 17include /etc/firejail/disable-devel.inc
@@ -21,12 +21,10 @@ include /etc/firejail/disable-programs.inc
21 21
22mkdir ${HOME}/.cache/gajim 22mkdir ${HOME}/.cache/gajim
23mkdir ${HOME}/.config/gajim 23mkdir ${HOME}/.config/gajim
24mkdir ${HOME}/.local/lib/python2.7/site-packages/
25mkdir ${HOME}/.local/share/gajim 24mkdir ${HOME}/.local/share/gajim
26mkdir ${HOME}/Downloads 25mkdir ${HOME}/Downloads
27whitelist ${HOME}/.cache/gajim 26whitelist ${HOME}/.cache/gajim
28whitelist ${HOME}/.config/gajim 27whitelist ${HOME}/.config/gajim
29whitelist ${HOME}/.local/lib/python2.7/site-packages/
30whitelist ${HOME}/.local/share/gajim 28whitelist ${HOME}/.local/share/gajim
31whitelist ${HOME}/Downloads 29whitelist ${HOME}/Downloads
32include /etc/firejail/whitelist-common.inc 30include /etc/firejail/whitelist-common.inc
@@ -43,9 +41,7 @@ seccomp
43shell none 41shell none
44 42
45disable-mnt 43disable-mnt
46private-bin python2.7,gajim 44private-bin python,gajim
47private-dev 45private-dev
48# private-etc fonts 46private-etc alsa,asound.conf,ca-certificates,crypto-policies,fonts,group,hostname,hosts,ld.so.cache,ld.so.conf,localtime,machine-id,passwd,pki,pulse,resolv.conf,ssl
49# private-tmp 47private-tmp
50# Allow the local python 2.7 site packages, in case any plugins are using these
51read-only ${HOME}/.local/lib/python2.7/site-packages/
diff --git a/etc/kodi.profile b/etc/kodi.profile
index 54d548291..85058da3e 100644
--- a/etc/kodi.profile
+++ b/etc/kodi.profile
@@ -19,6 +19,8 @@ include /etc/firejail/disable-interpreters.inc
19include /etc/firejail/disable-passwdmgr.inc 19include /etc/firejail/disable-passwdmgr.inc
20include /etc/firejail/disable-programs.inc 20include /etc/firejail/disable-programs.inc
21 21
22include /etc/firejail/whitelist-var-common.inc
23
22apparmor 24apparmor
23caps.drop all 25caps.drop all
24netfilter 26netfilter
diff --git a/etc/libreoffice.profile b/etc/libreoffice.profile
index 4b3eb1ac7..18fcc59c6 100644
--- a/etc/libreoffice.profile
+++ b/etc/libreoffice.profile
@@ -23,20 +23,22 @@ include /etc/firejail/disable-programs.inc
23 23
24include /etc/firejail/whitelist-var-common.inc 24include /etc/firejail/whitelist-var-common.inc
25 25
26apparmor 26# Ubuntu 18.04 uses its own apparmor profile
27# uncomment the next line if you are not on Ubuntu
28#apparmor
27caps.drop all 29caps.drop all
28machine-id 30machine-id
29netfilter 31netfilter
30nodbus 32nodbus
31nodvd 33nodvd
32nogroups 34nogroups
33nonewprivs 35#nonewprivs - fix for Ubuntu 18.04/Debian 10
34noroot 36noroot
35notv 37notv
36protocol unix,inet,inet6 38#protocol unix,inet,inet6 - fix for Ubuntu 18.04/Debian 10
37seccomp 39#seccomp - fix for Ubuntu 18.04/Debian 10
38shell none 40shell none
39tracelog 41#tracelog - problems reported by Ubuntu 18.04 apparmor profile in /var/log/syslog
40 42
41private-dev 43private-dev
42private-tmp 44private-tmp
diff --git a/etc/rhythmbox.profile b/etc/rhythmbox.profile
index 38ccb886f..57e1ce5f0 100644
--- a/etc/rhythmbox.profile
+++ b/etc/rhythmbox.profile
@@ -8,7 +8,8 @@ include /etc/firejail/globals.local
8 8
9include /etc/firejail/disable-common.inc 9include /etc/firejail/disable-common.inc
10include /etc/firejail/disable-devel.inc 10include /etc/firejail/disable-devel.inc
11include /etc/firejail/disable-interpreters.inc 11# rhythmbox is using Python
12#include /etc/firejail/disable-interpreters.inc
12include /etc/firejail/disable-passwdmgr.inc 13include /etc/firejail/disable-passwdmgr.inc
13include /etc/firejail/disable-programs.inc 14include /etc/firejail/disable-programs.inc
14 15
diff --git a/etc/vlc.profile b/etc/vlc.profile
index 6b0bee7bd..9ccbb7310 100644
--- a/etc/vlc.profile
+++ b/etc/vlc.profile
@@ -17,7 +17,7 @@ include /etc/firejail/disable-programs.inc
17 17
18include /etc/firejail/whitelist-var-common.inc 18include /etc/firejail/whitelist-var-common.inc
19 19
20apparmor 20#apparmor - on Ubuntu 18.04 it refuses to start without dbus access
21caps.drop all 21caps.drop all
22netfilter 22netfilter
23# nodbus - problems with KDE 23# nodbus - problems with KDE
diff --git a/etc/webstorm.profile b/etc/webstorm.profile
new file mode 100644
index 000000000..6da71224f
--- /dev/null
+++ b/etc/webstorm.profile
@@ -0,0 +1,36 @@
1# Firejail profile for WebStorm
2# This file is overwritten after every install/update
3# Persistent local customizations
4include /etc/firejail/webstorm.local
5# Persistent global definitions
6include /etc/firejail/globals.local
7
8noblacklist ${HOME}/.WebStorm*
9noblacklist ${HOME}/.gitconfig
10noblacklist ${HOME}/.java
11noblacklist ${HOME}/.local/share/JetBrains
12noblacklist ${HOME}/.ssh
13noblacklist ${HOME}/.tooling
14
15include /etc/firejail/disable-common.inc
16include /etc/firejail/disable-passwdmgr.inc
17include /etc/firejail/disable-programs.inc
18include /etc/firejail/disable-devel.inc
19include /etc/firejail/disable-interpreters.inc
20
21caps.drop all
22netfilter
23nodvd
24nogroups
25nonewprivs
26noroot
27notv
28novideo
29protocol unix,inet,inet6
30seccomp
31shell none
32
33private-dev
34# private-tmp
35
36noexec /tmp
diff --git a/platform/rpm/firejail.spec b/platform/rpm/firejail.spec
index 9fe35e528..76d19ba17 100644
--- a/platform/rpm/firejail.spec
+++ b/platform/rpm/firejail.spec
@@ -19,7 +19,7 @@ using Linux namespaces. It includes a sandbox profile for Mozilla Firefox.
19%setup -q 19%setup -q
20 20
21%build 21%build
22%configure --disable-userns 22%configure --disable-userns --disable-contrib-install
23make %{?_smp_mflags} 23make %{?_smp_mflags}
24 24
25%install 25%install
@@ -46,4 +46,4 @@ rm -rf %{buildroot}
46%{_mandir}/man5/__NAME__-login.5.gz 46%{_mandir}/man5/__NAME__-login.5.gz
47%{_mandir}/man5/__NAME__-profile.5.gz 47%{_mandir}/man5/__NAME__-profile.5.gz
48%{_mandir}/man5/__NAME__-users.5.gz 48%{_mandir}/man5/__NAME__-users.5.gz
49%config %{_sysconfdir}/__NAME__ 49%config(noreplace) %{_sysconfdir}/__NAME__
diff --git a/src/firecfg/firecfg.config b/src/firecfg/firecfg.config
index 1835502a4..da8937717 100644
--- a/src/firecfg/firecfg.config
+++ b/src/firecfg/firecfg.config
@@ -15,12 +15,14 @@ Viber
15VirtualBox 15VirtualBox
16Wire 16Wire
17Xephyr 17Xephyr
18XMind
18abrowser 19abrowser
19akonadi_control 20akonadi_control
20akregator 21akregator
21amarok 22amarok
22amule 23amule
23android-studio 24android-studio
25anydesk
24apktool 26apktool
25arch-audit 27arch-audit
26archaudit-report 28archaudit-report
@@ -273,7 +275,7 @@ musescore
273musixmatch 275musixmatch
274mutt 276mutt
275natron 277natron
276nautilus 278#nautilus - removed in order to let the application start in a new sandbox when clicking on icons in the file manager
277ncdu 279ncdu
278netsurf 280netsurf
279neverball 281neverball
@@ -298,7 +300,7 @@ pdftotext
298peek 300peek
299picard 301picard
300pidgin 302pidgin
301ping 303#ping - disabled until we fix #1912
302pingus 304pingus
303pinta 305pinta
304pithos 306pithos
@@ -331,6 +333,7 @@ ristretto
331rocketchat 333rocketchat
332rtorrent 334rtorrent
333runenpass.sh 335runenpass.sh
336scallion
334scribus 337scribus
335sdat2img 338sdat2img
336seamonkey 339seamonkey
@@ -410,6 +413,7 @@ vym
410w3m 413w3m
411warzone2100 414warzone2100
412waterfox 415waterfox
416webstorm
413weechat 417weechat
414weechat-curses 418weechat-curses
415wesnoth 419wesnoth
diff --git a/src/firecfg/util.c b/src/firecfg/util.c
index f0446ca8d..7ed86c36e 100644
--- a/src/firecfg/util.c
+++ b/src/firecfg/util.c
@@ -58,9 +58,15 @@ int which(const char *program) {
58 // use path2 to count the entries 58 // use path2 to count the entries
59 char *ptr = strtok(path2, ":"); 59 char *ptr = strtok(path2, ":");
60 while (ptr) { 60 while (ptr) {
61 if (find(program, ptr)) { 61 // Ubuntu 18.04 is adding /snap/bin to PATH;
62 free(path2); 62 // they populate /snap/bin with simbolic links to /usr/bin/ programs;
63 return 1; 63 // most simlinked programs are not installed by default.
64 // Removing /snap/bin from our search
65 if (strcmp(ptr, "/snap/bin") != 0) {
66 if (find(program, ptr)) {
67 free(path2);
68 return 1;
69 }
64 } 70 }
65 ptr = strtok(NULL, ":"); 71 ptr = strtok(NULL, ":");
66 } 72 }
diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h
index 0df832c09..14f87c36c 100644
--- a/src/firejail/firejail.h
+++ b/src/firejail/firejail.h
@@ -524,6 +524,16 @@ unsigned extract_timeout(const char *str);
524void disable_file_or_dir(const char *fname); 524void disable_file_or_dir(const char *fname);
525void disable_file_path(const char *path, const char *file); 525void disable_file_path(const char *path, const char *file);
526 526
527// Get info regarding the last kernel mount operation.
528// The return value points to a static area, and will be overwritten by subsequent calls.
529// The function does an exit(1) if anything goes wrong.
530typedef struct {
531 char *fsname;
532 char *dir;
533} MountData;
534MountData *get_last_mount(void);
535
536
527// fs_var.c 537// fs_var.c
528void fs_var_log(void); // mounting /var/log 538void fs_var_log(void); // mounting /var/log
529void fs_var_lib(void); // various other fixes for software in /var directory 539void fs_var_lib(void); // various other fixes for software in /var directory
diff --git a/src/firejail/fs_bin.c b/src/firejail/fs_bin.c
index d4cdbbe0a..b0ad35299 100644
--- a/src/firejail/fs_bin.c
+++ b/src/firejail/fs_bin.c
@@ -25,6 +25,8 @@
25#include <unistd.h> 25#include <unistd.h>
26#include <glob.h> 26#include <glob.h>
27 27
28static int prog_cnt = 0;
29
28static char *paths[] = { 30static char *paths[] = {
29 "/usr/local/bin", 31 "/usr/local/bin",
30 "/usr/bin", 32 "/usr/bin",
@@ -191,6 +193,7 @@ static void duplicate(char *fname, FILE *fplist) {
191 // solving problems such as /bin/sh -> /bin/dash 193 // solving problems such as /bin/sh -> /bin/dash
192 // copy the real file pointed by symlink 194 // copy the real file pointed by symlink
193 sbox_run(SBOX_ROOT| SBOX_SECCOMP, 3, PATH_FCOPY, actual_path, RUN_BIN_DIR); 195 sbox_run(SBOX_ROOT| SBOX_SECCOMP, 3, PATH_FCOPY, actual_path, RUN_BIN_DIR);
196 prog_cnt++;
194 char *f = strrchr(actual_path, '/'); 197 char *f = strrchr(actual_path, '/');
195 if (f && *(++f) !='\0') 198 if (f && *(++f) !='\0')
196 report_duplication(f); 199 report_duplication(f);
@@ -201,6 +204,7 @@ static void duplicate(char *fname, FILE *fplist) {
201 204
202 // copy a file or a symlink 205 // copy a file or a symlink
203 sbox_run(SBOX_ROOT| SBOX_SECCOMP, 3, PATH_FCOPY, full_path, RUN_BIN_DIR); 206 sbox_run(SBOX_ROOT| SBOX_SECCOMP, 3, PATH_FCOPY, full_path, RUN_BIN_DIR);
207 prog_cnt++;
204 free(full_path); 208 free(full_path);
205 report_duplication(fname); 209 report_duplication(fname);
206} 210}
@@ -256,6 +260,9 @@ void fs_private_bin_list(void) {
256 char *private_list = cfg.bin_private_keep; 260 char *private_list = cfg.bin_private_keep;
257 assert(private_list); 261 assert(private_list);
258 262
263 // start timetrace
264 timetrace_start();
265
259 // create /run/firejail/mnt/bin directory 266 // create /run/firejail/mnt/bin directory
260 mkdir_attr(RUN_BIN_DIR, 0755, 0, 0); 267 mkdir_attr(RUN_BIN_DIR, 0755, 0, 0);
261 268
@@ -298,4 +305,5 @@ void fs_private_bin_list(void) {
298 } 305 }
299 i++; 306 i++;
300 } 307 }
308 fmessage("%d %s installed in %0.2f ms\n", prog_cnt, (prog_cnt == 1)? "program": "programs", timetrace_end());
301} 309}
diff --git a/src/firejail/fs_lib.c b/src/firejail/fs_lib.c
index 8a105be97..363b48d1d 100644
--- a/src/firejail/fs_lib.c
+++ b/src/firejail/fs_lib.c
@@ -201,7 +201,7 @@ static char *valid_file(const char *lib) {
201 } 201 }
202 free(fname); 202 free(fname);
203 } 203 }
204printf("not found %s\n", lib); 204
205 fwarning("%s library not found, skipping...\n", lib); 205 fwarning("%s library not found, skipping...\n", lib);
206 return NULL; 206 return NULL;
207} 207}
@@ -352,7 +352,7 @@ void fs_private_lib(void) {
352 fslib_copy_dir(name); 352 fslib_copy_dir(name);
353 free(name); 353 free(name);
354 354
355 // /usr/lib/x86_linux-gnu - debian & frriends 355 // /usr/lib/x86_linux-gnu - debian & friends
356 if (asprintf(&name, "/usr/lib/x86_64-linux-gnu/%s", ptr) == -1) 356 if (asprintf(&name, "/usr/lib/x86_64-linux-gnu/%s", ptr) == -1)
357 errExit("asprintf"); 357 errExit("asprintf");
358 if (is_dir(name)) 358 if (is_dir(name))
@@ -377,20 +377,12 @@ void fs_private_lib(void) {
377 printf("*** Installing system libraries\n"); 377 printf("*** Installing system libraries\n");
378 fslib_install_system(); 378 fslib_install_system();
379 379
380 fmessage("Installed %d libraries and %d directories\n", lib_cnt, dir_cnt); 380 fmessage("Installed %d %s and %d %s\n", lib_cnt, (lib_cnt == 1)? "library": "libraries",
381 dir_cnt, (dir_cnt == 1)? "directory": "directories");
381 382
382 // bring in firejail directory for --trace options 383 // bring in firejail directory for --trace and seccomp post exec
383 fslib_copy_dir(LIBDIR "/firejail"); 384 fslib_copy_dir(LIBDIR "/firejail");
384 385
385 // ... and for sandbox in sandbox functionality
386 fslib_copy_libs(LIBDIR "/firejail/faudit");
387 fslib_copy_libs(LIBDIR "/firejail/fbuilder");
388 fslib_copy_libs(LIBDIR "/firejail/fcopy");
389 fslib_copy_libs(LIBDIR "/firejail/fldd");
390 fslib_copy_libs(LIBDIR "/firejail/fnet");
391 fslib_copy_libs(LIBDIR "/firejail/fnetfilter");
392 fslib_copy_libs(LIBDIR "/firejail/fseccomp");
393 fslib_copy_libs(LIBDIR "/firejail/ftee");
394 // mount lib filesystem 386 // mount lib filesystem
395 mount_directories(); 387 mount_directories();
396} 388}
diff --git a/src/firejail/fs_whitelist.c b/src/firejail/fs_whitelist.c
index d4c7de342..60bb0f6ed 100644
--- a/src/firejail/fs_whitelist.c
+++ b/src/firejail/fs_whitelist.c
@@ -317,6 +317,16 @@ static void whitelist_path(ProfileEntry *entry) {
317 if (mount(wfile, path, NULL, MS_BIND|MS_REC, NULL) < 0) 317 if (mount(wfile, path, NULL, MS_BIND|MS_REC, NULL) < 0)
318 errExit("mount bind"); 318 errExit("mount bind");
319 319
320 // check the last mount operation
321 MountData *mptr = get_last_mount(); // will do exit(1) if the mount cannot be found
322
323 // No mounts are allowed on top level directories. A destination such as "/etc" is very bad!
324 // - there should be more than one '/' char in dest string
325 if (mptr->dir == strrchr(mptr->dir, '/')) {
326 fprintf(stderr, "Error: invalid mount on top of %s\n", mptr->dir);
327 exit(1);
328 }
329
320 free(wfile); 330 free(wfile);
321 return; 331 return;
322 332
@@ -859,6 +869,15 @@ void fs_whitelist(void) {
859 fprintf(stderr, "Warning cannot create symbolic link %s\n", entry->link); 869 fprintf(stderr, "Warning cannot create symbolic link %s\n", entry->link);
860 else if (arg_debug || arg_debug_whitelists) 870 else if (arg_debug || arg_debug_whitelists)
861 printf("Created symbolic link %s -> %s\n", entry->link, entry->data + 10); 871 printf("Created symbolic link %s -> %s\n", entry->link, entry->data + 10);
872
873 // check again for files in /tmp directory
874 if (strncmp(entry->link, "/tmp/", 5) == 0) {
875 char *path = realpath(entry->link, NULL);
876 if (path == NULL || strncmp(path, "/tmp/", 5) != 0) {
877 fprintf(stderr, "Error: invalid symbolic link %s\n", entry->link);
878 exit(1);
879 }
880 }
862 } 881 }
863 } 882 }
864 } 883 }
diff --git a/src/firejail/util.c b/src/firejail/util.c
index a44e52e98..f441f283f 100644
--- a/src/firejail/util.c
+++ b/src/firejail/util.c
@@ -1029,3 +1029,39 @@ void disable_file_path(const char *path, const char *file) {
1029 free(fname); 1029 free(fname);
1030} 1030}
1031 1031
1032#define MAX_BUF 4096
1033static char mbuf[MAX_BUF];
1034static MountData mdata;
1035
1036// Get info regarding the last kernel mount operation.
1037// The return value points to a static area, and will be overwritten by subsequent calls.
1038// The function does an exit(1) if anything goes wrong.
1039MountData *get_last_mount(void) {
1040 // open /proc/self/mounts
1041 FILE *fp = fopen("/proc/self/mounts", "r");
1042 if (!fp)
1043 goto errexit;
1044
1045 mbuf[0] = '\0';
1046 while (fgets(mbuf, MAX_BUF, fp));
1047 fclose(fp);
1048 if (arg_debug || arg_debug_whitelists)
1049 printf("%s", mbuf);
1050
1051 // there should be no reason to have a new mount on top of a top level directory
1052 mdata.fsname = mbuf;
1053 mdata.dir = strstr(mbuf, " ");
1054 if (!mdata.dir)
1055 goto errexit;
1056 mdata.dir++;
1057 char *end = strstr(mdata.dir, " ");
1058 if (!end)
1059 goto errexit;
1060 *end = '\0';
1061
1062 return &mdata;
1063
1064errexit:
1065 fprintf(stderr, "Error: cannot read /proc/self/mounts");
1066 exit(1);
1067}
diff --git a/src/fldd/main.c b/src/fldd/main.c
index be4500d2a..4658e82fb 100644
--- a/src/fldd/main.c
+++ b/src/fldd/main.c
@@ -340,10 +340,8 @@ printf("\n");
340 else { 340 else {
341 if (is_lib_64(argv[1])) 341 if (is_lib_64(argv[1]))
342 parse_elf(argv[1]); 342 parse_elf(argv[1]);
343 else { 343 else
344 fprintf(stderr, "Error fldd: %s is not a 64bit program/library\n", argv[1]); 344 fprintf(stderr, "Warning fldd: %s is not a 64bit program/library\n", argv[1]);
345 exit(1);
346 }
347 } 345 }
348 346
349 347
diff --git a/src/lib/firejail_user.c b/src/lib/firejail_user.c
index 09a4da0e7..0cc0ac6c1 100644
--- a/src/lib/firejail_user.c
+++ b/src/lib/firejail_user.c
@@ -47,7 +47,8 @@ int firejail_user_check(const char *name) {
47 return 1; 47 return 1;
48 48
49 // other system users will run the program as is 49 // other system users will run the program as is
50 if (getuid() < UID_MIN || strcmp(name, "nobody") == 0) 50 uid_t uid = getuid();
51 if ((uid < UID_MIN && uid != 0) || strcmp(name, "nobody") == 0)
51 return 0; 52 return 0;
52 53
53 // check file existence 54 // check file existence
diff --git a/test/apps-x11-xorg/apps-x11-xorg.sh b/test/apps-x11-xorg/apps-x11-xorg.sh
index 32331f786..ea07d3713 100755
--- a/test/apps-x11-xorg/apps-x11-xorg.sh
+++ b/test/apps-x11-xorg/apps-x11-xorg.sh
@@ -6,7 +6,7 @@
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8 8
9which firefox 9which firefox 2>/dev/null
10if [ "$?" -eq 0 ]; 10if [ "$?" -eq 0 ];
11then 11then
12 echo "TESTING: firefox x11 xorg" 12 echo "TESTING: firefox x11 xorg"
@@ -15,7 +15,7 @@ else
15 echo "TESTING SKIP: firefox not found" 15 echo "TESTING SKIP: firefox not found"
16fi 16fi
17 17
18which transmission-gtk 18which transmission-gtk 2>/dev/null
19if [ "$?" -eq 0 ]; 19if [ "$?" -eq 0 ];
20then 20then
21 echo "TESTING: transmission-gtk x11 xorg" 21 echo "TESTING: transmission-gtk x11 xorg"
@@ -24,7 +24,7 @@ else
24 echo "TESTING SKIP: transmission-gtk not found" 24 echo "TESTING SKIP: transmission-gtk not found"
25fi 25fi
26 26
27which thunderbird 27which thunderbird 2>/dev/null
28if [ "$?" -eq 0 ]; 28if [ "$?" -eq 0 ];
29then 29then
30 echo "TESTING: thunderbird x11 xorg" 30 echo "TESTING: thunderbird x11 xorg"
diff --git a/test/apps-x11/apps-x11.sh b/test/apps-x11/apps-x11.sh
index 2e0031dd9..c12b11f3e 100755
--- a/test/apps-x11/apps-x11.sh
+++ b/test/apps-x11/apps-x11.sh
@@ -10,20 +10,20 @@ echo "TESTING: no x11 (test/apps-x11/x11-none.exp)"
10./x11-none.exp 10./x11-none.exp
11 11
12 12
13which xterm 13which xterm 2>/dev/null
14if [ "$?" -eq 0 ]; 14if [ "$?" -eq 0 ];
15then 15then
16 echo "TESTING: xterm x11 xorg" 16 echo "TESTING: xterm x11 xorg"
17 ./xterm-xorg.exp 17 ./xterm-xorg.exp
18 18
19 which xpra 19 which xpra 2>/dev/null
20 if [ "$?" -eq 0 ]; 20 if [ "$?" -eq 0 ];
21 then 21 then
22 echo "TESTING: xterm x11 xpra" 22 echo "TESTING: xterm x11 xpra"
23 ./xterm-xpra.exp 23 ./xterm-xpra.exp
24 fi 24 fi
25 25
26 which Xephyr 26 which Xephyr 2>/dev/null
27 if [ "$?" -eq 0 ]; 27 if [ "$?" -eq 0 ];
28 then 28 then
29 echo "TESTING: xterm x11 xephyr" 29 echo "TESTING: xterm x11 xephyr"
@@ -34,13 +34,13 @@ else
34fi 34fi
35 35
36# check xpra/xephyr 36# check xpra/xephyr
37which xpra 37which xpra 2>/dev/null
38if [ "$?" -eq 0 ]; 38if [ "$?" -eq 0 ];
39then 39then
40 echo "xpra found" 40 echo "xpra found"
41else 41else
42 echo "xpra not found" 42 echo "xpra not found"
43 which Xephyr 43 which Xephyr 2>/dev/null
44 if [ "$?" -eq 0 ]; 44 if [ "$?" -eq 0 ];
45 then 45 then
46 echo "Xephyr found" 46 echo "Xephyr found"
@@ -50,7 +50,7 @@ else
50 fi 50 fi
51fi 51fi
52 52
53which firefox 53which firefox 2>/dev/null
54if [ "$?" -eq 0 ]; 54if [ "$?" -eq 0 ];
55then 55then
56 echo "TESTING: firefox x11" 56 echo "TESTING: firefox x11"
@@ -59,7 +59,7 @@ else
59 echo "TESTING SKIP: firefox not found" 59 echo "TESTING SKIP: firefox not found"
60fi 60fi
61 61
62which chromium 62which chromium 2>/dev/null
63if [ "$?" -eq 0 ]; 63if [ "$?" -eq 0 ];
64then 64then
65 echo "TESTING: chromium x11" 65 echo "TESTING: chromium x11"
@@ -68,7 +68,7 @@ else
68 echo "TESTING SKIP: chromium not found" 68 echo "TESTING SKIP: chromium not found"
69fi 69fi
70 70
71which transmission-gtk 71which transmission-gtk 2>/dev/null
72if [ "$?" -eq 0 ]; 72if [ "$?" -eq 0 ];
73then 73then
74 echo "TESTING: transmission-gtk x11" 74 echo "TESTING: transmission-gtk x11"
@@ -77,7 +77,7 @@ else
77 echo "TESTING SKIP: transmission-gtk not found" 77 echo "TESTING SKIP: transmission-gtk not found"
78fi 78fi
79 79
80which thunderbird 80which thunderbird 2>/dev/null
81if [ "$?" -eq 0 ]; 81if [ "$?" -eq 0 ];
82then 82then
83 echo "TESTING: thunderbird x11" 83 echo "TESTING: thunderbird x11"
diff --git a/test/apps/apps.sh b/test/apps/apps.sh
index 4e0a9cc08..a3d0c4dc7 100755
--- a/test/apps/apps.sh
+++ b/test/apps/apps.sh
@@ -10,7 +10,7 @@ LIST="firefox midori chromium opera transmission-qt qbittorrent uget-gtk filezil
10LIST+="vlc fbreader deluge gnome-mplayer xchat wine kcalc ktorrent hexchat" 10LIST+="vlc fbreader deluge gnome-mplayer xchat wine kcalc ktorrent hexchat"
11 11
12for app in $LIST; do 12for app in $LIST; do
13 which $app 13 which $app 2>/dev/null
14 if [ "$?" -eq 0 ]; 14 if [ "$?" -eq 0 ];
15 then 15 then
16 echo "TESTING: $app" 16 echo "TESTING: $app"
diff --git a/test/arguments/arguments.sh b/test/arguments/arguments.sh
index 049236900..d9f2d4697 100755
--- a/test/arguments/arguments.sh
+++ b/test/arguments/arguments.sh
@@ -3,10 +3,8 @@
3if [ -f /etc/debian_version ]; then 3if [ -f /etc/debian_version ]; then
4 libdir=$(dirname "$(dpkg -L firejail | grep faudit)") 4 libdir=$(dirname "$(dpkg -L firejail | grep faudit)")
5 export PATH="$PATH:$libdir" 5 export PATH="$PATH:$libdir"
6else
7 export PATH="$PATH:/usr/lib/firejail"
8fi 6fi
9export PATH="$PATH:/usr/lib/firejail" 7export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail"
10 8
11echo "TESTING: 1. regular bash session" 9echo "TESTING: 1. regular bash session"
12./bashrun.exp 10./bashrun.exp
diff --git a/test/environment/environment.sh b/test/environment/environment.sh
index 364a4b65b..97ba8ba58 100755
--- a/test/environment/environment.sh
+++ b/test/environment/environment.sh
@@ -38,7 +38,7 @@ echo "TESTING: environment variables (test/environment/env.exp)"
38echo "TESTING: shell none(test/environment/shell-none.exp)" 38echo "TESTING: shell none(test/environment/shell-none.exp)"
39./shell-none.exp 39./shell-none.exp
40 40
41which dash 41which dash 2>/dev/null
42if [ "$?" -eq 0 ]; 42if [ "$?" -eq 0 ];
43then 43then
44 echo "TESTING: dash (test/environment/dash.exp)" 44 echo "TESTING: dash (test/environment/dash.exp)"
@@ -47,7 +47,7 @@ else
47 echo "TESTING SKIP: dash not found" 47 echo "TESTING SKIP: dash not found"
48fi 48fi
49 49
50which csh 50which csh 2>/dev/null
51if [ "$?" -eq 0 ]; 51if [ "$?" -eq 0 ];
52then 52then
53 echo "TESTING: csh (test/environment/csh.exp)" 53 echo "TESTING: csh (test/environment/csh.exp)"
@@ -56,7 +56,7 @@ else
56 echo "TESTING SKIP: csh not found" 56 echo "TESTING SKIP: csh not found"
57fi 57fi
58 58
59which zsh 59which zsh 2>/dev/null
60if [ "$?" -eq 0 ]; 60if [ "$?" -eq 0 ];
61then 61then
62 echo "TESTING: zsh (test/environment/zsh.exp)" 62 echo "TESTING: zsh (test/environment/zsh.exp)"
@@ -68,7 +68,7 @@ fi
68echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)" 68echo "TESTING: firejail in firejail - single sandbox (test/environment/firejail-in-firejail.exp)"
69./firejail-in-firejail.exp 69./firejail-in-firejail.exp
70 70
71which aplay 71which aplay 2>/dev/null
72if [ "$?" -eq 0 ]; 72if [ "$?" -eq 0 ];
73then 73then
74 echo "TESTING: sound (test/environment/sound.exp)" 74 echo "TESTING: sound (test/environment/sound.exp)"
@@ -83,7 +83,7 @@ echo "TESTING: nice (test/environment/nice.exp)"
83echo "TESTING: quiet (test/environment/quiet.exp)" 83echo "TESTING: quiet (test/environment/quiet.exp)"
84./quiet.exp 84./quiet.exp
85 85
86which strace 86which strace 2>/dev/null
87if [ "$?" -eq 0 ]; 87if [ "$?" -eq 0 ];
88then 88then
89 echo "TESTING: --allow-debuggers (test/environment/allow-debuggers.exp)" 89 echo "TESTING: --allow-debuggers (test/environment/allow-debuggers.exp)"
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh
index 0e7cb2e5e..b225f9ea0 100755
--- a/test/fcopy/fcopy.sh
+++ b/test/fcopy/fcopy.sh
@@ -11,7 +11,7 @@ if [ -f /etc/debian_version ]; then
11 export PATH="$PATH:$libdir" 11 export PATH="$PATH:$libdir"
12fi 12fi
13 13
14export PATH="$PATH:/usr/lib/firejail" 14export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail"
15 15
16mkdir dest 16mkdir dest
17 17
diff --git a/test/filters/filters.sh b/test/filters/filters.sh
index 97ecc8be0..d0a34ccc5 100755
--- a/test/filters/filters.sh
+++ b/test/filters/filters.sh
@@ -9,11 +9,9 @@ export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
9if [ -f /etc/debian_version ]; then 9if [ -f /etc/debian_version ]; then
10 libdir=$(dirname "$(dpkg -L firejail | grep fseccomp)") 10 libdir=$(dirname "$(dpkg -L firejail | grep fseccomp)")
11 export PATH="$PATH:$libdir" 11 export PATH="$PATH:$libdir"
12else
13 export PATH="$PATH:/usr/lib/firejail"
14fi 12fi
13export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail"
15 14
16export PATH="$PATH:/usr/lib/firejail"
17 15
18if [ "$(uname -m)" = "x86_64" ]; then 16if [ "$(uname -m)" = "x86_64" ]; then
19 echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)" 17 echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)"
@@ -79,7 +77,7 @@ echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)"
79echo "TESTING: seccomp su (test/filters/seccomp-su.exp)" 77echo "TESTING: seccomp su (test/filters/seccomp-su.exp)"
80./seccomp-su.exp 78./seccomp-su.exp
81 79
82which strace 80which strace 2>/dev/null
83if [ $? -eq 0 ]; then 81if [ $? -eq 0 ]; then
84 echo "TESTING: seccomp ptrace (test/filters/seccomp-ptrace.exp)" 82 echo "TESTING: seccomp ptrace (test/filters/seccomp-ptrace.exp)"
85 ./seccomp-ptrace.exp 83 ./seccomp-ptrace.exp
diff --git a/test/fnetfilter/fnetfilter.sh b/test/fnetfilter/fnetfilter.sh
index bae952ee9..aa2eb707a 100755
--- a/test/fnetfilter/fnetfilter.sh
+++ b/test/fnetfilter/fnetfilter.sh
@@ -11,7 +11,7 @@ if [ -f /etc/debian_version ]; then
11 export PATH="$PATH:$libdir" 11 export PATH="$PATH:$libdir"
12fi 12fi
13 13
14export PATH="$PATH:/usr/lib/firejail" 14export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail"
15 15
16chmod 400 outlocked 16chmod 400 outlocked
17 17
diff --git a/test/fs/invalid_filename.exp b/test/fs/invalid_filename.exp
index e16798ab8..84abe74cd 100755
--- a/test/fs/invalid_filename.exp
+++ b/test/fs/invalid_filename.exp
@@ -7,11 +7,7 @@ set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10send -- "firejail --debug-check-filename --noprofile --blacklist=\"bla&&bla\"\r" 10send -- "firejail --noprofile --blacklist=\"bla&&bla\"\r"
11expect {
12 timeout {puts "TESTING ERROR 1.1\n";exit}
13 "Checking filename bla&&bla"
14}
15expect { 11expect {
16 timeout {puts "TESTING ERROR 1.2\n";exit} 12 timeout {puts "TESTING ERROR 1.2\n";exit}
17 "Error:" 13 "Error:"
@@ -22,11 +18,7 @@ expect {
22} 18}
23after 100 19after 100
24 20
25send -- "firejail --debug-check-filename --noprofile --cgroup=\"bla&&bla\"\r" 21send -- "firejail --noprofile --cgroup=\"bla&&bla\"\r"
26expect {
27 timeout {puts "TESTING ERROR 2.1\n";exit}
28 "Checking filename bla&&bla"
29}
30expect { 22expect {
31 timeout {puts "TESTING ERROR 2.2\n";exit} 23 timeout {puts "TESTING ERROR 2.2\n";exit}
32 "Error:" 24 "Error:"
@@ -37,12 +29,7 @@ expect {
37} 29}
38after 100 30after 100
39 31
40send -- "firejail --debug-check-filename --noprofile --chroot=\"bla&&bla\"\r" 32send -- "firejail --noprofile --chroot=\"bla&&bla\"\r"
41expect {
42 timeout {puts "TESTING ERROR 3.1\n";exit}
43 "Checking filename bla&&bla" {puts "normal system\n"}
44 "Error: --chroot option is not available on Grsecurity systems" { puts "\nall done\n"; exit}
45}
46expect { 33expect {
47 timeout {puts "TESTING ERROR 3.2\n";exit} 34 timeout {puts "TESTING ERROR 3.2\n";exit}
48 "Error:" 35 "Error:"
@@ -53,11 +40,7 @@ expect {
53} 40}
54after 100 41after 100
55 42
56send -- "firejail --debug-check-filename --noprofile --netfilter=\"bla&&bla\"\r" 43send -- "firejail --noprofile --netfilter=\"bla&&bla\"\r"
57expect {
58 timeout {puts "TESTING ERROR 4.1\n";exit}
59 "Checking filename bla&&bla"
60}
61expect { 44expect {
62 timeout {puts "TESTING ERROR 4.2\n";exit} 45 timeout {puts "TESTING ERROR 4.2\n";exit}
63 "Error:" 46 "Error:"
@@ -68,22 +51,14 @@ expect {
68} 51}
69after 100 52after 100
70 53
71send -- "firejail --debug-check-filename --noprofile --output=\"bla&&bla\"\r" 54send -- "firejail --noprofile --output=\"bla&&bla\"\r"
72expect {
73 timeout {puts "TESTING ERROR 5.2\n";exit}
74 "Error:"
75}
76expect { 55expect {
77 timeout {puts "TESTING ERROR 5.3\n";exit} 56 timeout {puts "TESTING ERROR 5.3\n";exit}
78 "is an invalid filename" 57 "is an invalid filename"
79} 58}
80after 100 59after 100
81 60
82send -- "firejail --debug-check-filename --noprofile --private=\"bla&&bla\"\r" 61send -- "firejail --noprofile --private=\"bla&&bla\"\r"
83expect {
84 timeout {puts "TESTING ERROR 6.1\n";exit}
85 "Checking filename bla&&bla"
86}
87expect { 62expect {
88 timeout {puts "TESTING ERROR 6.2\n";exit} 63 timeout {puts "TESTING ERROR 6.2\n";exit}
89 "Error:" 64 "Error:"
@@ -94,11 +69,7 @@ expect {
94} 69}
95after 100 70after 100
96 71
97send -- "firejail --debug-check-filename --noprofile --private-bin=\"bla&&bla\"\r" 72send -- "firejail --noprofile --private-bin=\"bla&&bla\"\r"
98expect {
99 timeout {puts "TESTING ERROR 7.1\n";exit}
100 "Checking filename bla&&bla"
101}
102expect { 73expect {
103 timeout {puts "TESTING ERROR 7.2\n";exit} 74 timeout {puts "TESTING ERROR 7.2\n";exit}
104 "Error:" 75 "Error:"
@@ -109,11 +80,7 @@ expect {
109} 80}
110after 100 81after 100
111 82
112send -- "firejail --debug-check-filename --noprofile --private-home=\"bla&&bla\"\r" 83send -- "firejail --noprofile --private-home=\"bla&&bla\"\r"
113expect {
114 timeout {puts "TESTING ERROR 8.1\n";exit}
115 "Checking filename bla&&bla"
116}
117expect { 84expect {
118 timeout {puts "TESTING ERROR 8.2\n";exit} 85 timeout {puts "TESTING ERROR 8.2\n";exit}
119 "Error:" 86 "Error:"
@@ -124,11 +91,7 @@ expect {
124} 91}
125after 100 92after 100
126 93
127send -- "firejail --debug-check-filename --noprofile --private-etc=\"bla&&bla\"\r" 94send -- "firejail --noprofile --private-etc=\"bla&&bla\"\r"
128expect {
129 timeout {puts "TESTING ERROR 9.1\n";exit}
130 "Checking filename bla&&bla"
131}
132expect { 95expect {
133 timeout {puts "TESTING ERROR 9.2\n";exit} 96 timeout {puts "TESTING ERROR 9.2\n";exit}
134 "Error:" 97 "Error:"
@@ -139,11 +102,7 @@ expect {
139} 102}
140after 100 103after 100
141 104
142send -- "firejail --debug-check-filename --profile=\"bla&&bla\"\r" 105send -- "firejail --profile=\"bla&&bla\"\r"
143expect {
144 timeout {puts "TESTING ERROR 10.1\n";exit}
145 "Checking filename bla&&bla"
146}
147expect { 106expect {
148 timeout {puts "TESTING ERROR 10.2\n";exit} 107 timeout {puts "TESTING ERROR 10.2\n";exit}
149 "Error:" 108 "Error:"
@@ -154,11 +113,7 @@ expect {
154} 113}
155after 100 114after 100
156 115
157send -- "firejail --debug-check-filename --read-only=\"bla&&bla\"\r" 116send -- "firejail --read-only=\"bla&&bla\"\r"
158expect {
159 timeout {puts "TESTING ERROR 11.1\n";exit}
160 "Checking filename bla&&bla"
161}
162expect { 117expect {
163 timeout {puts "TESTING ERROR 11.2\n";exit} 118 timeout {puts "TESTING ERROR 11.2\n";exit}
164 "Error:" 119 "Error:"
@@ -169,11 +124,7 @@ expect {
169} 124}
170after 100 125after 100
171 126
172send -- "firejail --debug-check-filename --shell=\"bla&&bla\"\r" 127send -- "firejail --shell=\"bla&&bla\"\r"
173expect {
174 timeout {puts "TESTING ERROR 12.1\n";exit}
175 "Checking filename bla&&bla"
176}
177expect { 128expect {
178 timeout {puts "TESTING ERROR 12.2\n";exit} 129 timeout {puts "TESTING ERROR 12.2\n";exit}
179 "Error:" 130 "Error:"
@@ -185,11 +136,7 @@ expect {
185after 100 136after 100
186 137
187 138
188send -- "firejail --debug-check-filename --whitelist=\"bla&&bla\"\r" 139send -- "firejail --whitelist=\"bla&&bla\"\r"
189expect {
190 timeout {puts "TESTING ERROR 14.1\n";exit}
191 "Checking filename bla&&bla"
192}
193expect { 140expect {
194 timeout {puts "TESTING ERROR 14.2\n";exit} 141 timeout {puts "TESTING ERROR 14.2\n";exit}
195 "Error:" 142 "Error:"
diff --git a/test/overlay/overlay.sh b/test/overlay/overlay.sh
index 6b7f779d7..9daf1f5f6 100755
--- a/test/overlay/overlay.sh
+++ b/test/overlay/overlay.sh
@@ -21,7 +21,7 @@ rm -fr ~/_firejail_test_*
21./fs-tmpfs.exp 21./fs-tmpfs.exp
22rm -fr ~/_firejail_test_* 22rm -fr ~/_firejail_test_*
23 23
24which firefox 24which firefox 2>/dev/null
25if [ "$?" -eq 0 ]; 25if [ "$?" -eq 0 ];
26then 26then
27 echo "TESTING: overlay firefox" 27 echo "TESTING: overlay firefox"
@@ -30,7 +30,7 @@ else
30 echo "TESTING SKIP: firefox not found" 30 echo "TESTING SKIP: firefox not found"
31fi 31fi
32 32
33which firefox 33which firefox 2>/dev/null
34if [ "$?" -eq 0 ]; 34if [ "$?" -eq 0 ];
35then 35then
36 echo "TESTING: overlay firefox x11 xorg" 36 echo "TESTING: overlay firefox x11 xorg"
@@ -41,13 +41,13 @@ fi
41 41
42 42
43# check xpra/xephyr 43# check xpra/xephyr
44which xpra 44which xpra 2>/dev/null
45if [ "$?" -eq 0 ]; 45if [ "$?" -eq 0 ];
46then 46then
47 echo "xpra found" 47 echo "xpra found"
48else 48else
49 echo "xpra not found" 49 echo "xpra not found"
50 which Xephyr 50 which Xephyr 2>/dev/null
51 if [ "$?" -eq 0 ]; 51 if [ "$?" -eq 0 ];
52 then 52 then
53 echo "Xephyr found" 53 echo "Xephyr found"
@@ -57,7 +57,7 @@ else
57 fi 57 fi
58fi 58fi
59 59
60which firefox 60which firefox 2>/dev/null
61if [ "$?" -eq 0 ]; 61if [ "$?" -eq 0 ];
62then 62then
63 echo "TESTING: overlay firefox x11" 63 echo "TESTING: overlay firefox x11"
diff --git a/test/private-lib/gedit.exp b/test/private-lib/gedit.exp
new file mode 100755
index 000000000..00fa934e7
--- /dev/null
+++ b/test/private-lib/gedit.exp
@@ -0,0 +1,83 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2018 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail /usr/bin/gedit\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Reading profile /etc/firejail/gedit.profile"
14}
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "Child process initialized"
18}
19sleep 3
20
21spawn $env(SHELL)
22send -- "firejail --list\r"
23expect {
24 timeout {puts "TESTING ERROR 3\n";exit}
25 ":firejail"
26}
27expect {
28 timeout {puts "TESTING ERROR 3.1\n";exit}
29 "gedit"
30}
31after 100
32
33# grsecurity exit
34send -- "file /proc/sys/kernel/grsecurity\r"
35expect {
36 timeout {puts "TESTING ERROR - grsecurity detection\n";exit}
37 "grsecurity: directory" {puts "grsecurity present, exiting...\n";exit}
38 "cannot open" {puts "grsecurity not present\n"}
39}
40
41send -- "firejail --name=blablabla\r"
42expect {
43 timeout {puts "TESTING ERROR 4\n";exit}
44 "Child process initialized"
45}
46sleep 2
47
48spawn $env(SHELL)
49send -- "firemon --seccomp\r"
50expect {
51 timeout {puts "TESTING ERROR 5\n";exit}
52 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
53 ":firejail /usr/bin/gedit"
54}
55expect {
56 timeout {puts "TESTING ERROR 5.1 (seccomp)\n";exit}
57 "Seccomp: 2"
58}
59expect {
60 timeout {puts "TESTING ERROR 5.1\n";exit}
61 "name=blablabla"
62}
63after 100
64send -- "firemon --caps\r"
65expect {
66 timeout {puts "TESTING ERROR 6\n";exit}
67 ":firejail /usr/bin/gedit"
68}
69expect {
70 timeout {puts "TESTING ERROR 6.1\n";exit}
71 "CapBnd:"
72}
73expect {
74 timeout {puts "TESTING ERROR 6.2\n";exit}
75 "0000000000000000"
76}
77expect {
78 timeout {puts "TESTING ERROR 6.3\n";exit}
79 "name=blablabla"
80}
81after 100
82
83puts "\nall done\n"
diff --git a/test/private-lib/pluma.exp b/test/private-lib/pluma.exp
new file mode 100755
index 000000000..92ae0a345
--- /dev/null
+++ b/test/private-lib/pluma.exp
@@ -0,0 +1,83 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2018 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail pluma\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Reading profile /etc/firejail/pluma.profile"
14}
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "Child process initialized"
18}
19sleep 3
20
21spawn $env(SHELL)
22send -- "firejail --list\r"
23expect {
24 timeout {puts "TESTING ERROR 3\n";exit}
25 ":firejail"
26}
27expect {
28 timeout {puts "TESTING ERROR 3.1\n";exit}
29 "pluma"
30}
31after 100
32
33# grsecurity exit
34send -- "file /proc/sys/kernel/grsecurity\r"
35expect {
36 timeout {puts "TESTING ERROR - grsecurity detection\n";exit}
37 "grsecurity: directory" {puts "grsecurity present, exiting...\n";exit}
38 "cannot open" {puts "grsecurity not present\n"}
39}
40
41send -- "firejail --name=blablabla\r"
42expect {
43 timeout {puts "TESTING ERROR 4\n";exit}
44 "Child process initialized"
45}
46sleep 2
47
48spawn $env(SHELL)
49send -- "firemon --seccomp\r"
50expect {
51 timeout {puts "TESTING ERROR 5\n";exit}
52 "need to be root" {puts "/proc mounted as hidepid, exiting...\n"; exit}
53 ":firejail pluma"
54}
55expect {
56 timeout {puts "TESTING ERROR 5.1 (seccomp)\n";exit}
57 "Seccomp: 2"
58}
59expect {
60 timeout {puts "TESTING ERROR 5.1\n";exit}
61 "name=blablabla"
62}
63after 100
64send -- "firemon --caps\r"
65expect {
66 timeout {puts "TESTING ERROR 6\n";exit}
67 ":firejail pluma"
68}
69expect {
70 timeout {puts "TESTING ERROR 6.1\n";exit}
71 "CapBnd:"
72}
73expect {
74 timeout {puts "TESTING ERROR 6.2\n";exit}
75 "0000000000000000"
76}
77expect {
78 timeout {puts "TESTING ERROR 6.3\n";exit}
79 "name=blablabla"
80}
81after 100
82
83puts "\nall done\n"
diff --git a/test/private-lib/private-lib.sh b/test/private-lib/private-lib.sh
index 312fe502a..edf81917a 100755
--- a/test/private-lib/private-lib.sh
+++ b/test/private-lib/private-lib.sh
@@ -5,11 +5,11 @@
5 5
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8LIST="evince galculator gnome-calculator leafpad mousepad transmission-gtk xcalc atril gpicview eom eog" 8LIST="evince galculator gnome-calculator gedit leafpad mousepad pluma transmission-gtk xcalc atril gpicview eom eog"
9 9
10 10
11for app in $LIST; do 11for app in $LIST; do
12 which $app 12 which $app 2>/dev/null
13 if [ "$?" -eq 0 ]; 13 if [ "$?" -eq 0 ];
14 then 14 then
15 echo "TESTING: private-lib $app" 15 echo "TESTING: private-lib $app"
diff --git a/test/root/root.sh b/test/root/root.sh
index 4f217b727..a20142c5f 100755
--- a/test/root/root.sh
+++ b/test/root/root.sh
@@ -7,7 +7,7 @@
7#******************************** 7#********************************
8# firecfg 8# firecfg
9#******************************** 9#********************************
10which less 10which less 2>/dev/null
11if [ "$?" -eq 0 ]; 11if [ "$?" -eq 0 ];
12then 12then
13 echo "TESTING: firecfg (test/root/firecfg.exp)" 13 echo "TESTING: firecfg (test/root/firecfg.exp)"
diff --git a/test/sysutils/sysutils.sh b/test/sysutils/sysutils.sh
index dd09e4533..6794af520 100755
--- a/test/sysutils/sysutils.sh
+++ b/test/sysutils/sysutils.sh
@@ -6,7 +6,7 @@
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8 8
9which cpio 9which cpio 2>/dev/null
10if [ "$?" -eq 0 ]; 10if [ "$?" -eq 0 ];
11then 11then
12 echo "TESTING: cpio" 12 echo "TESTING: cpio"
@@ -24,7 +24,7 @@ fi
24# echo "TESTING SKIP: strings not found" 24# echo "TESTING SKIP: strings not found"
25#fi 25#fi
26 26
27which gzip 27which gzip 2>/dev/null
28if [ "$?" -eq 0 ]; 28if [ "$?" -eq 0 ];
29then 29then
30 echo "TESTING: gzip" 30 echo "TESTING: gzip"
@@ -33,7 +33,7 @@ else
33 echo "TESTING SKIP: gzip not found" 33 echo "TESTING SKIP: gzip not found"
34fi 34fi
35 35
36which xzdec 36which xzdec 2>/dev/null
37if [ "$?" -eq 0 ]; 37if [ "$?" -eq 0 ];
38then 38then
39 echo "TESTING: xzdec" 39 echo "TESTING: xzdec"
@@ -42,7 +42,7 @@ else
42 echo "TESTING SKIP: xzdec not found" 42 echo "TESTING SKIP: xzdec not found"
43fi 43fi
44 44
45which xz 45which xz 2>/dev/null
46if [ "$?" -eq 0 ]; 46if [ "$?" -eq 0 ];
47then 47then
48 echo "TESTING: xz" 48 echo "TESTING: xz"
@@ -51,7 +51,7 @@ else
51 echo "TESTING SKIP: xz not found" 51 echo "TESTING SKIP: xz not found"
52fi 52fi
53 53
54which less 54which less 2>/dev/null
55if [ "$?" -eq 0 ]; 55if [ "$?" -eq 0 ];
56then 56then
57 echo "TESTING: less" 57 echo "TESTING: less"
@@ -60,7 +60,7 @@ else
60 echo "TESTING SKIP: less not found" 60 echo "TESTING SKIP: less not found"
61fi 61fi
62 62
63which file 63which file 2>/dev/null
64if [ "$?" -eq 0 ]; 64if [ "$?" -eq 0 ];
65then 65then
66 echo "TESTING: file" 66 echo "TESTING: file"
@@ -69,7 +69,7 @@ else
69 echo "TESTING SKIP: file not found" 69 echo "TESTING SKIP: file not found"
70fi 70fi
71 71
72which tar 72which tar 2>/dev/null
73if [ "$?" -eq 0 ]; 73if [ "$?" -eq 0 ];
74then 74then
75 echo "TESTING: tar" 75 echo "TESTING: tar"
@@ -78,7 +78,7 @@ else
78 echo "TESTING SKIP: tar not found" 78 echo "TESTING SKIP: tar not found"
79fi 79fi
80 80
81which ping 81which ping 2>/dev/null
82if [ "$?" -eq 0 ]; 82if [ "$?" -eq 0 ];
83then 83then
84 echo "TESTING: ping" 84 echo "TESTING: ping"
diff --git a/test/utils/utils.sh b/test/utils/utils.sh
index 5438e11a8..d98e4c2e4 100755
--- a/test/utils/utils.sh
+++ b/test/utils/utils.sh
@@ -10,7 +10,7 @@ if [ -f /etc/debian_version ]; then
10 libdir=$(dirname "$(dpkg -L firejail | grep faudit)") 10 libdir=$(dirname "$(dpkg -L firejail | grep faudit)")
11 export PATH="$PATH:$libdir" 11 export PATH="$PATH:$libdir"
12fi 12fi
13export PATH="$PATH:/usr/lib/firejail" 13export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail"
14 14
15echo "testing" > ~/firejail-test-file-7699 15echo "testing" > ~/firejail-test-file-7699
16echo "testing" > /tmp/firejail-test-file-7699 16echo "testing" > /tmp/firejail-test-file-7699
@@ -39,7 +39,7 @@ echo "TESTING: version (test/utils/version.exp)"
39echo "TESTING: help (test/utils/help.exp)" 39echo "TESTING: help (test/utils/help.exp)"
40./help.exp 40./help.exp
41 41
42which man 42which man 2>/dev/null
43if [ "$?" -eq 0 ]; 43if [ "$?" -eq 0 ];
44then 44then
45 echo "TESTING: man (test/utils/man.exp)" 45 echo "TESTING: man (test/utils/man.exp)"