aboutsummaryrefslogtreecommitdiffstats
path: root/test/features
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-11-22 13:15:13 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2015-11-22 13:15:13 -0500
commita8d758ba9e7314de9208e4b7d4a5307d1b4fefd0 (patch)
tree4002cad80b79157ef2c300ca8f12625a5b0b8b17 /test/features
parentfixes (diff)
downloadfirejail-a8d758ba9e7314de9208e4b7d4a5307d1b4fefd0.tar.gz
firejail-a8d758ba9e7314de9208e4b7d4a5307d1b4fefd0.tar.zst
firejail-a8d758ba9e7314de9208e4b7d4a5307d1b4fefd0.zip
feature test
Diffstat (limited to 'test/features')
-rwxr-xr-xtest/features/1.1.exp69
-rwxr-xr-xtest/features/1.2.exp141
-rwxr-xr-xtest/features/1.5.exp69
-rwxr-xr-xtest/features/1.6.exp69
-rwxr-xr-xtest/features/1.7.exp71
-rwxr-xr-xtest/features/1.8.exp71
-rw-r--r--test/features/features.txt64
-rwxr-xr-xtest/features/test.sh24
8 files changed, 578 insertions, 0 deletions
diff --git a/test/features/1.1.exp b/test/features/1.1.exp
new file mode 100755
index 000000000..41443a080
--- /dev/null
+++ b/test/features/1.1.exp
@@ -0,0 +1,69 @@
1#!/usr/bin/expect -f
2#
3# new /boot
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "firejail --noprofile\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18sleep 1
19
20send -- "ls -l /boot | wc -l\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "1"
24}
25after 100
26send -- "exit\r"
27sleep 1
28
29
30#
31# O
32#
33send -- "firejail --noprofile --overlay\r"
34expect {
35 timeout {puts "TESTING ERROR 2\n";exit}
36 "Child process initialized"
37}
38sleep 1
39
40send -- "ls -l /boot | wc -l\r"
41expect {
42 timeout {puts "TESTING ERROR 3\n";exit}
43 "1"
44}
45after 100
46send -- "exit\r"
47sleep 1
48
49#
50# C
51#
52send -- "firejail --noprofile --chroot=/tmp/chroot\r"
53expect {
54 timeout {puts "TESTING ERROR 3\n";exit}
55 "Child process initialized"
56}
57sleep 1
58
59send -- "ls -l /boot | wc -l\r"
60expect {
61 timeout {puts "TESTING ERROR 4\n";exit}
62 "1"
63}
64after 100
65send -- "exit\r"
66sleep 1
67
68
69puts "\nall done\n"
diff --git a/test/features/1.2.exp b/test/features/1.2.exp
new file mode 100755
index 000000000..399e9948b
--- /dev/null
+++ b/test/features/1.2.exp
@@ -0,0 +1,141 @@
1#!/usr/bin/expect -f
2#
3# new /proc
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "firejail --noprofile\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18sleep 1
19
20send -- "cat /proc/mounts | grep proc\r"
21expect {
22 timeout {puts "TESTING ERROR 1.1\n";exit}
23 "proc /proc proc"
24}
25expect {
26 timeout {puts "TESTING ERROR 1.2\n";exit}
27 "proc /proc proc"
28}
29expect {
30 timeout {puts "TESTING ERROR 1.3\n";exit}
31 "proc /proc/sys proc"
32}
33expect {
34 timeout {puts "TESTING ERROR 1.4\n";exit}
35 "proc /proc/sysrq-trigger proc"
36}
37expect {
38 timeout {puts "TESTING ERROR 1.5\n";exit}
39 "proc /proc/sys/kernel/hotplug"
40}
41expect {
42 timeout {puts "TESTING ERROR 1.6\n";exit}
43 "proc /proc/irq proc"
44}
45expect {
46 timeout {puts "TESTING ERROR 1.7\n";exit}
47 "proc /proc/bus proc"
48}
49after 100
50send -- "exit\r"
51sleep 1
52
53
54#
55# O
56#
57send -- "firejail --noprofile --overlay\r"
58expect {
59 timeout {puts "TESTING ERROR 2\n";exit}
60 "Child process initialized"
61}
62sleep 1
63
64send -- "cat /proc/mounts | grep proc\r"
65expect {
66 timeout {puts "TESTING ERROR 3.1\n";exit}
67 "proc /proc proc"
68}
69expect {
70 timeout {puts "TESTING ERROR 3.2\n";exit}
71 "proc /proc proc"
72}
73expect {
74 timeout {puts "TESTING ERROR 3.3\n";exit}
75 "proc /proc/sys proc"
76}
77expect {
78 timeout {puts "TESTING ERROR 3.4\n";exit}
79 "proc /proc/sysrq-trigger proc"
80}
81expect {
82 timeout {puts "TESTING ERROR 3.5\n";exit}
83 "proc /proc/sys/kernel/hotplug"
84}
85expect {
86 timeout {puts "TESTING ERROR 3.6\n";exit}
87 "proc /proc/irq proc"
88}
89expect {
90 timeout {puts "TESTING ERROR 3.7\n";exit}
91 "proc /proc/bus proc"
92}
93after 100
94send -- "exit\r"
95sleep 1
96
97#
98# C
99#
100send -- "firejail --noprofile --chroot=/tmp/chroot\r"
101expect {
102 timeout {puts "TESTING ERROR 4\n";exit}
103 "Child process initialized"
104}
105sleep 1
106
107send -- "cat /proc/mounts | grep proc\r"
108expect {
109 timeout {puts "TESTING ERROR 5.1\n";exit}
110 "proc /proc proc"
111}
112expect {
113 timeout {puts "TESTING ERROR 5.2\n";exit}
114 "proc /proc proc"
115}
116expect {
117 timeout {puts "TESTING ERROR 5.3\n";exit}
118 "proc /proc/sys proc"
119}
120expect {
121 timeout {puts "TESTING ERROR 5.4\n";exit}
122 "proc /proc/sysrq-trigger proc"
123}
124expect {
125 timeout {puts "TESTING ERROR 5.5\n";exit}
126 "proc /proc/sys/kernel/hotplug"
127}
128expect {
129 timeout {puts "TESTING ERROR 5.6\n";exit}
130 "proc /proc/irq proc"
131}
132expect {
133 timeout {puts "TESTING ERROR 5.7\n";exit}
134 "proc /proc/bus proc"
135}
136after 100
137send -- "exit\r"
138sleep 1
139
140
141puts "\nall done\n"
diff --git a/test/features/1.5.exp b/test/features/1.5.exp
new file mode 100755
index 000000000..d722c5811
--- /dev/null
+++ b/test/features/1.5.exp
@@ -0,0 +1,69 @@
1#!/usr/bin/expect -f
2#
3# PID namespace
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "firejail --noprofile\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18sleep 1
19
20send -- "ps aux | wc -l \r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "5"
24}
25after 100
26send -- "exit\r"
27sleep 1
28
29
30#
31# O
32#
33send -- "firejail --noprofile --overlay\r"
34expect {
35 timeout {puts "TESTING ERROR 2\n";exit}
36 "Child process initialized"
37}
38sleep 1
39
40send -- "ps aux | wc -l \r"
41expect {
42 timeout {puts "TESTING ERROR 3\n";exit}
43 "5"
44}
45after 100
46send -- "exit\r"
47sleep 1
48
49#
50# C
51#
52send -- "firejail --noprofile --chroot=/tmp/chroot\r"
53expect {
54 timeout {puts "TESTING ERROR 3\n";exit}
55 "Child process initialized"
56}
57sleep 1
58
59send -- "ps aux | wc -l \r"
60expect {
61 timeout {puts "TESTING ERROR 4\n";exit}
62 "5"
63}
64after 100
65send -- "exit\r"
66sleep 1
67
68
69puts "\nall done\n"
diff --git a/test/features/1.6.exp b/test/features/1.6.exp
new file mode 100755
index 000000000..a9c8f2a19
--- /dev/null
+++ b/test/features/1.6.exp
@@ -0,0 +1,69 @@
1#!/usr/bin/expect -f
2#
3# new /var/log
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "firejail --noprofile\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18sleep 1
19
20send -- "ls -l /var/log/syslog | wc -l\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "0"
24}
25after 100
26send -- "exit\r"
27sleep 1
28
29
30#
31# O
32#
33send -- "firejail --noprofile --overlay\r"
34expect {
35 timeout {puts "TESTING ERROR 2\n";exit}
36 "Child process initialized"
37}
38sleep 1
39
40send -- "ls -l /var/log/syslog | wc -l\r"
41expect {
42 timeout {puts "TESTING ERROR 3\n";exit}
43 "0"
44}
45after 100
46send -- "exit\r"
47sleep 1
48
49#
50# C
51#
52send -- "firejail --noprofile --chroot=/tmp/chroot\r"
53expect {
54 timeout {puts "TESTING ERROR 3\n";exit}
55 "Child process initialized"
56}
57sleep 1
58
59send -- "ls -l /var/log/syslog | wc -l\r"
60expect {
61 timeout {puts "TESTING ERROR 4\n";exit}
62 "0"
63}
64after 100
65send -- "exit\r"
66sleep 1
67
68
69puts "\nall done\n"
diff --git a/test/features/1.7.exp b/test/features/1.7.exp
new file mode 100755
index 000000000..0de3e224d
--- /dev/null
+++ b/test/features/1.7.exp
@@ -0,0 +1,71 @@
1#!/usr/bin/expect -f
2#
3# new /var/tmp
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "touch /var/tmp/somefile\r"
14sleep 1
15send -- "firejail --noprofile\r"
16expect {
17 timeout {puts "TESTING ERROR 0\n";exit}
18 "Child process initialized"
19}
20sleep 1
21
22send -- "ls -l /var/tmp/somefile | wc -l\r"
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "0"
26}
27after 100
28send -- "exit\r"
29sleep 1
30
31
32#
33# O
34#
35send -- "firejail --noprofile --overlay\r"
36expect {
37 timeout {puts "TESTING ERROR 2\n";exit}
38 "Child process initialized"
39}
40sleep 1
41
42send -- "ls -l /var/tmp/somefile | wc -l\r"
43expect {
44 timeout {puts "TESTING ERROR 3\n";exit}
45 "0"
46}
47after 100
48send -- "exit\r"
49sleep 1
50
51#
52# C
53#
54send -- "firejail --noprofile --chroot=/tmp/chroot\r"
55expect {
56 timeout {puts "TESTING ERROR 3\n";exit}
57 "Child process initialized"
58}
59sleep 1
60
61send -- "ls -l /var/tmp/somefile | wc -l\r"
62expect {
63 timeout {puts "TESTING ERROR 4\n";exit}
64 "0"
65}
66after 100
67send -- "exit\r"
68sleep 1
69
70
71puts "\nall done\n"
diff --git a/test/features/1.8.exp b/test/features/1.8.exp
new file mode 100755
index 000000000..514dd3b81
--- /dev/null
+++ b/test/features/1.8.exp
@@ -0,0 +1,71 @@
1#!/usr/bin/expect -f
2#
3# disable /etc/firejail and ~/.config/firejail
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "touch /var/tmp/somefile\r"
14sleep 1
15send -- "firejail --noprofile\r"
16expect {
17 timeout {puts "TESTING ERROR 0\n";exit}
18 "Child process initialized"
19}
20sleep 1
21
22send -- "ls -l /var/tmp/somefile | wc -l\r"
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "0"
26}
27after 100
28send -- "exit\r"
29sleep 1
30
31
32#
33# O
34#
35send -- "firejail --noprofile --overlay\r"
36expect {
37 timeout {puts "TESTING ERROR 2\n";exit}
38 "Child process initialized"
39}
40sleep 1
41
42send -- "ls -l /var/tmp/somefile | wc -l\r"
43expect {
44 timeout {puts "TESTING ERROR 3\n";exit}
45 "0"
46}
47after 100
48send -- "exit\r"
49sleep 1
50
51#
52# C
53#
54send -- "firejail --noprofile --chroot=/tmp/chroot\r"
55expect {
56 timeout {puts "TESTING ERROR 3\n";exit}
57 "Child process initialized"
58}
59sleep 1
60
61send -- "ls -l /var/tmp/somefile | wc -l\r"
62expect {
63 timeout {puts "TESTING ERROR 4\n";exit}
64 "0"
65}
66after 100
67send -- "exit\r"
68sleep 1
69
70
71puts "\nall done\n"
diff --git a/test/features/features.txt b/test/features/features.txt
new file mode 100644
index 000000000..a95eeef37
--- /dev/null
+++ b/test/features/features.txt
@@ -0,0 +1,64 @@
1Firejail Feature Testing
2
3N - normal user filesystem
4O - overlay filesystem
5C - chroot filesystem
6
7
8
91. Default features (tesing with --noprofile)
10
111.1 new /boot
12 - N, O, C
13
141.2 new /proc
15 - N, O, C
16
171.3 new /sys
18 - N, O fails remount, C fails remount
19
201.4 mask other users
21 - home directory: N, O, C
22 - /etc/passwd: N, O, C to test
23 - /etc/group: N, O, C to test
24
251.5 PID namespace
26 - N, O, C
27
281.6 new /var/log
29 - N, O, C
30
311.7 new /var/tmp
32 -N, O, C
33
341.8 disable /etc/firejail and ~/.config/firejail
35
36
37
382. Networking features
39
402.1 Hostname (use --hostname=bing, do a ping and cat /etc/hostname)
41 - N, O, C
42 - ping disabled for C by default seccomp filter, use "getent hosts bingo"
43
442.2 DNS (use --dns=4.2.2.1, use "dig google.com")
45 - N, O, C
46
472.3 mac-vlan (use --net=eth0 and --noprofile; run ifconfig and dig google.com)
48 - N, O, C
49
502.4 bridge (use --net=br0 and --noprofile; run ifconfig, netstat -rn, ping default gw)
51 - N, O, C
52 - ping disabled for C by default seccomp filter
53
542.5 IP address (--noprofile --net=eth0 --ip=192.168.1.226 --net=br0 --ip=10.10.20.3, run ifconfig and netstat -rn)
55 - N, O, C
56
572.6 Default gw (--noprofile --net=eth0 --defaultgw=192.168.1.10, run netstat -rn)
58 - N, O, C
59
60
61
623. Filesystem features (use --noprofile)
63
64 \ No newline at end of file
diff --git a/test/features/test.sh b/test/features/test.sh
new file mode 100755
index 000000000..b4ef6503a
--- /dev/null
+++ b/test/features/test.sh
@@ -0,0 +1,24 @@
1#!/bin/bash
2
3#
4# Feature testing
5#
6
7echo "TESTING: 1.1. new /boot"
8./1.1.exp
9
10echo "TESTING: 1.2. new /proc"
11./1.2.exp
12
13echo "TESTING: 1.5. PID namespace"
14./1.5.exp
15
16echo "TESTING: 1.6 new /var/log"
17./1.6.exp
18
19echo "TESTING: 1.7 new /var/tmp"
20./1.7.exp
21
22#echo "TESTING: "
23#./1..exp
24