diff options
author | netblue30 <netblue30@yahoo.com> | 2018-04-01 13:52:13 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2018-04-01 13:52:13 -0400 |
commit | 01f450f5313e9107f5c7caacbeae0a2f8a749449 (patch) | |
tree | 20fc7ee270ee96dd28d55a51e48e8a52430e39c4 | |
parent | testing ssh (diff) | |
download | firejail-01f450f5313e9107f5c7caacbeae0a2f8a749449.tar.gz firejail-01f450f5313e9107f5c7caacbeae0a2f8a749449.tar.zst firejail-01f450f5313e9107f5c7caacbeae0a2f8a749449.zip |
testing login as nobody
-rwxr-xr-x | test/root/login_nobody.exp | 35 | ||||
-rwxr-xr-x | test/root/root.sh | 3 | ||||
-rwxr-xr-x | test/ssh/sftp.exp | 18 |
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 | |||
6 | set timeout 10 | ||
7 | cd /home | ||
8 | spawn $env(SHELL) | ||
9 | match_max 100000 | ||
10 | |||
11 | send -- "su - nobody -s /usr/bin/firejail\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "Child process initialized" | ||
15 | } | ||
16 | after 100 | ||
17 | |||
18 | send -- "cat /proc/self/status | grep Seccomp\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 3\n";exit} | ||
21 | "2" | ||
22 | } | ||
23 | after 100 | ||
24 | |||
25 | send -- "cat /proc/self/status | grep CapBnd\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 4\n";exit} | ||
28 | "0000000000000000" | ||
29 | } | ||
30 | after 100 | ||
31 | |||
32 | send -- "exit\r" | ||
33 | sleep 1 | ||
34 | |||
35 | puts "\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)" | |||
80 | echo "TESTING: git-install (test/root/git.exp)" | 80 | echo "TESTING: git-install (test/root/git.exp)" |
81 | ./git.exp | 81 | ./git.exp |
82 | 82 | ||
83 | echo "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" | |||
21 | after 100 | 21 | after 100 |
22 | send -- "sftp firejail-test@0\r" | 22 | send -- "sftp firejail-test@0\r" |
23 | expect { | 23 | expect { |
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 | } |
27 | expect { | 27 | expect { |
28 | timeout {puts "TESTING ERROR 0\n";exit} | 28 | timeout {puts "TESTING ERROR 2\n";exit} |
29 | "sftp>" | 29 | "sftp>" |
30 | } | 30 | } |
31 | after 100 | 31 | after 100 |
32 | send -- "put testfile\r" | 32 | send -- "put testfile\r" |
33 | expect { | 33 | expect { |
34 | timeout {puts "TESTING ERROR 0\n";exit} | 34 | timeout {puts "TESTING ERROR 3\n";exit} |
35 | "100%" | 35 | "100%" |
36 | } | 36 | } |
37 | after 100 | 37 | after 100 |
@@ -41,14 +41,14 @@ sleep 1 | |||
41 | 41 | ||
42 | send -- "ssh firejail-test@0\r" | 42 | send -- "ssh firejail-test@0\r" |
43 | expect { | 43 | expect { |
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 | } |
48 | sleep 1 | 48 | sleep 1 |
49 | send -- "cat testfile\r" | 49 | send -- "cat testfile\r" |
50 | expect { | 50 | expect { |
51 | timeout {puts "TESTING ERROR 0\n";exit} | 51 | timeout {puts "TESTING ERROR 5\n";exit} |
52 | "12345" | 52 | "12345" |
53 | } | 53 | } |
54 | after 100 | 54 | after 100 |
@@ -59,17 +59,17 @@ send -- "rm testfile\r" | |||
59 | after 100 | 59 | after 100 |
60 | send -- "sftp firejail-test@0\r" | 60 | send -- "sftp firejail-test@0\r" |
61 | expect { | 61 | expect { |
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 | } |
65 | expect { | 65 | expect { |
66 | timeout {puts "TESTING ERROR 0\n";exit} | 66 | timeout {puts "TESTING ERROR 7\n";exit} |
67 | "sftp>" | 67 | "sftp>" |
68 | } | 68 | } |
69 | after 100 | 69 | after 100 |
70 | send -- "get testfile\r" | 70 | send -- "get testfile\r" |
71 | expect { | 71 | expect { |
72 | timeout {puts "TESTING ERROR 0\n";exit} | 72 | timeout {puts "TESTING ERROR 8\n";exit} |
73 | "100%" | 73 | "100%" |
74 | } | 74 | } |
75 | after 100 | 75 | after 100 |
@@ -77,7 +77,7 @@ send -- "exit\r" | |||
77 | sleep 1 | 77 | sleep 1 |
78 | send -- "cat testfile\r" | 78 | send -- "cat testfile\r" |
79 | expect { | 79 | expect { |
80 | timeout {puts "TESTING ERROR 0\n";exit} | 80 | timeout {puts "TESTING ERROR 9\n";exit} |
81 | "12345" | 81 | "12345" |
82 | } | 82 | } |
83 | after 100 | 83 | after 100 |