aboutsummaryrefslogtreecommitdiffstats
path: root/test/fs/private.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/fs/private.exp')
-rwxr-xr-xtest/fs/private.exp100
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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10if { $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
18send -- "firejail --private --profile=/etc/firejail/default.profile\r"
19expect {
20 timeout {puts "TESTING ERROR 0\n";exit}
21 "Child process initialized"
22}
23sleep 1
24send -- "exit\r"
25sleep 1
26
27send -- "firejail --private --noprofile\r"
28expect {
29 timeout {puts "TESTING ERROR 1\n";exit}
30 "Child process initialized"
31}
32
33sleep 1
34send -- "cd ~; ls -al; echo done\r"
35expect {
36 timeout {puts "TESTING ERROR 2\n";exit}
37 ".bashrc"
38}
39expect {
40 timeout {puts "TESTING ERROR 3\n";exit}
41 [lindex $argv 0]
42}
43send -- "ls -al; echo done\r"
44expect {
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}
56expect {
57 timeout {puts "TESTING ERROR 5\n";exit}
58 [lindex $argv 0]
59}
60
61
62# testing private only
63send -- "bash\r"
64sleep 1
65# owner /done/netblue
66send -- "ls -l /done;echo done\r"
67expect {
68 timeout {puts "TESTING ERROR 6\n";exit}
69 [lindex $argv 0]
70}
71expect {
72 timeout {puts "TESTING ERROR 7\n";exit}
73 [lindex $argv 0]
74}
75expect {
76 timeout {puts "TESTING ERROR 8\n";exit}
77 [lindex $argv 0]
78}
79expect {
80 timeout {puts "TESTING ERROR 9\n";exit}
81 "done"
82}
83sleep 1
84
85# owner /tmp
86send -- "stat -c %U%a /tmp;echo done\r"
87expect {
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}
94expect {
95 timeout {puts "TESTING ERROR 11\n";exit}
96 "done"
97}
98sleep 1
99
100puts "all done\n"