diff options
Diffstat (limited to 'test/fs/private.exp')
-rwxr-xr-x | test/fs/private.exp | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/test/fs/private.exp b/test/fs/private.exp new file mode 100755 index 000000000..01f04d3cb --- /dev/null +++ b/test/fs/private.exp | |||
@@ -0,0 +1,100 @@ | |||
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 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | if { $argc != 1 } { | ||
11 | puts "TESTING ERROR: argument missing" | ||
12 | puts "Usage: private.exp username" | ||
13 | puts "where username is the name of the current user" | ||
14 | exit | ||
15 | } | ||
16 | |||
17 | # testing profile and private | ||
18 | send -- "firejail --private --profile=/etc/firejail/default.profile\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 0\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | send -- "exit\r" | ||
25 | sleep 1 | ||
26 | |||
27 | send -- "firejail --private --noprofile\r" | ||
28 | expect { | ||
29 | timeout {puts "TESTING ERROR 1\n";exit} | ||
30 | "Child process initialized" | ||
31 | } | ||
32 | |||
33 | sleep 1 | ||
34 | send -- "cd ~; ls -al; echo done\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 2\n";exit} | ||
37 | ".bashrc" | ||
38 | } | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 3\n";exit} | ||
41 | [lindex $argv 0] | ||
42 | } | ||
43 | send -- "ls -al; echo done\r" | ||
44 | expect { | ||
45 | timeout { | ||
46 | # OpenSUSE doesn't use .Xauthority from user done directory | ||
47 | send -- "env | grep XAUTHORITY\r" | ||
48 | |||
49 | expect { | ||
50 | timeout {puts "TESTING ERROR 4\n";exit} | ||
51 | "/run/lightdm/netblue/xauthority" | ||
52 | } | ||
53 | } | ||
54 | ".Xauthority" | ||
55 | } | ||
56 | expect { | ||
57 | timeout {puts "TESTING ERROR 5\n";exit} | ||
58 | [lindex $argv 0] | ||
59 | } | ||
60 | |||
61 | |||
62 | # testing private only | ||
63 | send -- "bash\r" | ||
64 | sleep 1 | ||
65 | # owner /done/netblue | ||
66 | send -- "ls -l /done;echo done\r" | ||
67 | expect { | ||
68 | timeout {puts "TESTING ERROR 6\n";exit} | ||
69 | [lindex $argv 0] | ||
70 | } | ||
71 | expect { | ||
72 | timeout {puts "TESTING ERROR 7\n";exit} | ||
73 | [lindex $argv 0] | ||
74 | } | ||
75 | expect { | ||
76 | timeout {puts "TESTING ERROR 8\n";exit} | ||
77 | [lindex $argv 0] | ||
78 | } | ||
79 | expect { | ||
80 | timeout {puts "TESTING ERROR 9\n";exit} | ||
81 | "done" | ||
82 | } | ||
83 | sleep 1 | ||
84 | |||
85 | # owner /tmp | ||
86 | send -- "stat -c %U%a /tmp;echo done\r" | ||
87 | expect { | ||
88 | timeout {puts "TESTING ERROR 10\n";exit} | ||
89 | "root777" {puts "version 1\n";} | ||
90 | "root1777" {puts "version 2\n";} | ||
91 | "nobody777" {puts "version 3\n";} | ||
92 | "nobody1777" {puts "version 4\n";} | ||
93 | } | ||
94 | expect { | ||
95 | timeout {puts "TESTING ERROR 11\n";exit} | ||
96 | "done" | ||
97 | } | ||
98 | sleep 1 | ||
99 | |||
100 | puts "all done\n" | ||