aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2018-04-01 13:52:13 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2018-04-01 13:52:13 -0400
commit01f450f5313e9107f5c7caacbeae0a2f8a749449 (patch)
tree20fc7ee270ee96dd28d55a51e48e8a52430e39c4 /test
parenttesting ssh (diff)
downloadfirejail-01f450f5313e9107f5c7caacbeae0a2f8a749449.tar.gz
firejail-01f450f5313e9107f5c7caacbeae0a2f8a749449.tar.zst
firejail-01f450f5313e9107f5c7caacbeae0a2f8a749449.zip
testing login as nobody
Diffstat (limited to 'test')
-rwxr-xr-xtest/root/login_nobody.exp35
-rwxr-xr-xtest/root/root.sh3
-rwxr-xr-xtest/ssh/sftp.exp18
3 files changed, 47 insertions, 9 deletions
diff --git a/test/root/login_nobody.exp b/test/root/login_nobody.exp
new file mode 100755
index 000000000..8e9ec4367
--- /dev/null
+++ b/test/root/login_nobody.exp
@@ -0,0 +1,35 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2018 Firejail Authors
4# License GPL v2
5
6set timeout 10
7cd /home
8spawn $env(SHELL)
9match_max 100000
10
11send -- "su - nobody -s /usr/bin/firejail\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 "Child process initialized"
15}
16after 100
17
18send -- "cat /proc/self/status | grep Seccomp\r"
19expect {
20 timeout {puts "TESTING ERROR 3\n";exit}
21 "2"
22}
23after 100
24
25send -- "cat /proc/self/status | grep CapBnd\r"
26expect {
27 timeout {puts "TESTING ERROR 4\n";exit}
28 "0000000000000000"
29}
30after 100
31
32send -- "exit\r"
33sleep 1
34
35puts "\nall done\n"
diff --git a/test/root/root.sh b/test/root/root.sh
index 3a20e4ba4..4132bc739 100755
--- a/test/root/root.sh
+++ b/test/root/root.sh
@@ -80,6 +80,9 @@ echo "TESTING: join (test/root/join.exp)"
80echo "TESTING: git-install (test/root/git.exp)" 80echo "TESTING: git-install (test/root/git.exp)"
81./git.exp 81./git.exp
82 82
83echo "TESTING: login-nobody (test/root/login_nobody.exp)"
84./login_nobody.exp
85
83#******************************** 86#********************************
84# seccomp 87# seccomp
85#******************************** 88#********************************
diff --git a/test/ssh/sftp.exp b/test/ssh/sftp.exp
index 72c858f05..3b0124ec7 100755
--- a/test/ssh/sftp.exp
+++ b/test/ssh/sftp.exp
@@ -21,17 +21,17 @@ send -- "echo 12345 > testfile\r"
21after 100 21after 100
22send -- "sftp firejail-test@0\r" 22send -- "sftp firejail-test@0\r"
23expect { 23expect {
24 timeout {puts "TESTING ERROR 0\n";exit} 24 timeout {puts "TESTING ERROR 1\n";exit}
25 "Connected to 0" 25 "Connected to 0"
26} 26}
27expect { 27expect {
28 timeout {puts "TESTING ERROR 0\n";exit} 28 timeout {puts "TESTING ERROR 2\n";exit}
29 "sftp>" 29 "sftp>"
30} 30}
31after 100 31after 100
32send -- "put testfile\r" 32send -- "put testfile\r"
33expect { 33expect {
34 timeout {puts "TESTING ERROR 0\n";exit} 34 timeout {puts "TESTING ERROR 3\n";exit}
35 "100%" 35 "100%"
36} 36}
37after 100 37after 100
@@ -41,14 +41,14 @@ sleep 1
41 41
42send -- "ssh firejail-test@0\r" 42send -- "ssh firejail-test@0\r"
43expect { 43expect {
44 timeout {puts "TESTING ERROR 0\n";exit} 44 timeout {puts "TESTING ERROR 4\n";exit}
45 "Child process initialized" {puts "OK\n"} 45 "Child process initialized" {puts "OK\n"}
46 "an existing sandbox was detected" {puts "OK\n"} 46 "an existing sandbox was detected" {puts "OK\n"}
47} 47}
48sleep 1 48sleep 1
49send -- "cat testfile\r" 49send -- "cat testfile\r"
50expect { 50expect {
51 timeout {puts "TESTING ERROR 0\n";exit} 51 timeout {puts "TESTING ERROR 5\n";exit}
52 "12345" 52 "12345"
53} 53}
54after 100 54after 100
@@ -59,17 +59,17 @@ send -- "rm testfile\r"
59after 100 59after 100
60send -- "sftp firejail-test@0\r" 60send -- "sftp firejail-test@0\r"
61expect { 61expect {
62 timeout {puts "TESTING ERROR 0\n";exit} 62 timeout {puts "TESTING ERROR 6\n";exit}
63 "Connected to 0" 63 "Connected to 0"
64} 64}
65expect { 65expect {
66 timeout {puts "TESTING ERROR 0\n";exit} 66 timeout {puts "TESTING ERROR 7\n";exit}
67 "sftp>" 67 "sftp>"
68} 68}
69after 100 69after 100
70send -- "get testfile\r" 70send -- "get testfile\r"
71expect { 71expect {
72 timeout {puts "TESTING ERROR 0\n";exit} 72 timeout {puts "TESTING ERROR 8\n";exit}
73 "100%" 73 "100%"
74} 74}
75after 100 75after 100
@@ -77,7 +77,7 @@ send -- "exit\r"
77sleep 1 77sleep 1
78send -- "cat testfile\r" 78send -- "cat testfile\r"
79expect { 79expect {
80 timeout {puts "TESTING ERROR 0\n";exit} 80 timeout {puts "TESTING ERROR 9\n";exit}
81 "12345" 81 "12345"
82} 82}
83after 100 83after 100