aboutsummaryrefslogtreecommitdiffstats
path: root/test/root
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-10 20:15:22 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-10 20:15:22 -0500
commitfffce11c3da087172c069ec0ff4c788f5bcc522b (patch)
tree7e3297f56448ebc8122f8fbb006fa3ce034ea62c /test/root
parenttesting (diff)
downloadfirejail-fffce11c3da087172c069ec0ff4c788f5bcc522b.tar.gz
firejail-fffce11c3da087172c069ec0ff4c788f5bcc522b.tar.zst
firejail-fffce11c3da087172c069ec0ff4c788f5bcc522b.zip
testing
Diffstat (limited to 'test/root')
-rwxr-xr-xtest/root/configure27
-rwxr-xr-xtest/root/firemon-events.exp72
-rwxr-xr-xtest/root/firemon-interface.exp34
-rwxr-xr-xtest/root/net_interface.exp93
-rwxr-xr-xtest/root/option_tmpfs.exp8
-rwxr-xr-xtest/root/profile_tmpfs.exp37
-rwxr-xr-xtest/root/root.sh31
-rwxr-xr-xtest/root/start.sh4
-rw-r--r--test/root/tmpfs-bad.profile1
-rw-r--r--test/root/tmpfs.profile2
10 files changed, 99 insertions, 210 deletions
diff --git a/test/root/configure b/test/root/configure
deleted file mode 100755
index 35d938340..000000000
--- a/test/root/configure
+++ /dev/null
@@ -1,27 +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
6brctl addbr br0
7ifconfig br0 10.10.20.1/29 up
8# NAT masquerade
9iptables -t nat -A POSTROUTING -o eth0 -s 10.10.20.0/29 -j MASQUERADE
10# port forwarding
11# iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to 10.10.20.2:80
12
13brctl addbr br1
14ifconfig br1 10.10.30.1/24 up
15brctl addbr br2
16ifconfig br2 10.10.40.1/24 up
17brctl addbr br3
18ifconfig br3 10.10.50.1/24 up
19brctl addbr br4
20ifconfig br4 10.10.60.1/24 up
21ip link add link eth0 name eth0.5 type vlan id 5
22/sbin/ifconfig eth0.5 10.10.205.10/24 up
23ip link add link eth0 name eth0.6 type vlan id 6
24/sbin/ifconfig eth0.6 10.10.206.10/24 up
25ip link add link eth0 name eth0.7 type vlan id 7
26/sbin/ifconfig eth0.7 10.10.207.10/24 up
27
diff --git a/test/root/firemon-events.exp b/test/root/firemon-events.exp
new file mode 100755
index 000000000..4f305e51d
--- /dev/null
+++ b/test/root/firemon-events.exp
@@ -0,0 +1,72 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7# start firemon
8set firemon_id $spawn_id
9send -- "firemon\r"
10sleep 1
11
12# start firejail
13spawn $env(SHELL)
14set firejail_id $spawn_id
15send -- "firejail\r"
16expect {
17 timeout {puts "TESTING ERROR 0\n";exit}
18 "Child process initialized"
19}
20
21# get messages on firemon
22set spawn_id $firemon_id
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "exec"
26}
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "/bin/bash -c /bin/bash"
30}
31expect {
32 timeout {puts "TESTING ERROR 3\n";exit}
33 "exec"
34}
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
37 "/bin/bash"
38}
39expect {
40 timeout {puts "TESTING ERROR 5\n";exit}
41 "fork"
42}
43expect {
44 timeout {puts "TESTING ERROR 6\n";exit}
45 "child"
46}
47expect {
48 timeout {puts "TESTING ERROR 7\n";exit}
49 "/bin/bash"
50}
51after 100
52
53# exit firejail
54set spawn_id $firejail_id
55send -- "exit\r"
56sleep 1
57
58# get messages on firemon
59set spawn_id $firemon_id
60expect {
61 timeout {puts "TESTING ERROR 8\n";exit}
62 "exit"
63}
64
65expect {
66 timeout {puts "TESTING ERROR 9\n";exit}
67 "EXIT SANDBOX"
68}
69
70
71puts "\nall done\n"
72
diff --git a/test/root/firemon-interface.exp b/test/root/firemon-interface.exp
deleted file mode 100755
index 6a82ae41e..000000000
--- a/test/root/firemon-interface.exp
+++ /dev/null
@@ -1,34 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized"
11}
12sleep 1
13
14spawn $env(SHELL)
15send -- "firemon --interface\r"
16expect {
17 timeout {puts "TESTING ERROR 1\n";exit}
18 "lo UP"
19}
20expect {
21 timeout {puts "TESTING ERROR 2\n";exit}
22 "10.10.20.1/29"
23}
24expect {
25 timeout {puts "TESTING ERROR 3\n";exit}
26 "10.10.50.1/24"
27}
28expect {
29 timeout {puts "TESTING ERROR 3\n";exit}
30 "br3"
31}
32sleep 1
33
34puts "\n"
diff --git a/test/root/net_interface.exp b/test/root/net_interface.exp
deleted file mode 100755
index 2f87024d8..000000000
--- a/test/root/net_interface.exp
+++ /dev/null
@@ -1,93 +0,0 @@
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 -- "ip link add link eth0 name eth0.100 type vlan id 100\r"
11sleep 1
12send -- "ip link add link eth0 name eth0.101 type vlan id 101\r"
13sleep 1
14send -- "ip link add link eth0 name eth0.102 type vlan id 102\r"
15sleep 1
16send -- "ip link add link eth0 name eth0.103 type vlan id 103\r"
17sleep 1
18send -- "ip link add link eth0 name eth0.104 type vlan id 104\r"
19sleep 1
20puts "\n"
21
22send -- "/sbin/ifconfig eth0.100 10.200.0.1/24\r"
23sleep 1
24send -- "/sbin/ifconfig eth0.101 10.200.1.1/24\r"
25sleep 1
26send -- "/sbin/ifconfig eth0.102 10.200.2.1/24\r"
27sleep 1
28send -- "/sbin/ifconfig eth0.103 10.200.3.1/24\r"
29sleep 1
30send -- "/sbin/ifconfig eth0.104 10.200.4.1/24\r"
31sleep 1
32puts "\n"
33
34
35
36send -- "firejail --noprofile --interface=eth0.100 --interface=eth0.101 --interface=eth0.102 --interface=eth0.103 --interface=eth0.104\r"
37expect {
38 timeout {puts "TESTING ERROR 0\n";exit}
39 "maximum 4 interfaces are allowed"
40}
41sleep 1
42
43send -- "firejail --noprofile --interface=eth0.100 --interface=eth0.101 --interface=eth0.102 --interface=eth0.103\r"
44expect {
45 timeout {puts "TESTING ERROR 1\n";exit}
46 "eth0.100"
47}
48expect {
49 timeout {puts "TESTING ERROR 1.1\n";exit}
50 "UP"
51}
52expect {
53 timeout {puts "TESTING ERROR 2\n";exit}
54 "eth0.101"
55}
56expect {
57 timeout {puts "TESTING ERROR 2.2\n";exit}
58 "UP"
59}
60expect {
61 timeout {puts "TESTING ERROR 3\n";exit}
62 "eth0.102"
63}
64expect {
65 timeout {puts "TESTING ERROR 3.1\n";exit}
66 "UP"
67}
68expect {
69 timeout {puts "TESTING ERROR 4\n";exit}
70 "eth0.103"
71}
72expect {
73 timeout {puts "TESTING ERROR 4.1\n";exit}
74 "UP"
75}
76sleep 1
77send -- "exit\r"
78sleep 1
79
80send -- "firejail --noprofile --interface=eth0.104\r"
81expect {
82 timeout {puts "TESTING ERROR 5\n";exit}
83 "eth0.104"
84}
85expect {
86 timeout {puts "TESTING ERROR 5.1\n";exit}
87 "UP"
88}
89send -- "exit\r"
90after 100
91
92puts "all done\n"
93
diff --git a/test/root/option_tmpfs.exp b/test/root/option_tmpfs.exp
index 20e42a858..3d492dfdb 100755
--- a/test/root/option_tmpfs.exp
+++ b/test/root/option_tmpfs.exp
@@ -16,13 +16,9 @@ expect {
16 timeout {puts "TESTING ERROR 1\n";exit} 16 timeout {puts "TESTING ERROR 1\n";exit}
17 "total 0" 17 "total 0"
18} 18}
19expect { 19after 100
20 timeout {puts "TESTING ERROR 2\n";exit}
21 "/root"
22}
23sleep 1
24send -- "exit\r" 20send -- "exit\r"
25sleep 2 21sleep 1
26 22
27send -- "firejail --debug-check-filename --tmpfs=\"bla&&bla\"\r" 23send -- "firejail --debug-check-filename --tmpfs=\"bla&&bla\"\r"
28expect { 24expect {
diff --git a/test/root/profile_tmpfs.exp b/test/root/profile_tmpfs.exp
index da7c084a2..25f73b50b 100755
--- a/test/root/profile_tmpfs.exp
+++ b/test/root/profile_tmpfs.exp
@@ -4,34 +4,37 @@ set timeout 10
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7send -- "mkdir /tmp/firejailtestdir\r"
8sleep 1
9send -- "ls > /tmp/firejailtestdir/tmpfile\r"
10sleep 1
11
12send -- "firejail --profile=tmpfs.profile\r" 7send -- "firejail --profile=tmpfs.profile\r"
13expect { 8expect {
14 timeout {puts "TESTING ERROR 0\n";exit} 9 timeout {puts "TESTING ERROR 0\n";exit}
15 "Child process initialized" 10 "Child process initialized"
16} 11}
17
18# testing private only
19send -- "bash\r"
20sleep 1 12sleep 1
21 13
22send -- "ls -l /tmp/firejailtestdir;pwd\r" 14send -- "ls -l /var;pwd\r"
23expect { 15expect {
24 timeout {puts "TESTING ERROR 1.1\n";exit} 16 timeout {puts "TESTING ERROR 1\n";exit}
25 "tmpfile" {puts "TESTING ERROR 1\n";exit} 17 "total 0"
26 "home"
27} 18}
28sleep 1 19after 100
29send -- "exit\r"
30sleep 1
31send -- "exit\r" 20send -- "exit\r"
32sleep 1 21sleep 1
33send -- "rm -fr /tmp/firejailtestdir\r"
34 22
35sleep 1 23send -- "firejail --debug-check-filename --profile=tmpfs-bad.profile\r"
24expect {
25 timeout {puts "TESTING ERROR 13.1\n";exit}
26 "Checking filename bla&&bla"
27}
28expect {
29 timeout {puts "TESTING ERROR 13.2\n";exit}
30 "Error:"
31}
32expect {
33 timeout {puts "TESTING ERROR 13.3\n";exit}
34 "is an invalid filename"
35}
36after 100
37
36 38
37puts "\nall done\n" 39puts "\nall done\n"
40
diff --git a/test/root/root.sh b/test/root/root.sh
index 960071d45..5576faad6 100755
--- a/test/root/root.sh
+++ b/test/root/root.sh
@@ -1,7 +1,5 @@
1#!/bin/bash 1#!/bin/bash
2 2
3./configure 2 > /dev/null
4
5#******************************** 3#********************************
6# servers 4# servers
7#******************************** 5#********************************
@@ -76,30 +74,7 @@ echo hello > tmpfile
76rm -f tmpfile 74rm -f tmpfile
77 75
78#******************************** 76#********************************
79# networking 77# firemon
80#******************************** 78#********************************
81echo "TESTING: network interfaces (test/root/net_interface.exp)" 79echo "TESTING: firemon events (test/root/firemon-events.exp)"
82./net_interface.exp 80./firemon-events.exp
83
84echo "TESTING: firemon --interface (test/root/firemon-interface.exp)"
85./firemon-interface.exp
86
87#if [ -f /sys/fs/cgroup/g1/tasks ]
88#then
89# echo "TESTING: firemon --cgroup (firemon-cgroup.exp)"
90# ./firemon-cgroup.exp
91#fi
92#
93#echo "TESTING: chroot resolv.conf (chroot-resolvconf.exp)"
94#rm -f tmpfile
95#touch tmpfile
96#rm -f /tmp/chroot/etc/resolv.conf
97#ln -s tmp /tmp/chroot/etc/resolv.conf
98#./chroot-resolvconf.exp
99#rm -f tmpfile
100#rm /tmp/chroot/etc/resolv.conf
101
102#echo "TESTING: chroot (fs_chroot_asroot.exp)"
103#./fs_chroot_asroot.exp
104
105
diff --git a/test/root/start.sh b/test/root/start.sh
deleted file mode 100755
index 8e7a869cd..000000000
--- a/test/root/start.sh
+++ /dev/null
@@ -1,4 +0,0 @@
1#/bin/bash
2
3./configure
4./root.sh | grep TESTING \ No newline at end of file
diff --git a/test/root/tmpfs-bad.profile b/test/root/tmpfs-bad.profile
new file mode 100644
index 000000000..7264e18ff
--- /dev/null
+++ b/test/root/tmpfs-bad.profile
@@ -0,0 +1 @@
tmpfs bla&&bla
diff --git a/test/root/tmpfs.profile b/test/root/tmpfs.profile
index 0680f4d69..55a6f7ebc 100644
--- a/test/root/tmpfs.profile
+++ b/test/root/tmpfs.profile
@@ -1 +1 @@
tmpfs /tmp/firejailtestdir \ No newline at end of file tmpfs /var