aboutsummaryrefslogtreecommitdiffstats
path: root/test/environment
diff options
context:
space:
mode:
Diffstat (limited to 'test/environment')
-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.exp33
-rwxr-xr-xtest/environment/rlimit.exp37
-rw-r--r--test/environment/rlimit.profile4
12 files changed, 226 insertions, 1 deletions
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/environment/rlimit-profile.exp b/test/environment/rlimit-profile.exp
new file mode 100755
index 000000000..a9e54a405
--- /dev/null
+++ b/test/environment/rlimit-profile.exp
@@ -0,0 +1,33 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4#cd /home
5spawn $env(SHELL)
6match_max 100000
7
8send -- "firejail --profile=rlimit.profile\r"
9expect {
10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Child process initialized"
12}
13sleep 1
14
15send -- "cat /proc/self/limits\r"
16expect {
17 timeout {puts "TESTING ERROR 1.1\n";exit}
18 "Max file size 1024 1024"
19}
20expect {
21 timeout {puts "TESTING ERROR 1.2\n";exit}
22 "Max processes 1000 1000"
23}
24expect {
25 timeout {puts "TESTING ERROR 1.3\n";exit}
26 "Max open files 500 500"
27}
28expect {
29 timeout {puts "TESTING ERROR 1.4\n";exit}
30 "Max pending signals 200 200"
31}
32after 100
33puts "\nall done\n"
diff --git a/test/environment/rlimit.exp b/test/environment/rlimit.exp
new file mode 100755
index 000000000..611f69821
--- /dev/null
+++ b/test/environment/rlimit.exp
@@ -0,0 +1,37 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4cd /home
5spawn $env(SHELL)
6match_max 100000
7
8send -- "firejail --rlimit-fsize=1024 --rlimit-nproc=1000 --rlimit-nofile=500 --rlimit-sigpending=200\r"
9expect {
10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Child process initialized"
12}
13sleep 1
14
15send -- "cat /proc/self/limits; pwd\r"
16expect {
17 timeout {puts "TESTING ERROR 1.1\n";exit}
18 "Max file size 1024 1024"
19}
20expect {
21 timeout {puts "TESTING ERROR 1.2\n";exit}
22 "Max processes 1000 1000"
23}
24expect {
25 timeout {puts "TESTING ERROR 1.3\n";exit}
26 "Max open files 500 500"
27}
28expect {
29 timeout {puts "TESTING ERROR 1.4\n";exit}
30 "Max pending signals 200 200"
31}
32expect {
33 timeout {puts "TESTING ERROR 1.5\n";exit}
34 "home"
35}
36after 100
37puts "\n"
diff --git a/test/environment/rlimit.profile b/test/environment/rlimit.profile
new file mode 100644
index 000000000..271891c03
--- /dev/null
+++ b/test/environment/rlimit.profile
@@ -0,0 +1,4 @@
1 rlimit-fsize 1024
2rlimit-nproc 1000
3 rlimit-nofile 500
4rlimit-sigpending 200 \ No newline at end of file