summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--RELNOTES4
-rwxr-xr-xconfigure18
-rw-r--r--configure.ac2
-rw-r--r--src/floader/README.md7
-rw-r--r--src/floader/loader.c161
-rw-r--r--src/floader/makefile5
-rwxr-xr-xtest/blacklist-link.exp82
-rwxr-xr-xtest/blacklist.exp75
-rw-r--r--test/blacklist1.profile1
-rw-r--r--test/blacklist2.profile1
-rw-r--r--test/blacklist3.profile1
11 files changed, 12 insertions, 345 deletions
diff --git a/RELNOTES b/RELNOTES
index 70abe7ac7..7dceccc0c 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -1,4 +1,4 @@
1firejail (0.9.55) baseline; urgency=low 1firejail (0.9.56~rc1) baseline; urgency=low
2 * work in progress 2 * work in progress
3 * modif: removed CFG_CHROOT_DESKTOP configuration option 3 * modif: removed CFG_CHROOT_DESKTOP configuration option
4 * modif: removed compile time --enable-network=restricted 4 * modif: removed compile time --enable-network=restricted
@@ -16,7 +16,7 @@ firejail (0.9.55) baseline; urgency=low
16 * new profiles: ms-skype, ms-word, riot-desktop, gnome-mpv, snox, gradio, 16 * new profiles: ms-skype, ms-word, riot-desktop, gnome-mpv, snox, gradio,
17 * new profiles: standardnotes-desktop, shellcheck, patch, flameshot, 17 * new profiles: standardnotes-desktop, shellcheck, patch, flameshot,
18 * new profiles: rview, rvim, vimcat, vimdiff, vimpager, vimtutor, xxd 18 * new profiles: rview, rvim, vimcat, vimdiff, vimpager, vimtutor, xxd
19 -- netblue30 <netblue30@yahoo.com> Fri, 25 May 2018 08:00:00 -0500 19 -- netblue30 <netblue30@yahoo.com> Sat, 11 Aug 2018 08:00:00 -0500
20 20
21firejail (0.9.54) baseline; urgency=low 21firejail (0.9.54) baseline; urgency=low
22 * modif: --force removed 22 * modif: --force removed
diff --git a/configure b/configure
index 7c573f382..6e6f84256 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
1#! /bin/sh 1#! /bin/sh
2# Guess values for system-dependent variables and create Makefiles. 2# Guess values for system-dependent variables and create Makefiles.
3# Generated by GNU Autoconf 2.69 for firejail 0.9.55. 3# Generated by GNU Autoconf 2.69 for firejail 0.9.56~rc1.
4# 4#
5# Report bugs to <netblue30@yahoo.com>. 5# Report bugs to <netblue30@yahoo.com>.
6# 6#
@@ -580,8 +580,8 @@ MAKEFLAGS=
580# Identity of this package. 580# Identity of this package.
581PACKAGE_NAME='firejail' 581PACKAGE_NAME='firejail'
582PACKAGE_TARNAME='firejail' 582PACKAGE_TARNAME='firejail'
583PACKAGE_VERSION='0.9.55' 583PACKAGE_VERSION='0.9.56~rc1'
584PACKAGE_STRING='firejail 0.9.55' 584PACKAGE_STRING='firejail 0.9.56~rc1'
585PACKAGE_BUGREPORT='netblue30@yahoo.com' 585PACKAGE_BUGREPORT='netblue30@yahoo.com'
586PACKAGE_URL='https://firejail.wordpress.com' 586PACKAGE_URL='https://firejail.wordpress.com'
587 587
@@ -1277,7 +1277,7 @@ if test "$ac_init_help" = "long"; then
1277 # Omit some internal or obsolete options to make the list less imposing. 1277 # Omit some internal or obsolete options to make the list less imposing.
1278 # This message is too long to be a string in the A/UX 3.1 sh. 1278 # This message is too long to be a string in the A/UX 3.1 sh.
1279 cat <<_ACEOF 1279 cat <<_ACEOF
1280\`configure' configures firejail 0.9.55 to adapt to many kinds of systems. 1280\`configure' configures firejail 0.9.56~rc1 to adapt to many kinds of systems.
1281 1281
1282Usage: $0 [OPTION]... [VAR=VALUE]... 1282Usage: $0 [OPTION]... [VAR=VALUE]...
1283 1283
@@ -1339,7 +1339,7 @@ fi
1339 1339
1340if test -n "$ac_init_help"; then 1340if test -n "$ac_init_help"; then
1341 case $ac_init_help in 1341 case $ac_init_help in
1342 short | recursive ) echo "Configuration of firejail 0.9.55:";; 1342 short | recursive ) echo "Configuration of firejail 0.9.56~rc1:";;
1343 esac 1343 esac
1344 cat <<\_ACEOF 1344 cat <<\_ACEOF
1345 1345
@@ -1445,7 +1445,7 @@ fi
1445test -n "$ac_init_help" && exit $ac_status 1445test -n "$ac_init_help" && exit $ac_status
1446if $ac_init_version; then 1446if $ac_init_version; then
1447 cat <<\_ACEOF 1447 cat <<\_ACEOF
1448firejail configure 0.9.55 1448firejail configure 0.9.56~rc1
1449generated by GNU Autoconf 2.69 1449generated by GNU Autoconf 2.69
1450 1450
1451Copyright (C) 2012 Free Software Foundation, Inc. 1451Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1747,7 +1747,7 @@ cat >config.log <<_ACEOF
1747This file contains any messages produced by compilers while 1747This file contains any messages produced by compilers while
1748running configure, to aid debugging if configure makes a mistake. 1748running configure, to aid debugging if configure makes a mistake.
1749 1749
1750It was created by firejail $as_me 0.9.55, which was 1750It was created by firejail $as_me 0.9.56~rc1, which was
1751generated by GNU Autoconf 2.69. Invocation command line was 1751generated by GNU Autoconf 2.69. Invocation command line was
1752 1752
1753 $ $0 $@ 1753 $ $0 $@
@@ -4395,7 +4395,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
4395# report actual input values of CONFIG_FILES etc. instead of their 4395# report actual input values of CONFIG_FILES etc. instead of their
4396# values after options handling. 4396# values after options handling.
4397ac_log=" 4397ac_log="
4398This file was extended by firejail $as_me 0.9.55, which was 4398This file was extended by firejail $as_me 0.9.56~rc1, which was
4399generated by GNU Autoconf 2.69. Invocation command line was 4399generated by GNU Autoconf 2.69. Invocation command line was
4400 4400
4401 CONFIG_FILES = $CONFIG_FILES 4401 CONFIG_FILES = $CONFIG_FILES
@@ -4449,7 +4449,7 @@ _ACEOF
4449cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 4449cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
4450ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" 4450ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
4451ac_cs_version="\\ 4451ac_cs_version="\\
4452firejail config.status 0.9.55 4452firejail config.status 0.9.56~rc1
4453configured by $0, generated by GNU Autoconf 2.69, 4453configured by $0, generated by GNU Autoconf 2.69,
4454 with options \\"\$ac_cs_config\\" 4454 with options \\"\$ac_cs_config\\"
4455 4455
diff --git a/configure.ac b/configure.ac
index 1b1b48ce2..8c6459335 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
1AC_PREREQ([2.68]) 1AC_PREREQ([2.68])
2AC_INIT(firejail, 0.9.55, netblue30@yahoo.com, , https://firejail.wordpress.com) 2AC_INIT(firejail, 0.9.56~rc1, netblue30@yahoo.com, , https://firejail.wordpress.com)
3AC_CONFIG_SRCDIR([src/firejail/main.c]) 3AC_CONFIG_SRCDIR([src/firejail/main.c])
4#AC_CONFIG_HEADERS([config.h]) 4#AC_CONFIG_HEADERS([config.h])
5 5
diff --git a/src/floader/README.md b/src/floader/README.md
deleted file mode 100644
index c1e14b2a6..000000000
--- a/src/floader/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
1READ ME
2-------
3
4* Run 'make'
5* Add comma separated process names to ~/.loader.conf
6* export LD_PRELOAD=<path>./loader.so (ideally to .bashrc)
7* Run any application within shell
diff --git a/src/floader/loader.c b/src/floader/loader.c
deleted file mode 100644
index b9844fa9b..000000000
--- a/src/floader/loader.c
+++ /dev/null
@@ -1,161 +0,0 @@
1/*
2 * Copyright (C) 2017-2018 Madura A. (madura.x86@gmail.com)
3 *
4 */
5#include <sys/types.h>
6#include <sys/stat.h>
7#include <sys/mman.h>
8#include <fcntl.h>
9#include <unistd.h>
10
11#include <string.h>
12#include <stdio.h>
13#include <stdlib.h>
14#include <ctype.h>
15
16#define MAX_MATCHES 32
17#define MAX_ARGS 1024
18#define MAX_ARGS_LEN 4096
19static void loader_main() __attribute__((constructor));
20
21char cmdline[MAX_ARGS_LEN];
22char *args[MAX_ARGS];
23char loader[] = "firejail";
24char confFile[256];
25char *names[MAX_MATCHES];
26
27#ifdef DEBUG
28#define DBG printf
29#else
30#define DBG
31#endif
32void remove_trailing_spaces(char *str)
33{
34 while (!isspace(*str))
35 {
36 str++;
37 }
38
39 while (*str != '\0')
40 {
41 *str = '\0';
42 str++;
43 }
44}
45
46void read_cmdline()
47{
48 int fd = open("/proc/self/cmdline", O_RDONLY);
49 ssize_t ret = 0, total = 0;
50 char* wcmdbuf = cmdline;
51 while ((ret = read(fd, wcmdbuf, 1)) != 0)
52 {
53 wcmdbuf++;
54 total += ret;
55 if (total > MAX_ARGS_LEN)
56 {
57 printf("Not enough memory\n");
58 close(fd);
59 return ;
60 }
61 }
62 close(fd);
63}
64
65void make_args()
66{
67 int cI = 0, argI=0;
68 char* argstart = &cmdline[0];
69 for (;cI<MAX_ARGS_LEN;cI++)
70 {
71 if (cmdline[cI] == '\0')
72 {
73 args[argI]= argstart;
74 argstart = &cmdline[cI+1];
75 argI++;
76 if (*argstart == '\0')
77 {
78 break;
79 }
80 }
81 }
82 args[argI] = argstart;
83 argI++;
84 args[argI] = NULL;
85}
86
87void loader_main()
88{
89 snprintf(confFile, 255, "%s/.loader.conf", getenv("HOME"));
90
91 struct stat confFileStat;
92
93 stat(confFile, &confFileStat);
94
95 int confFd = open(confFile, O_RDONLY);
96
97 if (confFd == -1)
98 {
99 close(confFd);
100 return;
101 }
102 char* conf = (char*) malloc(confFileStat.st_size);
103 if (conf == NULL)
104 {
105 close(confFd);
106 return;
107 }
108 ssize_t ret = read(confFd, conf, confFileStat.st_size);
109 if (ret == -1)
110 {
111 close(confFd);
112 return;
113 }
114
115 close(confFd);
116 size_t fI = 0;
117 int matchId = 0;
118 names[matchId] = conf;
119 matchId++;
120 for (;fI < confFileStat.st_size-1;fI++)
121 {
122 if (conf[fI] == ',')
123 {
124 names[matchId] = &conf[fI+1];
125 conf[fI] = '\0';
126
127 matchId++;
128 }
129 }
130
131 remove_trailing_spaces(names[matchId-1]);
132
133 read_cmdline();
134
135 make_args();
136
137#ifdef DEBUG
138 int xarg=0;
139 while (args[xarg] != NULL)
140 {
141 DBG(".%s\n", args[xarg]);
142 xarg++;
143 }
144#endif
145
146 int x;
147
148 for (x = 0;x<matchId;x++)
149 {
150 DBG("%s\n",names[x]);
151 if (strstr(args[0], names[x]) != NULL)
152 {
153 DBG("highjack!\n");
154
155 free(conf);
156
157 execvp(loader, args );
158 }
159 }
160
161}
diff --git a/src/floader/makefile b/src/floader/makefile
deleted file mode 100644
index eeb96571d..000000000
--- a/src/floader/makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1all:
2 gcc -ggdb -shared -fPIC loader.c -o loader.so
3
4debug:
5 gcc -ggdb -shared -DDEBUG -fPIC loader.c -o loader.so
diff --git a/test/blacklist-link.exp b/test/blacklist-link.exp
deleted file mode 100755
index 4252f875a..000000000
--- a/test/blacklist-link.exp
+++ /dev/null
@@ -1,82 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7# blacklist a directory symlink
8send -- "firejail --blacklist=auto2\r"
9expect {
10 timeout {puts "TESTING ERROR 1\n";exit}
11 "Child process initialized"
12}
13sleep 1
14
15send -- "ls auto2\r"
16expect {
17 timeout {puts "TESTING ERROR 2\n";exit}
18 "cannot open directory"
19}
20send -- "exit\r"
21sleep 1
22
23# blacklist a directory symlink from a profile file
24send -- "firejail --profile=blacklist3.profile\r"
25expect {
26 timeout {puts "TESTING ERROR 3\n";exit}
27 "Child process initialized"
28}
29sleep 1
30
31send -- "ls auto2\r"
32expect {
33 timeout {puts "TESTING ERROR 4\n";exit}
34 "cannot open directory"
35}
36send -- "exit\r"
37sleep 1
38
39# do not blacklist /bin
40send -- "firejail --blacklist=auto3\r"
41expect {
42 timeout {puts "TESTING ERROR 5\n";exit}
43 "auto3 directory link was not blacklisted"
44}
45expect {
46 timeout {puts "TESTING ERROR 5.1\n";exit}
47 "Child process initialized"
48}
49sleep 1
50
51send -- "ls auto3; pwd\r"
52expect {
53 timeout {puts "TESTING ERROR 6\n";exit}
54 "cannot open directory" {puts "TESTING ERROR 6.1\n";exit}
55 "home"
56}
57send -- "exit\r"
58sleep 1
59
60# do not blacklist /usr/bin
61send -- "firejail --blacklist=auto3\r"
62expect {
63 timeout {puts "TESTING ERROR 7\n";exit}
64 "auto3 directory link was not blacklisted"
65}
66expect {
67 timeout {puts "TESTING ERROR 7.1\n";exit}
68 "Child process initialized"
69}
70sleep 1
71
72send -- "ls auto3; pwd\r"
73expect {
74 timeout {puts "TESTING ERROR 8\n";exit}
75 "cannot open directory" {puts "TESTING ERROR 9.1\n";exit}
76 "home"
77}
78send -- "exit\r"
79sleep 1
80
81
82puts "all done\n"
diff --git a/test/blacklist.exp b/test/blacklist.exp
deleted file mode 100755
index 9c3dddf1f..000000000
--- a/test/blacklist.exp
+++ /dev/null
@@ -1,75 +0,0 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7# directory with ~
8send -- "firejail --blacklist=~/.config\r"
9expect {
10 timeout {puts "TESTING ERROR 1\n";exit}
11 "Child process initialized"
12}
13sleep 1
14
15send -- "ls -al ~/.config\r"
16expect {
17 timeout {puts "TESTING ERROR 2\n";exit}
18 "cannot open directory"
19}
20
21send -- "exit\r"
22sleep 1
23
24# directory with ~ in profile file
25send -- "firejail --profile=blacklist1.profile\r"
26expect {
27 timeout {puts "TESTING ERROR 3\n";exit}
28 "Child process initialized"
29}
30sleep 1
31
32send -- "ls -al ~/.config\r"
33expect {
34 timeout {puts "TESTING ERROR 4\n";exit}
35 "cannot open directory"
36}
37
38send -- "exit\r"
39sleep 1
40
41
42# directory with space
43send -- "firejail \"--blacklist=dir with space\"\r"
44expect {
45 timeout {puts "TESTING ERROR 5\n";exit}
46 "Child process initialized"
47}
48sleep 1
49
50send -- "ls -al \"dir with space\"\r"
51expect {
52 timeout {puts "TESTING ERROR 6\n";exit}
53 "cannot open directory"
54}
55
56send -- "exit\r"
57sleep 1
58
59# directory with space in profile
60send -- "firejail --profile=blacklist2.profile\r"
61expect {
62 timeout {puts "TESTING ERROR 7\n";exit}
63 "Child process initialized"
64}
65sleep 1
66
67send -- "ls -al \"dir with space\"\r"
68expect {
69 timeout {puts "TESTING ERROR 8\n";exit}
70 "cannot open directory"
71}
72
73
74
75puts "\n"
diff --git a/test/blacklist1.profile b/test/blacklist1.profile
deleted file mode 100644
index f12facd05..000000000
--- a/test/blacklist1.profile
+++ /dev/null
@@ -1 +0,0 @@
1blacklist ~/.config
diff --git a/test/blacklist2.profile b/test/blacklist2.profile
deleted file mode 100644
index 4bb603db2..000000000
--- a/test/blacklist2.profile
+++ /dev/null
@@ -1 +0,0 @@
1blacklist dir with space
diff --git a/test/blacklist3.profile b/test/blacklist3.profile
deleted file mode 100644
index 08f754f3f..000000000
--- a/test/blacklist3.profile
+++ /dev/null
@@ -1 +0,0 @@
1blacklist auto2