aboutsummaryrefslogtreecommitdiffstats
path: root/test/profiles
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-04-21 14:37:53 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-04-21 14:37:53 -0400
commitad2f7bc496e3cc83bca2381515312dd2ef6fc7f1 (patch)
tree0a923afb486b1f13ab35d26138cdbf51e0961aec /test/profiles
parent--read-write option (diff)
downloadfirejail-ad2f7bc496e3cc83bca2381515312dd2ef6fc7f1.tar.gz
firejail-ad2f7bc496e3cc83bca2381515312dd2ef6fc7f1.tar.zst
firejail-ad2f7bc496e3cc83bca2381515312dd2ef6fc7f1.zip
make test-profiles
Diffstat (limited to 'test/profiles')
-rwxr-xr-xtest/profiles/profile_syntax.exp66
-rwxr-xr-xtest/profiles/profile_syntax2.exp50
-rwxr-xr-xtest/profiles/profiles.sh19
-rwxr-xr-xtest/profiles/test-profile.exp23
-rw-r--r--test/profiles/test.profile5
-rw-r--r--test/profiles/test2.profile4
6 files changed, 167 insertions, 0 deletions
diff --git a/test/profiles/profile_syntax.exp b/test/profiles/profile_syntax.exp
new file mode 100755
index 000000000..ecad1043b
--- /dev/null
+++ b/test/profiles/profile_syntax.exp
@@ -0,0 +1,66 @@
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
10send -- "firejail --profile=test.profile\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15
16sleep 2
17send -- "cat /sbin/iptables\r"
18expect {
19 timeout {puts "TESTING ERROR 2\n";exit}
20 "No such file" {puts "\nTESTING /sbin/iptables not found\n"}
21 "Permission denied"
22}
23
24sleep 1
25send -- "ls -l /etc/shadow\r"
26expect {
27 timeout {puts "TESTING ERROR 3\n";exit}
28 "root root 0"
29}
30
31sleep 1
32send -- "rmdir;pwd\r"
33expect {
34 timeout {puts "TESTING ERROR 4\n";exit}
35 "Permission denied"
36}
37expect {
38 timeout {puts "TESTING ERROR 5\n";exit}
39 "home"
40}
41
42sleep 1
43send -- "mount;pwd\r"
44expect {
45 timeout {puts "TESTING ERROR 6\n";exit}
46 "Permission denied"
47}
48expect {
49 timeout {puts "TESTING ERROR 7\n";exit}
50 "home"
51}
52
53sleep 1
54send -- "umount;pwd\r"
55expect {
56 timeout {puts "TESTING ERROR 8\n";exit}
57 "Permission denied"
58}
59expect {
60 timeout {puts "TESTING ERROR 9\n";exit}
61 "home"
62}
63send -- "exit\r"
64
65sleep 1
66puts "\n"
diff --git a/test/profiles/profile_syntax2.exp b/test/profiles/profile_syntax2.exp
new file mode 100755
index 000000000..ba83731be
--- /dev/null
+++ b/test/profiles/profile_syntax2.exp
@@ -0,0 +1,50 @@
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
10send -- "firejail --debug --profile=test2.profile\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Reading profile test2.profile"
14}
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "Reading profile test.profile"
18}
19expect {
20 timeout {puts "TESTING ERROR 2\n";exit}
21 "Mounting a new /home directory"
22}
23expect {
24 timeout {puts "TESTING ERROR 3\n";exit}
25 "Disable /bin/rmdir" {puts "Most Linux platforms\n"}
26 "Disable /usr/bin/rmdir" { puts "OpenSUSE platform\n"}
27}
28expect {
29 timeout {puts "TESTING ERROR 4\n";exit}
30 "Drop CAP_SYS_MODULE"
31}
32expect {
33 timeout {puts "TESTING ERROR 5\n";exit}
34 "SECCOMP Filter"
35}
36expect {
37 timeout {puts "TESTING ERROR 6\n";exit}
38 "BLACKLIST"
39}
40expect {
41 timeout {puts "TESTING ERROR 7\n";exit}
42 "mount"
43}
44expect {
45 timeout {puts "TESTING ERROR 8\n";exit}
46 "Child process initialized"
47}
48
49sleep 1
50puts "\nall done\n"
diff --git a/test/profiles/profiles.sh b/test/profiles/profiles.sh
new file mode 100755
index 000000000..ea1f51c1a
--- /dev/null
+++ b/test/profiles/profiles.sh
@@ -0,0 +1,19 @@
1#!/bin/bash
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
5
6echo "TESTING: default profiles installed in /etc"
7PROFILES=`ls /etc/firejail/*.profile`
8for PROFILE in $PROFILES
9do
10 echo "TESTING: $PROFILE"
11 ./test-profile.exp $PROFILE
12done
13
14echo "TESTING: profile syntax (profiles/profile_syntax.exp)"
15./profile_syntax.exp
16
17echo "TESTING: profile syntax 2 (profiles/profile_syntax2.exp)"
18./profile_syntax2.exp
19
diff --git a/test/profiles/test-profile.exp b/test/profiles/test-profile.exp
new file mode 100755
index 000000000..590b42652
--- /dev/null
+++ b/test/profiles/test-profile.exp
@@ -0,0 +1,23 @@
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: test-profile.exp profile_name"
13 exit
14}
15
16send -- "firejail --profile=$argv /bin/bash\r"
17expect {
18 timeout {puts "TESTING ERROR 0\n";exit}
19 "Child process initialized"
20}
21send -- "exit\r"
22after 100
23puts "\n"
diff --git a/test/profiles/test.profile b/test/profiles/test.profile
new file mode 100644
index 000000000..1d69cc960
--- /dev/null
+++ b/test/profiles/test.profile
@@ -0,0 +1,5 @@
1 blacklist /sbin/iptables
2blacklist /etc/shadow
3 blacklist /bin/rmdir
4blacklist ${PATH}/umount
5blacklist ${PATH}/mount
diff --git a/test/profiles/test2.profile b/test/profiles/test2.profile
new file mode 100644
index 000000000..d7e1a1f21
--- /dev/null
+++ b/test/profiles/test2.profile
@@ -0,0 +1,4 @@
1caps
2seccomp
3 private
4 include test.profile