aboutsummaryrefslogtreecommitdiffstats
path: root/test/fs
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2023-02-06 22:28:25 -0500
committerLibravatar netblue30 <netblue30@protonmail.com>2023-02-06 22:28:25 -0500
commitcb1104edf9c6ed0dc753724259b5c12fa5619afb (patch)
treed654d6547a7836faf5467cb37dac9f3ab50f7107 /test/fs
parenttesting (diff)
downloadfirejail-cb1104edf9c6ed0dc753724259b5c12fa5619afb.tar.gz
firejail-cb1104edf9c6ed0dc753724259b5c12fa5619afb.tar.zst
firejail-cb1104edf9c6ed0dc753724259b5c12fa5619afb.zip
private-etc testing
Diffstat (limited to 'test/fs')
-rwxr-xr-xtest/fs/fs.sh6
-rwxr-xr-xtest/fs/private-etc-empty.exp42
-rw-r--r--test/fs/private-etc-empty.profile1
-rwxr-xr-xtest/fs/private-etc.exp69
4 files changed, 0 insertions, 118 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh
index 4b85d3006..affc4bc7e 100755
--- a/test/fs/fs.sh
+++ b/test/fs/fs.sh
@@ -80,12 +80,6 @@ rm -fr ~/_firejail_test_dir1
80rm -f ~/_firejail_test_link1 80rm -f ~/_firejail_test_link1
81rm -f ~/_firejail_test_link2 81rm -f ~/_firejail_test_link2
82 82
83echo "TESTING: private-etc (test/fs/private-etc.exp)"
84./private-etc.exp
85
86#echo "TESTING: empty private-etc (test/fs/private-etc-empty.exp)"
87#./private-etc-empty.exp
88
89echo "TESTING: private-bin (test/fs/private-bin.exp)" 83echo "TESTING: private-bin (test/fs/private-bin.exp)"
90./private-bin.exp 84./private-bin.exp
91 85
diff --git a/test/fs/private-etc-empty.exp b/test/fs/private-etc-empty.exp
deleted file mode 100755
index 6878a642c..000000000
--- a/test/fs/private-etc-empty.exp
+++ /dev/null
@@ -1,42 +0,0 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2022 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --private-etc=blablabla\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
14}
15sleep 1
16
17send -- "ls -l /etc | wc -l\r"
18expect {
19 timeout {puts "TESTING ERROR 1\n";exit}
20 "0" {puts "Debian\n"}
21 "1" {puts "Arch\n"}
22}
23send -- "exit\r"
24sleep 1
25
26send -- "firejail --profile=private-etc-empty.profile\r"
27expect {
28 timeout {puts "TESTING ERROR 0\n";exit}
29 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
30}
31sleep 1
32
33send -- "ls -l /etc | wc -l\r"
34expect {
35 timeout {puts "TESTING ERROR 1\n";exit}
36 "0" {puts "Debian\n"}
37 "1" {puts "Arch\n"}
38
39}
40
41after 100
42puts "\nall done\n"
diff --git a/test/fs/private-etc-empty.profile b/test/fs/private-etc-empty.profile
deleted file mode 100644
index 38aa8cd68..000000000
--- a/test/fs/private-etc-empty.profile
+++ /dev/null
@@ -1 +0,0 @@
1private-etc blablabla
diff --git a/test/fs/private-etc.exp b/test/fs/private-etc.exp
deleted file mode 100755
index f51fc5221..000000000
--- a/test/fs/private-etc.exp
+++ /dev/null
@@ -1,69 +0,0 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2022 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10# directory with ~
11send -- "firejail --private-etc=passwd,group,resolv.conf,X11\r"
12expect {
13 timeout {puts "TESTING ERROR 1\n";exit}
14 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
15}
16sleep 1
17
18send -- "LC_ALL=C ls -al /etc\r"
19expect {
20 timeout {puts "TESTING ERROR 3\n";exit}
21 "X11"
22}
23expect {
24 timeout {puts "TESTING ERROR 4\n";exit}
25 "group"
26}
27expect {
28 timeout {puts "TESTING ERROR 5\n";exit}
29 "passwd"
30}
31expect {
32 timeout {puts "TESTING ERROR 6\n";exit}
33 "resolv.conf"
34}
35
36
37send -- "file /etc/shadow\r"
38expect {
39 timeout {puts "TESTING ERROR 7\n";exit}
40 "No such file or directory"
41}
42after 100
43send -- "exit\r"
44sleep 1
45
46send -- "firejail --private-etc=shadow\r"
47expect {
48 timeout {puts "TESTING ERROR 8\n";exit}
49 "invalid file type"
50}
51after 100
52
53send -- "firejail --private-etc=\"bla;bla\"\r"
54expect {
55 timeout {puts "TESTING ERROR 9\n";exit}
56 "is an invalid filename"
57}
58after 100
59
60send -- "firejail --private-etc=../bin/ls\r"
61expect {
62 timeout {puts "TESTING ERROR 10\n";exit}
63 "is an invalid filename"
64}
65after 100
66
67send -- "exit\r"
68after 100
69puts "\nall done\n"