aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtest/environment/dns.exp47
-rwxr-xr-xtest/fs/fs.sh3
-rw-r--r--test/fs/user-dirs.dirs15
-rwxr-xr-xtest/fs/whitelist-downloads.exp49
-rwxr-xr-xtest/utils/audit.exp79
-rwxr-xr-xtest/utils/utils.sh3
6 files changed, 174 insertions, 22 deletions
diff --git a/test/environment/dns.exp b/test/environment/dns.exp
index a6a7171eb..40403aade 100755
--- a/test/environment/dns.exp
+++ b/test/environment/dns.exp
@@ -4,6 +4,31 @@ set timeout 30
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7send -- "firejail --dns=8.8.4.4 --dns=8.8.8.8 --dns=4.2.2.1\r"
8expect {
9 timeout {puts "TESTING ERROR 2.1\n";exit}
10 "Child process initialized"
11}
12sleep 1
13
14send -- "cat /etc/resolv.conf\r"
15expect {
16 timeout {puts "TESTING ERROR 2.2\n";exit}
17 "nameserver 8.8.4.4"
18}
19expect {
20 timeout {puts "TESTING ERROR 2.3\n";exit}
21 "nameserver 8.8.8.8"
22}
23expect {
24 timeout {puts "TESTING ERROR 2.4\n";exit}
25 "nameserver 4.2.2.1"
26}
27after 100
28send -- "exit\r"
29after 100
30
31
7# no chroot 32# no chroot
8send -- "firejail --trace --dns=208.67.222.222 wget -q debian.org\r" 33send -- "firejail --trace --dns=208.67.222.222 wget -q debian.org\r"
9expect { 34expect {
@@ -27,28 +52,6 @@ after 100
27send -- "rm index.html\r" 52send -- "rm index.html\r"
28after 100 53after 100
29send -- "exit\r" 54send -- "exit\r"
30sleep 1
31
32send -- "firejail --dns=8.8.4.4 --dns=8.8.8.8 --dns=4.2.2.1\r"
33expect {
34 timeout {puts "TESTING ERROR 2.1\n";exit}
35 "Child process initialized"
36}
37sleep 1
38
39send -- "cat /etc/resolv.conf\r"
40expect {
41 timeout {puts "TESTING ERROR 2.2\n";exit}
42 "nameserver 8.8.4.4"
43}
44expect {
45 timeout {puts "TESTING ERROR 2.3\n";exit}
46 "nameserver 8.8.8.8"
47}
48expect {
49 timeout {puts "TESTING ERROR 2.4\n";exit}
50 "nameserver 4.2.2.1"
51}
52after 100 55after 100
53 56
54puts "\nall done\n" 57puts "\nall done\n"
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index 1c5473f79..d9a425661 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -61,6 +61,9 @@ echo "TESTING: whitelist empty (test/fs/whitelist-empty.exp)"
61echo "TESTING: private whitelist (test/fs/private-whitelist.exp)" 61echo "TESTING: private whitelist (test/fs/private-whitelist.exp)"
62./private-whitelist.exp 62./private-whitelist.exp
63 63
64echo "TESTING: whitelist ~/Downloads (test/fs/whitelist-downloads.exp)"
65./whitelist-downloads.exp
66
64echo "TESTING: invalid filename (test/fs/invalid_filename.exp)" 67echo "TESTING: invalid filename (test/fs/invalid_filename.exp)"
65./invalid_filename.exp 68./invalid_filename.exp
66 69
diff --git a/test/fs/user-dirs.dirs b/test/fs/user-dirs.dirs
new file mode 100644
index 000000000..0d19da4e4
--- /dev/null
+++ b/test/fs/user-dirs.dirs
@@ -0,0 +1,15 @@
1# This file is written by xdg-user-dirs-update
2# If you want to change or add directories, just edit the line you're
3# interested in. All local changes will be retained on the next run
4# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
5# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
6# absolute path. No other format is supported.
7#
8XDG_DESKTOP_DIR="$HOME/Desktop"
9XDG_DOWNLOAD_DIR="$HOME/Downloads"
10XDG_TEMPLATES_DIR="$HOME/Templates"
11XDG_PUBLICSHARE_DIR="$HOME/Public"
12XDG_DOCUMENTS_DIR="$HOME/Documents"
13XDG_MUSIC_DIR="$HOME/Music"
14XDG_PICTURES_DIR="$HOME/Pictures"
15XDG_VIDEOS_DIR="$HOME/Videos"
diff --git a/test/fs/whitelist-downloads.exp b/test/fs/whitelist-downloads.exp
new file mode 100755
index 000000000..6af318d2b
--- /dev/null
+++ b/test/fs/whitelist-downloads.exp
@@ -0,0 +1,49 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "cp user-dirs.dirs /tmp/.\r"
11after 100
12
13send -- "firejail --private --noprofile\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18after 100
19
20send -- "firejail --force --profile=/etc/firejail/firefox.profile\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "cannot whitelist Downloads directory"
24}
25expect {
26 timeout {puts "TESTING ERROR 2\n";exit}
27 "Child process initialized"
28}
29after 100
30
31send -- "exit\r"
32after 100
33
34send -- "cp /tmp/user-dirs.dirs ~/.config/.\r"
35after 100
36
37send -- "firejail --force --profile=/etc/firejail/firefox.profile\r"
38expect {
39 timeout {puts "TESTING ERROR 3\n";exit}
40 "cannot whitelist Downloads directory"
41}
42expect {
43 timeout {puts "TESTING ERROR 4\n";exit}
44 "Child process initialized"
45}
46after 100
47
48puts "\nall done\n"
49
diff --git a/test/utils/audit.exp b/test/utils/audit.exp
new file mode 100755
index 000000000..931b46981
--- /dev/null
+++ b/test/utils/audit.exp
@@ -0,0 +1,79 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --audit\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Firejail Audit"
14}
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "is running in a PID namespace"
18}
19expect {
20 timeout {puts "TESTING ERROR 2\n";exit}
21 "container/sandbox firejail"
22}
23expect {
24 timeout {puts "TESTING ERROR 3\n";exit}
25 "seccomp BPF enabled"
26}
27expect {
28 timeout {puts "TESTING ERROR 4\n";exit}
29 "all capabilities are disabled"
30}
31expect {
32 timeout {puts "TESTING ERROR 5\n";exit}
33 "dev directory seems to be fully populated"
34}
35after 100
36
37
38send -- "firejail --audit=/usr/lib/firejail/faudit\r"
39expect {
40 timeout {puts "TESTING ERROR 6\n";exit}
41 "Firejail Audit"
42}
43expect {
44 timeout {puts "TESTING ERROR 7\n";exit}
45 "is running in a PID namespace"
46}
47expect {
48 timeout {puts "TESTING ERROR 8\n";exit}
49 "container/sandbox firejail"
50}
51expect {
52 timeout {puts "TESTING ERROR 9\n";exit}
53 "seccomp BPF enabled"
54}
55expect {
56 timeout {puts "TESTING ERROR 10\n";exit}
57 "all capabilities are disabled"
58}
59expect {
60 timeout {puts "TESTING ERROR 11\n";exit}
61 "dev directory seems to be fully populated"
62}
63after 100
64
65send -- "firejail --audit=blablabla\r"
66expect {
67 timeout {puts "TESTING ERROR 12\n";exit}
68 "cannot find the audit program"
69}
70after 100
71
72send -- "firejail --audit=\r"
73expect {
74 timeout {puts "TESTING ERROR 12\n";exit}
75 "invalid audit program"
76}
77after 100
78
79puts "\nall done\n"
diff --git a/test/utils/utils.sh b/test/utils/utils.sh
index 804e5ae0f..04702597f 100755
--- a/test/utils/utils.sh
+++ b/test/utils/utils.sh
@@ -6,6 +6,9 @@
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8 8
9echo "TESTING: audit (test/utils/audit.exp)"
10./audit.exp
11
9echo "TESTING: version (test/utils/version.exp)" 12echo "TESTING: version (test/utils/version.exp)"
10./version.exp 13./version.exp
11 14