aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-04-06 15:20:33 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-04-06 15:20:33 -0400
commitd090549e0e24dcc92ff411d4b51ac0df578b9ce4 (patch)
treeaa60b725fbbaca12537df20f9775ec15f631b631
parentgrsecurity: --bandwidth (diff)
downloadfirejail-d090549e0e24dcc92ff411d4b51ac0df578b9ce4.tar.gz
firejail-d090549e0e24dcc92ff411d4b51ac0df578b9ce4.tar.zst
firejail-d090549e0e24dcc92ff411d4b51ac0df578b9ce4.zip
grsecurity fixes
-rw-r--r--src/firejail/main.c2
-rwxr-xr-xtest/bandwidth.exp62
2 files changed, 64 insertions, 0 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c
index 0b47fd6db..166ca1b89 100644
--- a/src/firejail/main.c
+++ b/src/firejail/main.c
@@ -783,7 +783,9 @@ int main(int argc, char **argv) {
783 int parent_sshd = 0; 783 int parent_sshd = 0;
784 { 784 {
785 pid_t ppid = getppid(); 785 pid_t ppid = getppid();
786 EUID_ROOT();
786 char *comm = pid_proc_comm(ppid); 787 char *comm = pid_proc_comm(ppid);
788 EUID_USER();
787 if (comm) { 789 if (comm) {
788 if (strcmp(comm, "sshd") == 0) 790 if (strcmp(comm, "sshd") == 0)
789 parent_sshd = 1; 791 parent_sshd = 1;
diff --git a/test/bandwidth.exp b/test/bandwidth.exp
new file mode 100755
index 000000000..33b351296
--- /dev/null
+++ b/test/bandwidth.exp
@@ -0,0 +1,62 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --name=test --net=br0\r"
8expect {
9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized"
11}
12sleep 2
13
14spawn $env(SHELL)
15send -- "firejail --bandwidth=test status\r"
16expect {
17 timeout {puts "TESTING ERROR 1\n";exit}
18 "qdisc noqueue 0: dev eth0"
19}
20sleep 1
21
22send -- "firejail --bandwidth=test set br0 50 10\r"
23expect {
24 timeout {puts "TESTING ERROR 2\n";exit}
25 "Configuring interface eth0"
26}
27expect {
28 timeout {puts "TESTING ERROR 3\n";exit}
29 "configuring tc ingress"
30}
31expect {
32 timeout {puts "TESTING ERROR 4\n";exit}
33 "configuring tc egress"
34}
35
36send -- "firejail --bandwidth=test status\r"
37expect {
38 timeout {puts "TESTING ERROR 5\n";exit}
39 "dev eth0"
40}
41expect {
42 timeout {puts "TESTING ERROR 6\n";exit}
43 "rate 80Kbit burst 10Kb"
44}
45sleep 1
46
47send -- "firejail --bandwidth=test clear br0\r"
48expect {
49 timeout {puts "TESTING ERROR 7\n";exit}
50 "Removing bandwith limits"
51}
52sleep 1
53
54send -- "firejail --bandwidth=test status; pwd\r"
55expect {
56 timeout {puts "TESTING ERROR 8\n";exit}
57 "rate 80Kbit burst 10Kb" {puts "TESTING ERROR 9\n";exit}
58 "home" {puts "ok\n"}
59}
60sleep 1
61
62puts "\nall done\n"