aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar valoq <valoq@mailbox.org>2016-11-19 22:12:51 +0100
committerLibravatar valoq <valoq@mailbox.org>2016-11-19 22:12:51 +0100
commit530db20edeee191a3b60d56b3b87999a3d10979e (patch)
tree9053d21580917bdf0e6480b2b2875e90b08b1d8c /test
parentreadme updated (diff)
parentqemu profile (diff)
downloadfirejail-530db20edeee191a3b60d56b3b87999a3d10979e.tar.gz
firejail-530db20edeee191a3b60d56b3b87999a3d10979e.tar.zst
firejail-530db20edeee191a3b60d56b3b87999a3d10979e.zip
fixed readme
Diffstat (limited to 'test')
-rwxr-xr-xtest/appimage/appimage-v1.exp2
-rwxr-xr-xtest/appimage/appimage.sh4
-rwxr-xr-xtest/appimage/filename.exp35
-rwxr-xr-xtest/chroot/chroot-resolvconf.exp (renamed from test/chroot-resolvconf.exp)0
-rwxr-xr-xtest/chroot/fs_chroot.exp (renamed from test/fs_chroot.exp)0
-rwxr-xr-xtest/environment/dns.exp26
-rwxr-xr-xtest/environment/environment.sh26
-rwxr-xr-xtest/environment/ibus.exp28
-rwxr-xr-xtest/environment/rlimit-bad-profile.exp35
-rwxr-xr-xtest/environment/rlimit-bad.exp34
-rw-r--r--test/environment/rlimit-bad1.profile1
-rw-r--r--test/environment/rlimit-bad2.profile1
-rw-r--r--test/environment/rlimit-bad3.profile1
-rw-r--r--test/environment/rlimit-bad4.profile1
-rwxr-xr-xtest/environment/rlimit-profile.exp (renamed from test/rlimit/rlimit-profile.exp)0
-rwxr-xr-xtest/environment/rlimit.exp (renamed from test/rlimit/rlimit.exp)0
-rw-r--r--test/environment/rlimit.profile (renamed from test/rlimit/rlimit.profile)0
-rwxr-xr-xtest/fcopy/cmdline.exp46
-rwxr-xr-xtest/fcopy/dircopy.exp106
-rwxr-xr-xtest/fcopy/fcopy.sh23
-rwxr-xr-xtest/fcopy/filecopy.exp54
-rwxr-xr-xtest/fcopy/linkcopy.exp54
-rw-r--r--test/fcopy/src/a/b/file411
-rw-r--r--test/fcopy/src/a/file30
l---------test/fcopy/src/dircopy.exp1
-rwxr-xr-xtest/fcopy/src/file10
-rw-r--r--test/fcopy/src/file20
-rwxr-xr-xtest/fs/fs.sh13
-rwxr-xr-xtest/fs/fscheck-bindnoroot.exp (renamed from test/fscheck-bindnoroot.exp)5
-rwxr-xr-xtest/fs/fscheck-private.exp50
-rwxr-xr-xtest/fs/fscheck-readonly.exp (renamed from test/fscheck-readonly.exp)3
-rwxr-xr-xtest/fs/fscheck-tmpfs.exp (renamed from test/fscheck-tmpfs.exp)2
-rwxr-xr-xtest/fs/invalid_filename.exp15
-rwxr-xr-xtest/fs/private-bin.exp22
-rwxr-xr-xtest/fs/private-etc.exp34
-rwxr-xr-xtest/fs/private-home.exp62
-rwxr-xr-xtest/fs/read-write.exp28
-rw-r--r--test/fs/testfile10
-rwxr-xr-xtest/fscheck-private.exp70
-rwxr-xr-xtest/rlimit/rlimit.sh14
-rwxr-xr-xtest/utils/firemon-cpu.exp1
-rwxr-xr-xtest/utils/firemon-interface.exp18
-rwxr-xr-xtest/utils/firemon-name.exp28
-rwxr-xr-xtest/utils/firemon-version.exp18
-rwxr-xr-xtest/utils/utils.sh9
45 files changed, 762 insertions, 119 deletions
diff --git a/test/appimage/appimage-v1.exp b/test/appimage/appimage-v1.exp
index 503da2b9b..f1c1c10f5 100755
--- a/test/appimage/appimage-v1.exp
+++ b/test/appimage/appimage-v1.exp
@@ -7,7 +7,7 @@ set timeout 10
7spawn $env(SHELL) 7spawn $env(SHELL)
8match_max 100000 8match_max 100000
9 9
10send -- "firejail --name=appimage-test --appimage Leafpad-0.8.17-x86_64.AppImage\r" 10send -- "firejail --name=appimage-test --debug --appimage Leafpad-0.8.17-x86_64.AppImage\r"
11expect { 11expect {
12 timeout {puts "TESTING ERROR 1\n";exit} 12 timeout {puts "TESTING ERROR 1\n";exit}
13 "Child process initialized" 13 "Child process initialized"
diff --git a/test/appimage/appimage.sh b/test/appimage/appimage.sh
index 6a73d0a7e..db221ec8a 100755
--- a/test/appimage/appimage.sh
+++ b/test/appimage/appimage.sh
@@ -10,5 +10,7 @@ echo "TESTING: AppImage v1 (test/appimage/appimage-v1.exp)"
10./appimage-v1.exp 10./appimage-v1.exp
11 11
12echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)" 12echo "TESTING: AppImage v2 (test/appimage/appimage-v2.exp)"
13./appimage-v1.exp 13./appimage-v2.exp
14 14
15echo "TESTING: AppImage file name (test/appimage/filename.exp)";
16./filename.exp \ No newline at end of file
diff --git a/test/appimage/filename.exp b/test/appimage/filename.exp
new file mode 100755
index 000000000..ce8d70464
--- /dev/null
+++ b/test/appimage/filename.exp
@@ -0,0 +1,35 @@
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 --appimage \"bla;bla\"\r"
11expect {
12 timeout {puts "TESTING ERROR 1\n";exit}
13 "is an invalid filename"
14}
15after 100
16
17send -- "firejail --appimage /etc/shadow\r"
18expect {
19 timeout {puts "TESTING ERROR 2\n";exit}
20 "cannot access"
21}
22after 100
23
24send -- "firejail --appimage appimage.sh\r"
25expect {
26 timeout {puts "TESTING ERROR 2\n";exit}
27 "Error mounting appimage"
28}
29after 100
30
31
32
33
34puts "\nall done\n"
35
diff --git a/test/chroot-resolvconf.exp b/test/chroot/chroot-resolvconf.exp
index 2d0da2fb0..2d0da2fb0 100755
--- a/test/chroot-resolvconf.exp
+++ b/test/chroot/chroot-resolvconf.exp
diff --git a/test/fs_chroot.exp b/test/chroot/fs_chroot.exp
index aeb5669e1..aeb5669e1 100755
--- a/test/fs_chroot.exp
+++ b/test/chroot/fs_chroot.exp
diff --git a/test/environment/dns.exp b/test/environment/dns.exp
index 6ffb124cf..a6a7171eb 100755
--- a/test/environment/dns.exp
+++ b/test/environment/dns.exp
@@ -22,9 +22,33 @@ expect {
22 timeout {puts "TESTING ERROR 1.2\n";exit} 22 timeout {puts "TESTING ERROR 1.2\n";exit}
23 "53" 23 "53"
24} 24}
25
26after 100 25after 100
27 26
28send -- "rm index.html\r" 27send -- "rm index.html\r"
29after 100 28after 100
29send -- "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
53
30puts "\nall done\n" 54puts "\nall done\n"
diff --git a/test/environment/environment.sh b/test/environment/environment.sh
index 5c4d49331..2bb5a249e 100755
--- a/test/environment/environment.sh
+++ b/test/environment/environment.sh
@@ -6,6 +6,7 @@
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8 8
9
9echo "TESTING: DNS (test/environment/dns.exp)" 10echo "TESTING: DNS (test/environment/dns.exp)"
10./dns.exp 11./dns.exp
11 12
@@ -85,3 +86,28 @@ else
85 echo "TESTING SKIP: strace not found" 86 echo "TESTING SKIP: strace not found"
86fi 87fi
87 88
89# to install ibus:
90# $ sudo apt-get install ibus-table-array30
91# $ ibus-setup
92
93find ~/.config/ibus/bus | grep unix-0
94if [ "$?" -eq 0 ];
95then
96 echo "TESTING: ibus (test/environment/ibus.exp)"
97 ./ibus.exp
98else
99 echo "TESTING SKIP: ibus not configured"
100fi
101
102echo "TESTING: rlimit (test/rlimit/rlimit.exp)"
103./rlimit.exp
104
105echo "TESTING: rlimit profile (test/rlimit/rlimit-profile.exp)"
106./rlimit-profile.exp
107
108echo "TESTING: rlimit errors (test/rlimit/rlimit-bad.exp)"
109./rlimit-bad.exp
110
111echo "TESTING: rlimit errors profile (test/rlimit/rlimit-bad-profile.exp)"
112./rlimit-bad-profile.exp
113
diff --git a/test/environment/ibus.exp b/test/environment/ibus.exp
new file mode 100755
index 000000000..4344011a6
--- /dev/null
+++ b/test/environment/ibus.exp
@@ -0,0 +1,28 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4cd /home
5spawn $env(SHELL)
6match_max 100000
7
8send -- "firejail\r"
9expect {
10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Child process initialized"
12}
13after 100
14
15send -- "env | grep IBUS\r"
16expect {
17 timeout {puts "TESTING ERROR 1\n";exit}
18 "IBUS_ADDRESS"
19}
20expect {
21 timeout {puts "TESTING ERROR 2\n";exit}
22 "IBUS_DAEMON_PID"
23}
24after 100
25
26
27puts "\nall done\n"
28
diff --git a/test/environment/rlimit-bad-profile.exp b/test/environment/rlimit-bad-profile.exp
new file mode 100755
index 000000000..80693a4a0
--- /dev/null
+++ b/test/environment/rlimit-bad-profile.exp
@@ -0,0 +1,35 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7
8send -- "firejail --profile=rlimit-bad1.profile\r"
9expect {
10 timeout {puts "TESTING ERROR 4\n";exit}
11 "Invalid rlimit option"
12}
13after 100
14
15send -- "firejail --profile=rlimit-bad2.profile\r"
16expect {
17 timeout {puts "TESTING ERROR 5\n";exit}
18 "Invalid rlimit option"
19}
20after 100
21
22send -- "firejail --profile=rlimit-bad3.profile\r"
23expect {
24 timeout {puts "TESTING ERROR 6\n";exit}
25 "Invalid rlimit option"
26}
27after 100
28send -- "firejail --profile=rlimit-bad4.profile\r"
29expect {
30 timeout {puts "TESTING ERROR 7\n";exit}
31 "Invalid rlimit option"
32}
33after 100
34
35puts "\nall done\n"
diff --git a/test/environment/rlimit-bad.exp b/test/environment/rlimit-bad.exp
new file mode 100755
index 000000000..574e7e174
--- /dev/null
+++ b/test/environment/rlimit-bad.exp
@@ -0,0 +1,34 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --rlimit-fsize=-1024\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "invalid rlimt fsize"
11}
12after 100
13
14send -- "firejail --rlimit-nofile=asdf\r"
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "invalid rlimt nofile"
18}
19after 100
20
21send -- "firejail --rlimit-nproc=100.23\r"
22expect {
23 timeout {puts "TESTING ERROR 2\n";exit}
24 "invalid rlimt nproc"
25}
26after 100
27send -- "firejail --rlimit-sigpending=2345-78\r"
28expect {
29 timeout {puts "TESTING ERROR 3\n";exit}
30 "invalid rlimt sigpending"
31}
32after 100
33
34puts "\nall done\n"
diff --git a/test/environment/rlimit-bad1.profile b/test/environment/rlimit-bad1.profile
new file mode 100644
index 000000000..b6d3340d8
--- /dev/null
+++ b/test/environment/rlimit-bad1.profile
@@ -0,0 +1 @@
rlimit-fsize -1024
diff --git a/test/environment/rlimit-bad2.profile b/test/environment/rlimit-bad2.profile
new file mode 100644
index 000000000..ef3f243c6
--- /dev/null
+++ b/test/environment/rlimit-bad2.profile
@@ -0,0 +1 @@
rlimit-nofile asdf
diff --git a/test/environment/rlimit-bad3.profile b/test/environment/rlimit-bad3.profile
new file mode 100644
index 000000000..af016a29f
--- /dev/null
+++ b/test/environment/rlimit-bad3.profile
@@ -0,0 +1 @@
rlimit-nproc 100.23
diff --git a/test/environment/rlimit-bad4.profile b/test/environment/rlimit-bad4.profile
new file mode 100644
index 000000000..aabe3d008
--- /dev/null
+++ b/test/environment/rlimit-bad4.profile
@@ -0,0 +1 @@
rlimit-sigpending 67asd56 \ No newline at end of file
diff --git a/test/rlimit/rlimit-profile.exp b/test/environment/rlimit-profile.exp
index a9e54a405..a9e54a405 100755
--- a/test/rlimit/rlimit-profile.exp
+++ b/test/environment/rlimit-profile.exp
diff --git a/test/rlimit/rlimit.exp b/test/environment/rlimit.exp
index 611f69821..611f69821 100755
--- a/test/rlimit/rlimit.exp
+++ b/test/environment/rlimit.exp
diff --git a/test/rlimit/rlimit.profile b/test/environment/rlimit.profile
index 271891c03..271891c03 100644
--- a/test/rlimit/rlimit.profile
+++ b/test/environment/rlimit.profile
diff --git a/test/fcopy/cmdline.exp b/test/fcopy/cmdline.exp
new file mode 100755
index 000000000..24bb19351
--- /dev/null
+++ b/test/fcopy/cmdline.exp
@@ -0,0 +1,46 @@
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 -- "/usr/lib/firejail/fcopy\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "files missing"
14}
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "Usage:"
18}
19after 100
20
21send -- "/usr/lib/firejail/fcopy foo\r"
22expect {
23 timeout {puts "TESTING ERROR 2\n";exit}
24 "files missing"
25}
26expect {
27 timeout {puts "TESTING ERROR 3\n";exit}
28 "Usage:"
29}
30after 100
31
32send -- "/usr/lib/firejail/fcopy f%oo1 foo2\r"
33expect {
34 timeout {puts "TESTING ERROR 4\n";exit}
35 "invalid file name"
36}
37after 100
38
39send -- "/usr/lib/firejail/fcopy foo1 f,oo2\r"
40expect {
41 timeout {puts "TESTING ERROR 5\n";exit}
42 "invalid file name"
43}
44after 100
45
46puts "\nall done\n"
diff --git a/test/fcopy/dircopy.exp b/test/fcopy/dircopy.exp
new file mode 100755
index 000000000..00b0204ae
--- /dev/null
+++ b/test/fcopy/dircopy.exp
@@ -0,0 +1,106 @@
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
6#
7# copy directory src to dest
8#
9set timeout 10
10spawn $env(SHELL)
11match_max 100000
12
13send -- "rm -fr dest/*\r"
14after 100
15
16send -- "/usr/lib/firejail/fcopy src dest\r"
17after 100
18
19send -- "find dest\r"
20expect {
21 timeout {puts "TESTING ERROR 0\n";exit}
22 "dest/"
23}
24expect {
25 timeout {puts "TESTING ERROR 1\n";exit}
26 "dest/a"
27}
28expect {
29 timeout {puts "TESTING ERROR 2\n";exit}
30 "dest/a/b"
31}
32expect {
33 timeout {puts "TESTING ERROR 3\n";exit}
34 "dest/a/b/file4"
35}
36expect {
37 timeout {puts "TESTING ERROR 4\n";exit}
38 "dest/a/file3"
39}
40expect {
41 timeout {puts "TESTING ERROR 5\n";exit}
42 "dest/dircopy.exp"
43}
44expect {
45 timeout {puts "TESTING ERROR 6\n";exit}
46 "dest/file2"
47}
48expect {
49 timeout {puts "TESTING ERROR 7\n";exit}
50 "dest/file1"
51}
52after 100
53
54
55send -- "ls -al dest\r"
56expect {
57 timeout {puts "TESTING ERROR 8\n";exit}
58 "drwxr-xr-x"
59}
60expect {
61 timeout {puts "TESTING ERROR 9\n";exit}
62 "a"
63}
64expect {
65 timeout {puts "TESTING ERROR 10\n";exit}
66 "lrwxrwxrwx"
67}
68expect {
69 timeout {puts "TESTING ERROR 11\n";exit}
70 "dircopy.exp"
71}
72expect {
73 timeout {puts "TESTING ERROR 12\n";exit}
74 "rwxr-xr-x"
75}
76expect {
77 timeout {puts "TESTING ERROR 13\n";exit}
78 "file1"
79}
80expect {
81 timeout {puts "TESTING ERROR 14\n";exit}
82 "rw-r--r--"
83}
84expect {
85 timeout {puts "TESTING ERROR 15\n";exit}
86 "file2"
87}
88after 100
89
90send -- "diff -q src/a/b/file4 dest/a/b/file4; echo done\r"
91expect {
92 timeout {puts "TESTING ERROR 16\n";exit}
93 "differ" {puts "TESTING ERROR 17\n";exit}
94 "done"
95}
96
97send -- "file dest/dircopy.exp\r"
98expect {
99 timeout {puts "TESTING ERROR 18\n";exit}
100 "symbolic link"
101}
102
103send -- "rm -fr dest/*\r"
104after 100
105
106puts "\nall done\n"
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh
new file mode 100755
index 000000000..dcda5ca31
--- /dev/null
+++ b/test/fcopy/fcopy.sh
@@ -0,0 +1,23 @@
1#!/bin/bash
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
5
6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8
9mkdir dest
10
11echo "TESTING: fcopy cmdline (test/fcopy/cmdline.exp)"
12./cmdline.exp
13
14echo "TESTING: fcopy directory (test/fcopy/dircopy.exp)"
15./dircopy.exp
16
17echo "TESTING: fcopy file (test/fcopy/filecopy.exp)"
18./filecopy.exp
19
20echo "TESTING: fcopy link (test/fcopy/linkcopy.exp)"
21./linkcopy.exp
22
23rm -fr dest/*
diff --git a/test/fcopy/filecopy.exp b/test/fcopy/filecopy.exp
new file mode 100755
index 000000000..d1f0a4424
--- /dev/null
+++ b/test/fcopy/filecopy.exp
@@ -0,0 +1,54 @@
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
6#
7# copy directory src to dest
8#
9set timeout 10
10spawn $env(SHELL)
11match_max 100000
12
13send -- "rm -fr dest/*\r"
14after 100
15
16send -- "/usr/lib/firejail/fcopy dircopy.exp dest\r"
17after 100
18
19send -- "find dest\r"
20expect {
21 timeout {puts "TESTING ERROR 0\n";exit}
22 "dest/"
23}
24expect {
25 timeout {puts "TESTING ERROR 1\n";exit}
26 "dest/dircopy.exp"
27}
28after 100
29
30
31send -- "ls -al dest\r"
32expect {
33 timeout {puts "TESTING ERROR 2\n";exit}
34 "rwxr-xr-x"
35}
36after 100
37
38send -- "diff -q dircopy.exp dest/dircopy.exp; echo done\r"
39expect {
40 timeout {puts "TESTING ERROR 3\n";exit}
41 "differ" {puts "TESTING ERROR 4\n";exit}
42 "done"
43}
44
45send -- "file dest/dircopy.exp\r"
46expect {
47 timeout {puts "TESTING ERROR 5\n";exit}
48 "ASCII text"
49}
50
51send -- "rm -fr dest/*\r"
52after 100
53
54puts "\nall done\n"
diff --git a/test/fcopy/linkcopy.exp b/test/fcopy/linkcopy.exp
new file mode 100755
index 000000000..9927e18fe
--- /dev/null
+++ b/test/fcopy/linkcopy.exp
@@ -0,0 +1,54 @@
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
6#
7# copy directory src to dest
8#
9set timeout 10
10spawn $env(SHELL)
11match_max 100000
12
13send -- "rm -fr dest/*\r"
14after 100
15
16send -- "/usr/lib/firejail/fcopy src/dircopy.exp dest\r"
17after 100
18
19send -- "find dest\r"
20expect {
21 timeout {puts "TESTING ERROR 0\n";exit}
22 "dest/"
23}
24expect {
25 timeout {puts "TESTING ERROR 1\n";exit}
26 "dest/dircopy.exp"
27}
28after 100
29
30
31send -- "ls -al dest\r"
32expect {
33 timeout {puts "TESTING ERROR 2\n";exit}
34 "lrwxrwxrwx"
35}
36after 100
37
38send -- "diff -q dircopy.exp dest/dircopy.exp; echo done\r"
39expect {
40 timeout {puts "TESTING ERROR 3\n";exit}
41 "differ" {puts "TESTING ERROR 4\n";exit}
42 "done"
43}
44
45send -- "file dest/dircopy.exp\r"
46expect {
47 timeout {puts "TESTING ERROR 5\n";exit}
48 "symbolic link"
49}
50
51send -- "rm -fr dest/*\r"
52after 100
53
54puts "\nall done\n"
diff --git a/test/fcopy/src/a/b/file4 b/test/fcopy/src/a/b/file4
new file mode 100644
index 000000000..ac318d7ab
--- /dev/null
+++ b/test/fcopy/src/a/b/file4
@@ -0,0 +1,11 @@
1
2
3Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam interdum at massa non aliquam. Maecenas molestie id orci volutpat porta. Praesent aliquam nunc quis mi tristique, ac feugiat enim rutrum. Nulla vitae metus sodales, pellentesque risus sit amet, volutpat nisl. Curabitur accumsan arcu congue lacus porta laoreet. Nulla facilisi. Integer nec augue id magna gravida tincidunt id vitae lorem. Curabitur facilisis, tellus vel pellentesque pretium, odio dolor efficitur lorem, et tincidunt dui enim cursus lacus. Cras a orci ac magna semper dapibus nec et velit. Nullam aliquam sollicitudin auctor.
4
5Mauris ac quam vel purus volutpat semper eget a ante. Curabitur arcu nisl, dapibus ac lectus ac, porttitor fermentum metus. Aliquam et sem aliquam magna interdum ultricies at eu orci. Aenean tortor augue, volutpat nec magna nec, rutrum bibendum justo. Vivamus ex quam, auctor ut pellentesque mattis, aliquet a eros. Etiam ac lacus ac ante ullamcorper sollicitudin a quis orci. Suspendisse quis justo ac mauris cursus finibus quis at elit. Vestibulum elementum finibus diam, eget convallis purus aliquet et. Fusce fermentum ornare urna, non ornare nisl tincidunt consectetur. Donec et lacus vitae ex eleifend porttitor id ut odio. Quisque luctus eget lorem et sollicitudin.
6
7Aliquam libero elit, finibus a nisl a, commodo viverra turpis. Nam pulvinar in est sit amet fermentum. Praesent scelerisque tempus lectus, ac porta elit sodales rutrum. Duis faucibus faucibus urna eget accumsan. Vivamus in turpis ut massa rhoncus pretium nec et lorem. Aenean at tellus eget metus porta ornare. Aliquam erat volutpat. Donec hendrerit a massa vel malesuada. Integer varius sapien et orci viverra pretium. In at velit aliquet, vulputate nisi lobortis, aliquam augue.
8
9Ut aliquam turpis ut lorem aliquam, in faucibus elit pulvinar. Vivamus viverra tortor ornare, lacinia leo sit amet, auctor arcu. Sed erat leo, pellentesque vel nibh a, malesuada vehicula purus. Vivamus est dolor, aliquet quis facilisis fermentum, varius in dolor. Nunc quis libero feugiat, imperdiet est vitae, mollis risus. Vestibulum elementum mattis lorem vitae gravida. Nullam id tellus interdum, aliquam erat eu, laoreet nunc. Aliquam ut felis vel mauris maximus pellentesque.
10
11Vestibulum tempus mauris eget ex interdum, vitae vehicula tortor sollicitudin. Pellentesque et dolor cursus dui vulputate laoreet. Morbi eu bibendum quam, at ultrices elit. Vestibulum dictum enim sit amet ultricies imperdiet. Praesent congue magna ac mauris mattis, a iaculis ante aliquet. Vivamus at egestas ex. Suspendisse orci dolor, pharetra at aliquam a, faucibus facilisis leo. Quisque semper lorem eget elit commodo pretium. Aenean posuere augue quis arcu finibus, sit amet fringilla risus congue. Pellentesque rutrum nunc leo, aliquam lobortis lacus molestie nec. Donec convallis congue diam, ullamcorper vestibulum dui varius nec. Praesent pellentesque nisi risus. In aliquam molestie malesuada. Nulla facilisis a risus eu tristique. Morbi molestie et arcu quis efficitur. Curabitur cursus vestibulum luctus.
diff --git a/test/fcopy/src/a/file3 b/test/fcopy/src/a/file3
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fcopy/src/a/file3
diff --git a/test/fcopy/src/dircopy.exp b/test/fcopy/src/dircopy.exp
new file mode 120000
index 000000000..2acf88f7b
--- /dev/null
+++ b/test/fcopy/src/dircopy.exp
@@ -0,0 +1 @@
../dircopy.exp \ No newline at end of file
diff --git a/test/fcopy/src/file1 b/test/fcopy/src/file1
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fcopy/src/file1
diff --git a/test/fcopy/src/file2 b/test/fcopy/src/file2
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fcopy/src/file2
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index efbf505ee..1c5473f79 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -82,10 +82,21 @@ echo "TESTING: recursive mkdir (test/fs/mkdir.exp)"
82echo "TESTING: double whitelist (test/fs/whitelist-double.exp)" 82echo "TESTING: double whitelist (test/fs/whitelist-double.exp)"
83./whitelist-double.exp 83./whitelist-double.exp
84 84
85
86echo "TESTING: whitelist (test/fs/whitelist.exp)" 85echo "TESTING: whitelist (test/fs/whitelist.exp)"
87./whitelist.exp 86./whitelist.exp
88 87
88echo "TESTING: fscheck --bind non root (test/fs/fscheck-bindnoroot.exp)"
89./fscheck-bindnoroot.exp
90
91echo "TESTING: fscheck --tmpfs non root (test/fs/fscheck-tmpfs.exp)"
92./fscheck-tmpfs.exp
93
94echo "TESTING: fscheck --private= (test/fs/fscheck-private.exp)"
95./fscheck-private.exp
96
97echo "TESTING: fscheck --read-only= (test/fs/fscheck-readonly.exp)"
98./fscheck-readonly.exp
99
89#cleanup 100#cleanup
90rm -fr ~/fjtest-dir 101rm -fr ~/fjtest-dir
91rm -fr ~/fjtest-dir-lnk 102rm -fr ~/fjtest-dir-lnk
diff --git a/test/fscheck-bindnoroot.exp b/test/fs/fscheck-bindnoroot.exp
index 796a7d975..8cbe2b8af 100755
--- a/test/fscheck-bindnoroot.exp
+++ b/test/fs/fscheck-bindnoroot.exp
@@ -5,10 +5,13 @@ spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7# dir 7# dir
8send -- "firejail --net=br0 --bind=fscheck-dir,/etc\r" 8send -- "firejail --net=br0 --bind=testdir1,/etc\r"
9expect { 9expect {
10 timeout {puts "TESTING ERROR 0\n";exit} 10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Error" 11 "Error"
12} 12}
13after 100 13after 100
14 14
15puts "\nall done\n"
16
17
diff --git a/test/fs/fscheck-private.exp b/test/fs/fscheck-private.exp
new file mode 100755
index 000000000..28c921538
--- /dev/null
+++ b/test/fs/fscheck-private.exp
@@ -0,0 +1,50 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7
8
9# file link
10#send -- "firejail --private=fscheck-file-link\r"
11#expect {
12# timeout {puts "TESTING ERROR 2\n";exit}
13# "Error"
14#}
15#after 100
16
17# file
18send -- "firejail --private=testfile1\r"
19expect {
20 timeout {puts "TESTING ERROR 2.1\n";exit}
21 "Error"
22}
23after 100
24
25# ..
26send -- "firejail --private=../fs/testfile1\r"
27expect {
28 timeout {puts "TESTING ERROR 2.2\n";exit}
29 "Error"
30}
31after 100
32
33# no file
34send -- "firejail --private=../test/nodir\r"
35expect {
36 timeout {puts "TESTING ERROR 3\n";exit}
37 "Error"
38}
39after 100
40
41# same owner
42send -- "firejail --private=/etc\r"
43expect {
44 timeout {puts "TESTING ERROR 4\n";exit}
45 "Error"
46}
47after 100
48
49puts "\nall done\n"
50
diff --git a/test/fscheck-readonly.exp b/test/fs/fscheck-readonly.exp
index e0f0a8a1d..4d7528e50 100755
--- a/test/fscheck-readonly.exp
+++ b/test/fs/fscheck-readonly.exp
@@ -5,10 +5,11 @@ spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7# dir 7# dir
8send -- "firejail --net=br0 --read-only=../test/fscheck-dir\r" 8send -- "firejail --read-only=../test/testdir1\r"
9expect { 9expect {
10 timeout {puts "TESTING ERROR 0\n";exit} 10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Error" 11 "Error"
12} 12}
13after 100 13after 100
14 14
15puts "\nall done\n"
diff --git a/test/fscheck-tmpfs.exp b/test/fs/fscheck-tmpfs.exp
index d5bbccd96..deac5a631 100755
--- a/test/fscheck-tmpfs.exp
+++ b/test/fs/fscheck-tmpfs.exp
@@ -5,7 +5,7 @@ spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7# .. 7# ..
8send -- "firejail --net=br0 --tmpfs=../test/fscheck-dir\r" 8send -- "firejail --tmpfs=fscheck-dir\r"
9expect { 9expect {
10 timeout {puts "TESTING ERROR 0.1\n";exit} 10 timeout {puts "TESTING ERROR 0.1\n";exit}
11 "Error" 11 "Error"
diff --git a/test/fs/invalid_filename.exp b/test/fs/invalid_filename.exp
index 1acc85491..a6efc24b6 100755
--- a/test/fs/invalid_filename.exp
+++ b/test/fs/invalid_filename.exp
@@ -109,6 +109,21 @@ expect {
109} 109}
110after 100 110after 100
111 111
112send -- "firejail --debug-check-filename --noprofile --private-home=\"bla&&bla\"\r"
113expect {
114 timeout {puts "TESTING ERROR 8.1\n";exit}
115 "Checking filename bla&&bla"
116}
117expect {
118 timeout {puts "TESTING ERROR 8.2\n";exit}
119 "Error:"
120}
121expect {
122 timeout {puts "TESTING ERROR 8.3\n";exit}
123 "is an invalid filename"
124}
125after 100
126
112send -- "firejail --debug-check-filename --noprofile --private-etc=\"bla&&bla\"\r" 127send -- "firejail --debug-check-filename --noprofile --private-etc=\"bla&&bla\"\r"
113expect { 128expect {
114 timeout {puts "TESTING ERROR 9.1\n";exit} 129 timeout {puts "TESTING ERROR 9.1\n";exit}
diff --git a/test/fs/private-bin.exp b/test/fs/private-bin.exp
index fe9468be9..f7181d218 100755
--- a/test/fs/private-bin.exp
+++ b/test/fs/private-bin.exp
@@ -65,6 +65,28 @@ expect {
65 "sh" 65 "sh"
66} 66}
67send -- "exit\r" 67send -- "exit\r"
68after 100
69
70
71send -- "firejail --private-bin=/etc/shadow\r"
72expect {
73 timeout {puts "TESTING ERROR 8\n";exit}
74 "invalid filename"
75}
76after 100
77
78send -- "firejail --private-bin=\"bla;bla\"\r"
79expect {
80 timeout {puts "TESTING ERROR 9\n";exit}
81 "is an invalid filename"
82}
83after 100
84
85send -- "firejail --private-etc=../bin/ls\r"
86expect {
87 timeout {puts "TESTING ERROR 10\n";exit}
88 "is an invalid filename"
89}
68 90
69after 100 91after 100
70puts "\nall done\n" 92puts "\nall done\n"
diff --git a/test/fs/private-etc.exp b/test/fs/private-etc.exp
index e692f7382..36b5d247c 100755
--- a/test/fs/private-etc.exp
+++ b/test/fs/private-etc.exp
@@ -33,12 +33,40 @@ expect {
33 "resolv.conf" 33 "resolv.conf"
34} 34}
35 35
36send -- "ls -al /etc; echo done\r" 36
37send -- "file /etc/shadow\r"
37expect { 38expect {
38 timeout {puts "TESTING ERROR 7\n";exit} 39 timeout {puts "TESTING ERROR 7\n";exit}
39 "shadow" {puts "TESTING ERROR 8\n";exit} 40 "No such file or directory"
40 "done" 41}
42after 100
43send -- "exit\r"
44sleep 1
45
46send -- "firejail --private-etc=shadow\r"
47expect {
48 timeout {puts "TESTING ERROR 8\n";exit}
49 "invalid file type"
50}
51after 100
52
53send -- "firejail --private-etc=\"bla;bla\"\r"
54expect {
55 timeout {puts "TESTING ERROR 9\n";exit}
56 "is an invalid filename"
41} 57}
58after 100
59
60send -- "firejail --private-etc=../bin/ls\r"
61expect {
62 timeout {puts "TESTING ERROR 10\n";exit}
63 "is an invalid filename"
64}
65after 100
66
67
68
69
42 70
43after 100 71after 100
44puts "\nall done\n" 72puts "\nall done\n"
diff --git a/test/fs/private-home.exp b/test/fs/private-home.exp
index de5a88dea..3840d1cb8 100755
--- a/test/fs/private-home.exp
+++ b/test/fs/private-home.exp
@@ -9,11 +9,19 @@ match_max 100000
9 9
10# create some test files in user home directory 10# create some test files in user home directory
11send -- "touch ~/_firejail_test_file1\r" 11send -- "touch ~/_firejail_test_file1\r"
12after 100
12send -- "touch ~/_firejail_test_file2\r" 13send -- "touch ~/_firejail_test_file2\r"
14after 100
13send -- "mkdir ~/_firejail_test_dir1\r" 15send -- "mkdir ~/_firejail_test_dir1\r"
16after 100
14send -- "mkdir ~/_firejail_test_dir1/_firejail_test_dir2\r" 17send -- "mkdir ~/_firejail_test_dir1/_firejail_test_dir2\r"
18after 100
15send -- "touch ~/_firejail_test_dir1/_firejail_test_dir2/_firejail_test_file3\r" 19send -- "touch ~/_firejail_test_dir1/_firejail_test_dir2/_firejail_test_file3\r"
16after 100 20after 100
21send -- "ln -s /etc ~/_firejail_test_link1\r"
22after 100
23send -- "ln -s ~/_firejail_test_dir1 ~/_firejail_test_link2\r"
24after 100
17 25
18send -- "firejail --private-home=_firejail_test_file1,_firejail_test_file2,_firejail_test_dir1\r" 26send -- "firejail --private-home=_firejail_test_file1,_firejail_test_file2,_firejail_test_dir1\r"
19expect { 27expect {
@@ -37,8 +45,58 @@ expect {
37} 45}
38after 100 46after 100
39 47
40send -- "rm -f ~/_firejail_test_file*\r" 48send -- "exit\r"
41send -- "rm -fr ~/_firejail_test_dir*\r" 49sleep 1
50
51send -- "firejail --private-home=\"bla;bla\"\r"
52expect {
53 timeout {puts "TESTING ERROR 5\n";exit}
54 "is an invalid filename"
55}
56after 100
57
58send -- "firejail --private-home=/etc/shadow\r"
59expect {
60 timeout {puts "TESTING ERROR 6\n";exit}
61 "invalid file"
62}
63after 100
64
65send -- "firejail --private-home=/etc/passwd\r"
66expect {
67 timeout {puts "TESTING ERROR 7\n";exit}
68 "invalid file"
69}
70after 100
71
72send -- "firejail --private-home=../../etc/passwd\r"
73expect {
74 timeout {puts "TESTING ERROR 8\n";exit}
75 "invalid file"
76}
77after 100
78
79send -- "firejail --private-home=_firejail_test_link1\r"
80expect {
81 timeout {puts "TESTING ERROR 9\n";exit}
82 "to file or directory not owned by the user"
83}
84after 100
85
86send -- "firejail --private-home=_firejail_test_link2\r"
87expect {
88 timeout {puts "TESTING ERROR 10\n";exit}
89 "Child process initialized"
90}
91after 100
92send -- "file file ~/_firejail_test_link2\r"
93expect {
94 timeout {puts "TESTING ERROR 11\n";exit}
95 "broken symbolic link"
96}
97send -- "exit\r"
98
99send -- "rm -f ~/_firejail_test*\r"
42after 100 100after 100
43 101
44puts "\nall done\n" 102puts "\nall done\n"
diff --git a/test/fs/read-write.exp b/test/fs/read-write.exp
index 57986488e..19a915f66 100755
--- a/test/fs/read-write.exp
+++ b/test/fs/read-write.exp
@@ -15,37 +15,21 @@ expect {
15} 15}
16sleep 1 16sleep 1
17 17
18send -- "echo mytest >~/_firejail_test_dir/a;echo done\r" 18send -- "echo mytest > ~/_firejail_test_dir/a\r"
19expect { 19expect {
20 timeout {puts "TESTING ERROR 1\n";exit} 20 timeout {puts "TESTING ERROR 5\n";exit}
21 "done" 21 "Read-only file system"
22}
23after 100
24
25send -- "echo mytest >~/_firejail_test_dir/test1/b;echo done\r"
26expect {
27 timeout {puts "TESTING ERROR 2\n";exit}
28 "done"
29} 22}
30after 100 23after 100
31 24
32send -- "cat ~/_firejail_test_dir/a;echo done\r" 25send -- "echo mytest > ~/_firejail_test_dir/test1/b\r"
33expect { 26sleep 1
34 timeout {puts "TESTING ERROR 3\n";exit}
35 "mytest" {puts "TESTING ERROR 4\n";exit}
36 "done"
37}
38after 100
39 27
40send -- "cat ~/_firejail_test_dir/test1/b;echo done\r" 28send -- "cat ~/_firejail_test_dir/test1/b\r"
41expect { 29expect {
42 timeout {puts "TESTING ERROR 5\n";exit} 30 timeout {puts "TESTING ERROR 5\n";exit}
43 "mytest" 31 "mytest"
44} 32}
45expect {
46 timeout {puts "TESTING ERROR 6\n";exit}
47 "done"
48}
49 33
50after 100 34after 100
51puts "\nall done\n" 35puts "\nall done\n"
diff --git a/test/fs/testfile1 b/test/fs/testfile1
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fs/testfile1
diff --git a/test/fscheck-private.exp b/test/fscheck-private.exp
deleted file mode 100755
index 8e485cc03..000000000
--- a/test/fscheck-private.exp
+++ /dev/null
@@ -1,70 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7
8# ..
9#send -- "firejail --net=br0 --private=../test/fscheck-dir\r"
10#expect {
11# timeout {puts "TESTING ERROR 0.1\n";exit}
12# "Error"
13#}
14#after 100
15
16# dir link
17#send -- "firejail --net=br0 --private=fscheck-dir-link\r"
18#expect {
19# timeout {puts "TESTING ERROR 1\n";exit}
20# "Error"
21#}
22#after 100
23
24# ..
25#send -- "firejail --net=br0 --private=../test/fscheck-dir-link\r"
26#expect {
27# timeout {puts "TESTING ERROR 1.1\n";exit}
28# "Error"
29#}
30#after 100
31
32# file link
33send -- "firejail --net=br0 --private=fscheck-file-link\r"
34expect {
35 timeout {puts "TESTING ERROR 2\n";exit}
36 "Error"
37}
38after 100
39
40# file
41send -- "firejail --net=br0 --private=fscheck-file\r"
42expect {
43 timeout {puts "TESTING ERROR 2.1\n";exit}
44 "Error"
45}
46after 100
47
48# ..
49send -- "firejail --net=br0 --private=../test/fscheck-file\r"
50expect {
51 timeout {puts "TESTING ERROR 2.2\n";exit}
52 "Error"
53}
54after 100
55
56# no file
57send -- "firejail --net=br0 --private=../test/nodir\r"
58expect {
59 timeout {puts "TESTING ERROR 3\n";exit}
60 "Error"
61}
62after 100
63
64# same owner
65send -- "firejail --net=br0 --private=/etc\r"
66expect {
67 timeout {puts "TESTING ERROR 4\n";exit}
68 "Error"
69}
70after 100
diff --git a/test/rlimit/rlimit.sh b/test/rlimit/rlimit.sh
deleted file mode 100755
index d85497176..000000000
--- a/test/rlimit/rlimit.sh
+++ /dev/null
@@ -1,14 +0,0 @@
1#!/bin/bash
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
5
6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8
9echo "TESTING: rlimit (test/rlimit/rlimit.exp)"
10./rlimit.exp
11
12echo "TESTING: rlimit profile (test/rlimit/rlimit-profile.exp)"
13./rlimit-profile.exp
14
diff --git a/test/utils/firemon-cpu.exp b/test/utils/firemon-cpu.exp
index f2ecd4a5c..00156c909 100755
--- a/test/utils/firemon-cpu.exp
+++ b/test/utils/firemon-cpu.exp
@@ -24,7 +24,6 @@ sleep 1
24 24
25spawn $env(SHELL) 25spawn $env(SHELL)
26send -- "firemon --cpu\r" 26send -- "firemon --cpu\r"
27sleep 4
28expect { 27expect {
29 timeout {puts "TESTING ERROR 2\n";exit} 28 timeout {puts "TESTING ERROR 2\n";exit}
30 "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} 29 "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit}
diff --git a/test/utils/firemon-interface.exp b/test/utils/firemon-interface.exp
new file mode 100755
index 000000000..edafd1639
--- /dev/null
+++ b/test/utils/firemon-interface.exp
@@ -0,0 +1,18 @@
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 -- "firemon --interface\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "you need to be root"
14}
15after 100
16
17puts "\nall done\n"
18
diff --git a/test/utils/firemon-name.exp b/test/utils/firemon-name.exp
new file mode 100755
index 000000000..c5dbfabab
--- /dev/null
+++ b/test/utils/firemon-name.exp
@@ -0,0 +1,28 @@
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 --name=test\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 1
16
17spawn $env(SHELL)
18send -- "firemon --cpu --name=test\r"
19expect {
20 timeout {puts "TESTING ERROR 2\n";exit}
21 "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit}
22 "Cpus_allowed_list"
23}
24
25after 100
26
27puts "\nall done\n"
28
diff --git a/test/utils/firemon-version.exp b/test/utils/firemon-version.exp
new file mode 100755
index 000000000..639c15c29
--- /dev/null
+++ b/test/utils/firemon-version.exp
@@ -0,0 +1,18 @@
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 -- "firemon --version\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "firemon version"
14}
15after 100
16
17puts "\nall done\n"
18
diff --git a/test/utils/utils.sh b/test/utils/utils.sh
index bd91110f7..804e5ae0f 100755
--- a/test/utils/utils.sh
+++ b/test/utils/utils.sh
@@ -100,3 +100,12 @@ echo "TESTING: firemon cpu (test/utils/firemon-cpu.exp)"
100echo "TESTING: firemon cgroup (test/utils/firemon-cgroup.exp)" 100echo "TESTING: firemon cgroup (test/utils/firemon-cgroup.exp)"
101./firemon-cgroup.exp 101./firemon-cgroup.exp
102 102
103echo "TESTING: firemon version (test/utils/firemon-version.exp)"
104./firemon-version.exp
105
106echo "TESTING: firemon interface (test/utils/firemon-interface.exp)"
107./firemon-interface.exp
108
109echo "TESTING: firemon name (test/utils/firemon-name.exp)"
110./firemon-name.exp
111