diff options
Diffstat (limited to 'test/root/seccomp-chown.exp')
-rwxr-xr-x | test/root/seccomp-chown.exp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/root/seccomp-chown.exp b/test/root/seccomp-chown.exp new file mode 100755 index 000000000..a54d279f1 --- /dev/null +++ b/test/root/seccomp-chown.exp | |||
@@ -0,0 +1,49 @@ | |||
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 | send -- "firejail --seccomp=chown,fchown,fchownat,lchown --private\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 2 | ||
16 | |||
17 | send -- "touch testfile;pwd\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | "/root" {puts "running as root"} | ||
21 | "/home" | ||
22 | } | ||
23 | |||
24 | send -- "ls -l testfile;pwd\r" | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 2\n";exit} | ||
27 | "testfile" | ||
28 | } | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 3\n";exit} | ||
31 | "/root" {puts "running as root"} | ||
32 | "/home" | ||
33 | } | ||
34 | |||
35 | send -- "chown netblue:netblue testfile;pwd\r" | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 2\n";exit} | ||
38 | "Bad system call" | ||
39 | } | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 3\n";exit} | ||
42 | "/root" {puts "running as root"} | ||
43 | "/home" | ||
44 | } | ||
45 | |||
46 | |||
47 | send -- "exit\r" | ||
48 | after 100 | ||
49 | puts "\nall done\n" | ||