aboutsummaryrefslogtreecommitdiffstats
path: root/test/root/checkcfg.exp
blob: e1ec6cf79a8693db588454b77243144c322d7b42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2017 Firejail Authors
# License GPL v2

set timeout 10
cd /home
spawn $env(SHELL)
match_max 100000

send --  "firejail --noprofile --overlay\r"
expect {
	timeout {puts "TESTING ERROR 0\n";exit}
	"Child process initialized"
}
sleep 2

send -- "rm /etc/firejail/firejail.config\r"
after 100

send --  "firejail\r"
expect {
	timeout {puts "TESTING ERROR 1\n";exit}
	"firejail.config not found"
}

# seccomp
send --  "echo \"seccomp no\" > /etc/firejail/firejail.config\r"
after 100
send --  "firejail --noprofile --seccomp --force\r"
expect {
	timeout {puts "TESTING ERROR 2\n";exit}
	"seccomp feature is disabled in Firejail configuration file\r"
}
send --  "exit\r"
after 100

# whitelist
send --  "echo \"whitelist no\" > /etc/firejail/firejail.config\r"
after 100
send --  "firejail --noprofile --whitelist=~/.config --force\r"
expect {
	timeout {puts "TESTING ERROR 3\n";exit}
	"whitelist feature is disabled in Firejail configuration file\r"
}

# network
send --  "echo \"network no\" > /etc/firejail/firejail.config\r"
after 100
send --  "firejail --noprofile --net=eth0 --force\r"
expect {
	timeout {puts "TESTING ERROR 4\n";exit}
	"networking feature is disabled in Firejail configuration file\r"
}

# bind
send --  "echo \"bind no\" > /etc/firejail/firejail.config\r"
after 100
send --  "firejail --noprofile --bind=/tmp,/var/tmp --force\r"
expect {
	timeout {puts "TESTING ERROR 5\n";exit}
	"bind feature is disabled in Firejail configuration file\r"
}

# overlay
send --  "echo \"overlayfs no\" > /etc/firejail/firejail.config\r"
after 100
send --  "firejail --noprofile --overlay --force\r"
expect {
	timeout {puts "TESTING ERROR 6\n";exit}
	"overlayfs feature is disabled in Firejail configuration file\r"
}

# private-home
send --  "echo \"private-home no\" > /etc/firejail/firejail.config\r"
after 100
send --  "firejail --noprofile --private-home=/tmp --force\r"
expect {
	timeout {puts "TESTING ERROR 7\n";exit}
	"private-home feature is disabled in Firejail configuration file\r"
}

# chroot
send --  "echo \"chroot no\" > /etc/firejail/firejail.config\r"
after 100
send --  "firejail --noprofile --chroot=/tmp --force\r"
expect {
	timeout {puts "TESTING ERROR 8\n";exit}
	"chroot feature is disabled in Firejail configuration file\r"
}

# userns
send --  "echo \"userns no\" > /etc/firejail/firejail.config\r"
after 100
send --  "firejail --noprofile --noroot --force\r"
expect {
	timeout {puts "TESTING ERROR 9\n";exit}
	"noroot feature is disabled in Firejail configuration file\r"
}

send --  "exit\r"
after 100


after 100
puts "\nall done\n"