aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/firejail/profile.c8
-rw-r--r--src/man/firejail.txt3
-rwxr-xr-xtest/arguments/arguments.sh5
-rwxr-xr-xtest/arguments/outrun.sh22
-rwxr-xr-xtest/environment/dash.exp2
-rwxr-xr-xtest/environment/dns.exp2
-rwxr-xr-xtest/fs/invalid_filename.exp62
-rwxr-xr-xtest/ssh/login.exp49
-rwxr-xr-xtest/ssh/scp.exp63
-rwxr-xr-xtest/ssh/sftp.exp87
-rwxr-xr-xtest/ssh/ssh.sh16
-rwxr-xr-xtest/utils/firemon-cgroup.exp40
-rwxr-xr-xtest/utils/utils.sh3
13 files changed, 10 insertions, 352 deletions
diff --git a/src/firejail/profile.c b/src/firejail/profile.c
index a90ecbeee..98c45b637 100644
--- a/src/firejail/profile.c
+++ b/src/firejail/profile.c
@@ -604,6 +604,10 @@ int profile_check_line(char *ptr, int lineno, const char *fname) {
604 return 0; 604 return 0;
605 } 605 }
606 // seccomp drop list without default list 606 // seccomp drop list without default list
607 if (strcmp(ptr, "seccomp.drop") == 0) {
608 fprintf(stderr, "Error: line %d in %s is invalid\n", lineno, fname);
609 exit(1);
610 }
607 if (strncmp(ptr, "seccomp.drop ", 13) == 0) { 611 if (strncmp(ptr, "seccomp.drop ", 13) == 0) {
608#ifdef HAVE_SECCOMP 612#ifdef HAVE_SECCOMP
609 if (checkcfg(CFG_SECCOMP)) { 613 if (checkcfg(CFG_SECCOMP)) {
@@ -617,6 +621,10 @@ int profile_check_line(char *ptr, int lineno, const char *fname) {
617 } 621 }
618 622
619 // seccomp keep list 623 // seccomp keep list
624 if (strcmp(ptr, "seccomp.keep") == 0) {
625 fprintf(stderr, "Error: line %d in %s is invalid\n", lineno, fname);
626 exit(1);
627 }
620 if (strncmp(ptr, "seccomp.keep ", 13) == 0) { 628 if (strncmp(ptr, "seccomp.keep ", 13) == 0) {
621#ifdef HAVE_SECCOMP 629#ifdef HAVE_SECCOMP
622 if (checkcfg(CFG_SECCOMP)) { 630 if (checkcfg(CFG_SECCOMP)) {
diff --git a/src/man/firejail.txt b/src/man/firejail.txt
index 0bc1c1b5d..98d74bcf8 100644
--- a/src/man/firejail.txt
+++ b/src/man/firejail.txt
@@ -296,9 +296,6 @@ Example:
296.br 296.br
297$ firejail \-\-debug-errnos 297$ firejail \-\-debug-errnos
298.TP 298.TP
299\fB\-\-debug-private-lib
300Debug messages for --private-lib option.
301.TP
302\fB\-\-debug-protocols 299\fB\-\-debug-protocols
303Print all recognized protocols in the current Firejail software build and exit. 300Print all recognized protocols in the current Firejail software build and exit.
304.br 301.br
diff --git a/test/arguments/arguments.sh b/test/arguments/arguments.sh
index d9f2d4697..c3505c188 100755
--- a/test/arguments/arguments.sh
+++ b/test/arguments/arguments.sh
@@ -18,8 +18,3 @@ sleep 1
18echo "TESTING: 3. --join option" 18echo "TESTING: 3. --join option"
19./joinrun.exp 19./joinrun.exp
20sleep 1 20sleep 1
21
22echo "TESTING: 4. --output option"
23./outrun.exp
24rm out
25rm out.*
diff --git a/test/arguments/outrun.sh b/test/arguments/outrun.sh
deleted file mode 100755
index 5bc3b1e37..000000000
--- a/test/arguments/outrun.sh
+++ /dev/null
@@ -1,22 +0,0 @@
1#!/bin/bash
2
3echo "TESTING: 4.1 - simple args"
4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit arg1 arg2
5
6# simple quotes, testing spaces in file names
7echo "TESTING: 4.2 - args with space and \""
8firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit "arg1 tail" "arg2 tail"
9
10echo "TESTING: 4.3 - args with space and '"
11firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit 'arg1 tail' 'arg2 tail'
12
13# escaped space in file names
14echo "TESTING: 4.4 - args with space and \\"
15firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit arg1\ tail arg2\ tail
16
17# & char appears in URLs - URLs should be quoted
18echo "TESTING: 4.5 - args with & and \""
19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit "arg1&tail" "arg2&tail"
20
21echo "TESTING: 4.6 - args with & and '"
22firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out faudit 'arg1&tail' 'arg2&tail'
diff --git a/test/environment/dash.exp b/test/environment/dash.exp
index cad4422a0..daaa26dab 100755
--- a/test/environment/dash.exp
+++ b/test/environment/dash.exp
@@ -5,7 +5,7 @@ cd /home
5spawn $env(SHELL) 5spawn $env(SHELL)
6match_max 100000 6match_max 100000
7 7
8send -- "firejail --private --tracelog --shell=/bin/dash\r" 8send -- "firejail --private --shell=/bin/dash\r"
9expect { 9expect {
10 timeout {puts "TESTING ERROR 0\n";exit} 10 timeout {puts "TESTING ERROR 0\n";exit}
11 "Child process initialized" 11 "Child process initialized"
diff --git a/test/environment/dns.exp b/test/environment/dns.exp
index 6ddc0ccea..4a23cb4d7 100755
--- a/test/environment/dns.exp
+++ b/test/environment/dns.exp
@@ -61,7 +61,7 @@ expect {
61send -- "exit\r" 61send -- "exit\r"
62sleep 1 62sleep 1
63 63
64send -- "firejail --trace --dns=208.67.222.222 wget -q debian.org\r" 64send -- "firejail --dns=208.67.222.222 wget -q debian.org\r"
65expect { 65expect {
66 timeout {puts "TESTING ERROR 1.2\n";exit} 66 timeout {puts "TESTING ERROR 1.2\n";exit}
67 "connect" 67 "connect"
diff --git a/test/fs/invalid_filename.exp b/test/fs/invalid_filename.exp
index 84abe74cd..085dc9803 100755
--- a/test/fs/invalid_filename.exp
+++ b/test/fs/invalid_filename.exp
@@ -18,28 +18,6 @@ expect {
18} 18}
19after 100 19after 100
20 20
21send -- "firejail --noprofile --cgroup=\"bla&&bla\"\r"
22expect {
23 timeout {puts "TESTING ERROR 2.2\n";exit}
24 "Error:"
25}
26expect {
27 timeout {puts "TESTING ERROR 2.3\n";exit}
28 "is an invalid filename"
29}
30after 100
31
32send -- "firejail --noprofile --chroot=\"bla&&bla\"\r"
33expect {
34 timeout {puts "TESTING ERROR 3.2\n";exit}
35 "Error:"
36}
37expect {
38 timeout {puts "TESTING ERROR 3.3\n";exit}
39 "is an invalid filename"
40}
41after 100
42
43send -- "firejail --noprofile --netfilter=\"bla&&bla\"\r" 21send -- "firejail --noprofile --netfilter=\"bla&&bla\"\r"
44expect { 22expect {
45 timeout {puts "TESTING ERROR 4.2\n";exit} 23 timeout {puts "TESTING ERROR 4.2\n";exit}
@@ -51,13 +29,6 @@ expect {
51} 29}
52after 100 30after 100
53 31
54send -- "firejail --noprofile --output=\"bla&&bla\"\r"
55expect {
56 timeout {puts "TESTING ERROR 5.3\n";exit}
57 "is an invalid filename"
58}
59after 100
60
61send -- "firejail --noprofile --private=\"bla&&bla\"\r" 32send -- "firejail --noprofile --private=\"bla&&bla\"\r"
62expect { 33expect {
63 timeout {puts "TESTING ERROR 6.2\n";exit} 34 timeout {puts "TESTING ERROR 6.2\n";exit}
@@ -69,39 +40,6 @@ expect {
69} 40}
70after 100 41after 100
71 42
72send -- "firejail --noprofile --private-bin=\"bla&&bla\"\r"
73expect {
74 timeout {puts "TESTING ERROR 7.2\n";exit}
75 "Error:"
76}
77expect {
78 timeout {puts "TESTING ERROR 7.3\n";exit}
79 "is an invalid filename"
80}
81after 100
82
83send -- "firejail --noprofile --private-home=\"bla&&bla\"\r"
84expect {
85 timeout {puts "TESTING ERROR 8.2\n";exit}
86 "Error:"
87}
88expect {
89 timeout {puts "TESTING ERROR 8.3\n";exit}
90 "is an invalid filename"
91}
92after 100
93
94send -- "firejail --noprofile --private-etc=\"bla&&bla\"\r"
95expect {
96 timeout {puts "TESTING ERROR 9.2\n";exit}
97 "Error:"
98}
99expect {
100 timeout {puts "TESTING ERROR 9.3\n";exit}
101 "is an invalid filename"
102}
103after 100
104
105send -- "firejail --profile=\"bla&&bla\"\r" 43send -- "firejail --profile=\"bla&&bla\"\r"
106expect { 44expect {
107 timeout {puts "TESTING ERROR 10.2\n";exit} 45 timeout {puts "TESTING ERROR 10.2\n";exit}
diff --git a/test/ssh/login.exp b/test/ssh/login.exp
deleted file mode 100755
index 479292c91..000000000
--- a/test/ssh/login.exp
+++ /dev/null
@@ -1,49 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "ssh firejail-test@0\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized" {puts "OK\n"}
11 "an existing sandbox was detected" {puts "OK\n"}
12}
13sleep 1
14
15send -- "ps aux | wc -l\r"
16expect {
17 timeout {puts "TESTING ERROR 1\n";exit}
18 "5"
19}
20after 100
21
22send -- "ls -l /home | grep drw | wc -l\r"
23expect {
24 timeout {puts "TESTING ERROR 2\n";exit}
25 "1"
26}
27after 100
28
29send -- "cat /proc/self/status | grep Seccomp\r"
30expect {
31 timeout {puts "TESTING ERROR 3\n";exit}
32 "2"
33}
34after 100
35
36send -- "cat /proc/self/status | grep CapBnd\r"
37expect {
38 timeout {puts "TESTING ERROR 4\n";exit}
39 "0000000000000000"
40}
41after 100
42
43# preparing scp/sftp tests
44send -- "rm testfile\r"
45
46send -- "exit\r"
47sleep 1
48
49puts "\nall done\n"
diff --git a/test/ssh/scp.exp b/test/ssh/scp.exp
deleted file mode 100755
index 355125751..000000000
--- a/test/ssh/scp.exp
+++ /dev/null
@@ -1,63 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "ssh firejail-test@0\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized" {puts "OK\n"}
11 "an existing sandbox was detected" {puts "OK\n"}
12}
13sleep 1
14
15send -- "rm -f testfile\r"
16after 100
17send -- "exit\r"
18sleep 1
19
20send -- "echo 12345 > testfile\r"
21after 100
22send -- "scp testfile firejail-test@0:~/testfile\r"
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "100%"
26}
27sleep 1
28
29
30send -- "ssh firejail-test@0\r"
31expect {
32 timeout {puts "TESTING ERROR 2\n";exit}
33 "Child process initialized" {puts "OK\n"}
34 "an existing sandbox was detected" {puts "OK\n"}
35}
36sleep 1
37send -- "cat testfile\r"
38expect {
39 timeout {puts "TESTING ERROR 3\n";exit}
40 "12345"
41}
42after 100
43send -- "exit\r"
44sleep 1
45
46send -- "rm testfile\r"
47after 100
48send -- "scp firejail-test@0:~/testfile testfile\r"
49expect {
50 timeout {puts "TESTING ERROR 4\n";exit}
51 "100%"
52}
53sleep 1
54send -- "cat testfile\r"
55expect {
56 timeout {puts "TESTING ERROR 5\n";exit}
57 "12345"
58}
59after 100
60send -- "rm testfile\r"
61sleep 1
62
63puts "\nall done\n"
diff --git a/test/ssh/sftp.exp b/test/ssh/sftp.exp
deleted file mode 100755
index 3b0124ec7..000000000
--- a/test/ssh/sftp.exp
+++ /dev/null
@@ -1,87 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "ssh firejail-test@0\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized" {puts "OK\n"}
11 "an existing sandbox was detected" {puts "OK\n"}
12}
13sleep 1
14
15send -- "rm -f testfile\r"
16after 100
17send -- "exit\r"
18sleep 1
19
20send -- "echo 12345 > testfile\r"
21after 100
22send -- "sftp firejail-test@0\r"
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "Connected to 0"
26}
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "sftp>"
30}
31after 100
32send -- "put testfile\r"
33expect {
34 timeout {puts "TESTING ERROR 3\n";exit}
35 "100%"
36}
37after 100
38send -- "exit\r"
39sleep 1
40
41
42send -- "ssh firejail-test@0\r"
43expect {
44 timeout {puts "TESTING ERROR 4\n";exit}
45 "Child process initialized" {puts "OK\n"}
46 "an existing sandbox was detected" {puts "OK\n"}
47}
48sleep 1
49send -- "cat testfile\r"
50expect {
51 timeout {puts "TESTING ERROR 5\n";exit}
52 "12345"
53}
54after 100
55send -- "exit\r"
56sleep 1
57
58send -- "rm testfile\r"
59after 100
60send -- "sftp firejail-test@0\r"
61expect {
62 timeout {puts "TESTING ERROR 6\n";exit}
63 "Connected to 0"
64}
65expect {
66 timeout {puts "TESTING ERROR 7\n";exit}
67 "sftp>"
68}
69after 100
70send -- "get testfile\r"
71expect {
72 timeout {puts "TESTING ERROR 8\n";exit}
73 "100%"
74}
75after 100
76send -- "exit\r"
77sleep 1
78send -- "cat testfile\r"
79expect {
80 timeout {puts "TESTING ERROR 9\n";exit}
81 "12345"
82}
83after 100
84send -- "rm testfile\r"
85sleep 1
86
87puts "\nall done\n"
diff --git a/test/ssh/ssh.sh b/test/ssh/ssh.sh
deleted file mode 100755
index 20a70b1b6..000000000
--- a/test/ssh/ssh.sh
+++ /dev/null
@@ -1,16 +0,0 @@
1#!/bin/bash
2# This file is part of Firejail project
3# Copyright (C) 2014-2018 Firejail Authors
4# License GPL v2
5
6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8
9echo "TESTING: ssh login (test/ssh/login.exp)"
10./login.exp
11
12echo "TESTING: sftp (test/ssh/sftp.exp)"
13./sftp.exp
14
15echo "TESTING: scp (test/ssh/scp.exp)"
16./scp.exp
diff --git a/test/utils/firemon-cgroup.exp b/test/utils/firemon-cgroup.exp
deleted file mode 100755
index 8282e701a..000000000
--- a/test/utils/firemon-cgroup.exp
+++ /dev/null
@@ -1,40 +0,0 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2018 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test1\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 1
16
17spawn $env(SHELL)
18send -- "firejail --name=test2\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Child process initialized"
22}
23sleep 1
24
25spawn $env(SHELL)
26send -- "firemon --cgroup\r"
27sleep 4
28expect {
29 timeout {puts "TESTING ERROR 2\n";exit}
30 "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit}
31 "name=test1"
32}
33expect {
34 timeout {puts "TESTING ERROR 3\n";exit}
35 "name=test2"
36}
37
38after 100
39
40puts "\nall done\n"
diff --git a/test/utils/utils.sh b/test/utils/utils.sh
index c4958094e..79184ab99 100755
--- a/test/utils/utils.sh
+++ b/test/utils/utils.sh
@@ -104,9 +104,6 @@ echo "TESTING: firemon caps (test/utils/firemon-caps.exp)"
104echo "TESTING: firemon cpu (test/utils/firemon-cpu.exp)" 104echo "TESTING: firemon cpu (test/utils/firemon-cpu.exp)"
105./firemon-cpu.exp 105./firemon-cpu.exp
106 106
107echo "TESTING: firemon cgroup (test/utils/firemon-cgroup.exp)"
108./firemon-cgroup.exp
109
110echo "TESTING: firemon version (test/utils/firemon-version.exp)" 107echo "TESTING: firemon version (test/utils/firemon-version.exp)"
111./firemon-version.exp 108./firemon-version.exp
112 109