aboutsummaryrefslogtreecommitdiffstats
path: root/test/profiles
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-05-03 08:41:24 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-05-03 08:41:24 -0400
commit57bea6c8c4d1bd666ce57057b1cbb681b3cc4afc (patch)
tree60f90718665a1a812b552f589bc4d85616232df1 /test/profiles
parentMerge branch 'master' of https://github.com/netblue30/firejail (diff)
downloadfirejail-57bea6c8c4d1bd666ce57057b1cbb681b3cc4afc.tar.gz
firejail-57bea6c8c4d1bd666ce57057b1cbb681b3cc4afc.tar.zst
firejail-57bea6c8c4d1bd666ce57057b1cbb681b3cc4afc.zip
networking features testing
Diffstat (limited to 'test/profiles')
-rwxr-xr-xtest/profiles/profile_followlnk.exp37
-rwxr-xr-xtest/profiles/profile_noperm.exp13
-rwxr-xr-xtest/profiles/profile_readonly.exp36
-rwxr-xr-xtest/profiles/profiles.sh9
-rw-r--r--test/profiles/readonly-lnk.profile2
-rw-r--r--test/profiles/readonly.profile2
6 files changed, 99 insertions, 0 deletions
diff --git a/test/profiles/profile_followlnk.exp b/test/profiles/profile_followlnk.exp
new file mode 100755
index 000000000..4d89de26b
--- /dev/null
+++ b/test/profiles/profile_followlnk.exp
@@ -0,0 +1,37 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "mkdir /tmp/firejailtestdir\r"
8send -- "ln -s /tmp/firejailtestdir /tmp/firejailtestdirlnk\r"
9send -- "touch /tmp/firejailtestfile\r"
10send -- "ln -s /tmp/firejailtestfile /tmp/firejailtestfilelnk\r"
11sleep 1
12
13send -- "firejail --profile=readonly-lnk.profile\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18
19send -- "ls > /tmp/firejailtestdirlnk/ttt\r"
20expect {
21 timeout {puts "TESTING ERROR 1\n";exit}
22 "Read-only file system"
23}
24sleep 1
25
26send -- "ls > /tmp/firejailtestfilelnk;pwd\r"
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "Read-only file system"
30}
31sleep 1
32
33send -- "exit\r"
34send -- "rm -fr /tmp/firejailtest*\r"
35sleep 1
36
37puts "\nall done\n"
diff --git a/test/profiles/profile_noperm.exp b/test/profiles/profile_noperm.exp
new file mode 100755
index 000000000..25ec580bd
--- /dev/null
+++ b/test/profiles/profile_noperm.exp
@@ -0,0 +1,13 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --profile=/etc/shadow\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "cannot access profile"
11}
12sleep 1
13puts "\nall done\n"
diff --git a/test/profiles/profile_readonly.exp b/test/profiles/profile_readonly.exp
new file mode 100755
index 000000000..e8e78d6ad
--- /dev/null
+++ b/test/profiles/profile_readonly.exp
@@ -0,0 +1,36 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "mkdir /tmp/firejailtestdir\r"
8send -- "touch /tmp/firejailtestfile\r"
9sleep 1
10
11send -- "firejail --profile=readonly.profile\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 "Child process initialized"
15}
16sleep 2
17
18send -- "ls > /tmp/firejailtestdir/ttt\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Read-only file system"
22}
23sleep 1
24
25send -- "ls > /tmp/firejailtestfile\r"
26expect {
27 timeout {puts "TESTING ERROR 2\n";exit}
28 "Read-only file system"
29}
30send -- "exit\r"
31sleep 1
32
33send -- "rm -fr /tmp/firejailtest*\r"
34sleep 1
35
36puts "\nall done\n"
diff --git a/test/profiles/profiles.sh b/test/profiles/profiles.sh
index e3adc8a4f..ca0b9fb29 100755
--- a/test/profiles/profiles.sh
+++ b/test/profiles/profiles.sh
@@ -23,3 +23,12 @@ echo "TESTING: profile syntax 2 (test/profiles/profile_syntax2.exp)"
23echo "TESTING: ignore command (test/profiles/ignore.exp)" 23echo "TESTING: ignore command (test/profiles/ignore.exp)"
24./ignore.exp 24./ignore.exp
25 25
26echo "TESTING: profile read-only (test/profiles/profile_readonly.exp)"
27./profile_readonly.exp
28
29echo "TESTING: profile read-only links (test/profiles/profile_readonly.exp)"
30./profile_followlnk.exp
31
32echo "TESTING: profile no permissions (test/profiles/profile_noperm.exp)"
33./profile_noperm.exp
34
diff --git a/test/profiles/readonly-lnk.profile b/test/profiles/readonly-lnk.profile
new file mode 100644
index 000000000..71ffb1a26
--- /dev/null
+++ b/test/profiles/readonly-lnk.profile
@@ -0,0 +1,2 @@
1read-only /tmp/firejailtestdirlnk
2read-only /tmp/firejailtestfilelnk
diff --git a/test/profiles/readonly.profile b/test/profiles/readonly.profile
new file mode 100644
index 000000000..55d89e3d7
--- /dev/null
+++ b/test/profiles/readonly.profile
@@ -0,0 +1,2 @@
1read-only /tmp/firejailtestdir
2read-only /tmp/firejailtestfile \ No newline at end of file