aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/disable-common.inc4
-rw-r--r--etc/inc/disable-programs.inc3
-rw-r--r--etc/profile-a-l/armcord.profile40
-rw-r--r--etc/profile-a-l/i3.profile4
-rw-r--r--src/fids/main.c2
-rw-r--r--src/firecfg/desktop_files.c3
-rw-r--r--src/firecfg/firecfg.config1
-rw-r--r--src/firejail/bandwidth.c3
-rw-r--r--src/firejail/fs_home.c12
-rw-r--r--src/firejail/ids.c2
-rw-r--r--src/firejail/run_files.c2
-rw-r--r--src/firejail/util.c1
-rw-r--r--src/firemon/netstats.c2
-rw-r--r--src/jailcheck/access.c3
-rw-r--r--src/jailcheck/noexec.c2
-rw-r--r--src/jailcheck/virtual.c1
-rw-r--r--src/man/firejail.1.in25
-rw-r--r--src/profstats/main.c2
18 files changed, 106 insertions, 6 deletions
diff --git a/etc/inc/disable-common.inc b/etc/inc/disable-common.inc
index 55aabbc73..14f7d8cf7 100644
--- a/etc/inc/disable-common.inc
+++ b/etc/inc/disable-common.inc
@@ -167,6 +167,10 @@ blacklist ${RUNUSER}/gnome-session-leader-fifo
167blacklist ${RUNUSER}/gnome-shell 167blacklist ${RUNUSER}/gnome-shell
168blacklist ${RUNUSER}/gsconnect 168blacklist ${RUNUSER}/gsconnect
169 169
170# i3 IPC socket (allows arbitrary shell script execution)
171blacklist ${RUNUSER}/i3/ipc-socket.*
172blacklist /tmp/i3-*/ipc-socket.*
173
170# systemd 174# systemd
171blacklist ${HOME}/.config/systemd 175blacklist ${HOME}/.config/systemd
172blacklist ${HOME}/.local/share/systemd 176blacklist ${HOME}/.local/share/systemd
diff --git a/etc/inc/disable-programs.inc b/etc/inc/disable-programs.inc
index f638e1d97..d2f8b8cfa 100644
--- a/etc/inc/disable-programs.inc
+++ b/etc/inc/disable-programs.inc
@@ -259,6 +259,7 @@ blacklist ${HOME}/.clonk
259blacklist ${HOME}/.config/0ad 259blacklist ${HOME}/.config/0ad
260blacklist ${HOME}/.config/1Password 260blacklist ${HOME}/.config/1Password
261blacklist ${HOME}/.config/2048-qt 261blacklist ${HOME}/.config/2048-qt
262blacklist ${HOME}/.config/ArmCord
262blacklist ${HOME}/.config/Atom 263blacklist ${HOME}/.config/Atom
263blacklist ${HOME}/.config/Audaciousrc 264blacklist ${HOME}/.config/Audaciousrc
264blacklist ${HOME}/.config/Authenticator 265blacklist ${HOME}/.config/Authenticator
@@ -1250,11 +1251,13 @@ blacklist ${HOME}/yt-dlp.conf
1250blacklist ${HOME}/yt-dlp.conf.txt 1251blacklist ${HOME}/yt-dlp.conf.txt
1251blacklist ${RUNUSER}/*firefox* 1252blacklist ${RUNUSER}/*firefox*
1252blacklist ${RUNUSER}/akonadi 1253blacklist ${RUNUSER}/akonadi
1254blacklist ${RUNUSER}/i3
1253blacklist ${RUNUSER}/psd/*firefox* 1255blacklist ${RUNUSER}/psd/*firefox*
1254blacklist ${RUNUSER}/qutebrowser 1256blacklist ${RUNUSER}/qutebrowser
1255blacklist /etc/ssmtp 1257blacklist /etc/ssmtp
1256blacklist /tmp/.wine-* 1258blacklist /tmp/.wine-*
1257blacklist /tmp/akonadi-* 1259blacklist /tmp/akonadi-*
1260blacklist /tmp/i3-*
1258blacklist /tmp/lwjgl_* 1261blacklist /tmp/lwjgl_*
1259blacklist /var/games/nethack 1262blacklist /var/games/nethack
1260blacklist /var/games/slashem 1263blacklist /var/games/slashem
diff --git a/etc/profile-a-l/armcord.profile b/etc/profile-a-l/armcord.profile
new file mode 100644
index 000000000..470e0dee0
--- /dev/null
+++ b/etc/profile-a-l/armcord.profile
@@ -0,0 +1,40 @@
1# Firejail profile for armcord
2# Description: Standalone Discord client
3# This file is overwritten after every install/update
4# Persistent local customizations
5include armcord.local
6# Persistent global definitions
7include globals.local
8
9# Modules might depend on nodejs.
10# Add the below lines to your armcord.local if you need this.
11# Allow node (disabled by disable-interpreters.inc)
12#include allow-nodejs.inc
13#private-bin node
14
15# The lines below are needed to find the default Firefox profile name, to allow
16# opening links in an existing instance of Firefox (note that it still fails if
17# there isn't a Firefox instance running with the default profile; see #5352)
18noblacklist ${HOME}/.mozilla
19whitelist ${HOME}/.mozilla/firefox/profiles.ini
20
21noblacklist ${HOME}/.config/ArmCord
22
23mkdir ${HOME}/.config/ArmCord
24whitelist ${HOME}/.config/ArmCord
25whitelist /opt/armcord
26whitelist /usr/share/armcord
27
28ignore novideo
29private-bin armcord
30
31dbus-user filter
32dbus-user.talk org.freedesktop.Notifications
33# Allow D-Bus communication with Firefox for opening links
34dbus-user.talk org.mozilla.*
35ignore dbus-user none
36
37join-or-start armcord
38
39# Redirect
40include electron-common.profile
diff --git a/etc/profile-a-l/i3.profile b/etc/profile-a-l/i3.profile
index 2268072ef..412e31762 100644
--- a/etc/profile-a-l/i3.profile
+++ b/etc/profile-a-l/i3.profile
@@ -8,6 +8,10 @@ include globals.local
8 8
9# all applications started in i3 will run in this profile 9# all applications started in i3 will run in this profile
10noblacklist ${HOME}/.config/i3 10noblacklist ${HOME}/.config/i3
11noblacklist ${RUNUSER}/i3
12noblacklist ${RUNUSER}/i3/ipc-socket.*
13noblacklist /tmp/i3-*
14noblacklist /tmp/i3-*/ipc-socket.*
11include disable-common.inc 15include disable-common.inc
12 16
13caps.drop all 17caps.drop all
diff --git a/src/fids/main.c b/src/fids/main.c
index 92b6468f3..415694f1e 100644
--- a/src/fids/main.c
+++ b/src/fids/main.c
@@ -106,9 +106,9 @@ static void file_checksum(const char *fname) {
106 } 106 }
107 else { 107 else {
108 content = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); 108 content = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
109 close(fd);
110 mmapped = 1; 109 mmapped = 1;
111 } 110 }
111 close(fd);
112 112
113 unsigned char checksum[KEY_SIZE / 8]; 113 unsigned char checksum[KEY_SIZE / 8];
114 blake2b(checksum, sizeof(checksum), content, size); 114 blake2b(checksum, sizeof(checksum), content, size);
diff --git a/src/firecfg/desktop_files.c b/src/firecfg/desktop_files.c
index 1895e437b..8c21757ab 100644
--- a/src/firecfg/desktop_files.c
+++ b/src/firecfg/desktop_files.c
@@ -300,6 +300,7 @@ void fix_desktop_files(const char *homedir) {
300 300
301 if (stat(outname, &sb) == 0) { 301 if (stat(outname, &sb) == 0) {
302 printf(" %s skipped: file exists\n", filename); 302 printf(" %s skipped: file exists\n", filename);
303 free(outname);
303 if (change_exec) 304 if (change_exec)
304 free(change_exec); 305 free(change_exec);
305 continue; 306 continue;
@@ -308,6 +309,7 @@ void fix_desktop_files(const char *homedir) {
308 FILE *fpin = fopen(filename, "r"); 309 FILE *fpin = fopen(filename, "r");
309 if (!fpin) { 310 if (!fpin) {
310 fprintf(stderr, "Warning: cannot open /usr/share/applications/%s\n", filename); 311 fprintf(stderr, "Warning: cannot open /usr/share/applications/%s\n", filename);
312 free(outname);
311 if (change_exec) 313 if (change_exec)
312 free(change_exec); 314 free(change_exec);
313 continue; 315 continue;
@@ -317,6 +319,7 @@ void fix_desktop_files(const char *homedir) {
317 if (!fpout) { 319 if (!fpout) {
318 fprintf(stderr, "Warning: cannot open ~/.local/share/applications/%s\n", outname); 320 fprintf(stderr, "Warning: cannot open ~/.local/share/applications/%s\n", outname);
319 fclose(fpin); 321 fclose(fpin);
322 free(outname);
320 if (change_exec) 323 if (change_exec)
321 free(change_exec); 324 free(change_exec);
322 continue; 325 continue;
diff --git a/src/firecfg/firecfg.config b/src/firecfg/firecfg.config
index b6eb06d65..8d0a30521 100644
--- a/src/firecfg/firecfg.config
+++ b/src/firecfg/firecfg.config
@@ -63,6 +63,7 @@ arduino
63aria2c 63aria2c
64ark 64ark
65arm 65arm
66armcord
66artha 67artha
67assogiate 68assogiate
68asunder 69asunder
diff --git a/src/firejail/bandwidth.c b/src/firejail/bandwidth.c
index db130afd3..cbfcc90ed 100644
--- a/src/firejail/bandwidth.c
+++ b/src/firejail/bandwidth.c
@@ -198,6 +198,8 @@ static void read_bandwidth_file(pid_t pid) {
198 198
199 fclose(fp); 199 fclose(fp);
200 } 200 }
201
202 free(fname);
201} 203}
202 204
203static void write_bandwidth_file(pid_t pid) { 205static void write_bandwidth_file(pid_t pid) {
@@ -217,6 +219,7 @@ static void write_bandwidth_file(pid_t pid) {
217 ptr = ptr->next; 219 ptr = ptr->next;
218 } 220 }
219 fclose(fp); 221 fclose(fp);
222 free(fname);
220 } 223 }
221 else 224 else
222 goto errout; 225 goto errout;
diff --git a/src/firejail/fs_home.c b/src/firejail/fs_home.c
index 7c3f3835b..9d9832c15 100644
--- a/src/firejail/fs_home.c
+++ b/src/firejail/fs_home.c
@@ -67,8 +67,10 @@ static void skel(const char *homedir) {
67 if (asprintf(&fname, "%s/.zshrc", homedir) == -1) 67 if (asprintf(&fname, "%s/.zshrc", homedir) == -1)
68 errExit("asprintf"); 68 errExit("asprintf");
69 // don't copy it if we already have the file 69 // don't copy it if we already have the file
70 if (access(fname, F_OK) == 0) 70 if (access(fname, F_OK) == 0) {
71 free(fname);
71 return; 72 return;
73 }
72 if (is_link(fname)) { // access(3) on dangling symlinks fails, try again using lstat 74 if (is_link(fname)) { // access(3) on dangling symlinks fails, try again using lstat
73 fprintf(stderr, "Error: invalid %s file\n", fname); 75 fprintf(stderr, "Error: invalid %s file\n", fname);
74 exit(1); 76 exit(1);
@@ -91,8 +93,10 @@ static void skel(const char *homedir) {
91 if (asprintf(&fname, "%s/.cshrc", homedir) == -1) 93 if (asprintf(&fname, "%s/.cshrc", homedir) == -1)
92 errExit("asprintf"); 94 errExit("asprintf");
93 // don't copy it if we already have the file 95 // don't copy it if we already have the file
94 if (access(fname, F_OK) == 0) 96 if (access(fname, F_OK) == 0) {
97 free(fname);
95 return; 98 return;
99 }
96 if (is_link(fname)) { // access(3) on dangling symlinks fails, try again using lstat 100 if (is_link(fname)) { // access(3) on dangling symlinks fails, try again using lstat
97 fprintf(stderr, "Error: invalid %s file\n", fname); 101 fprintf(stderr, "Error: invalid %s file\n", fname);
98 exit(1); 102 exit(1);
@@ -115,8 +119,10 @@ static void skel(const char *homedir) {
115 if (asprintf(&fname, "%s/.bashrc", homedir) == -1) 119 if (asprintf(&fname, "%s/.bashrc", homedir) == -1)
116 errExit("asprintf"); 120 errExit("asprintf");
117 // don't copy it if we already have the file 121 // don't copy it if we already have the file
118 if (access(fname, F_OK) == 0) 122 if (access(fname, F_OK) == 0) {
123 free(fname);
119 return; 124 return;
125 }
120 if (is_link(fname)) { // access(3) on dangling symlinks fails, try again using lstat 126 if (is_link(fname)) { // access(3) on dangling symlinks fails, try again using lstat
121 fprintf(stderr, "Error: invalid %s file\n", fname); 127 fprintf(stderr, "Error: invalid %s file\n", fname);
122 exit(1); 128 exit(1);
diff --git a/src/firejail/ids.c b/src/firejail/ids.c
index 40bbe6d02..0759a205d 100644
--- a/src/firejail/ids.c
+++ b/src/firejail/ids.c
@@ -42,6 +42,7 @@ static void ids_init(void) {
42 if (dup(fd) != STDOUT_FILENO) 42 if (dup(fd) != STDOUT_FILENO)
43 errExit("dup"); 43 errExit("dup");
44 close(fd); 44 close(fd);
45 free(fname);
45 46
46 sbox_run(SBOX_USER | SBOX_CAPS_NONE | SBOX_SECCOMP, 3, PATH_FIDS, "--init", cfg.homedir); 47 sbox_run(SBOX_USER | SBOX_CAPS_NONE | SBOX_SECCOMP, 3, PATH_FIDS, "--init", cfg.homedir);
47} 48}
@@ -63,6 +64,7 @@ static void ids_check(void) {
63 if (dup(fd) != STDIN_FILENO) 64 if (dup(fd) != STDIN_FILENO)
64 errExit("dup"); 65 errExit("dup");
65 close(fd); 66 close(fd);
67 free(fname);
66 68
67 sbox_run(SBOX_USER | SBOX_CAPS_NONE | SBOX_SECCOMP| SBOX_ALLOW_STDIN, 3, PATH_FIDS, "--check", cfg.homedir); 69 sbox_run(SBOX_USER | SBOX_CAPS_NONE | SBOX_SECCOMP| SBOX_ALLOW_STDIN, 3, PATH_FIDS, "--check", cfg.homedir);
68} 70}
diff --git a/src/firejail/run_files.c b/src/firejail/run_files.c
index cb078b580..4bd0ba459 100644
--- a/src/firejail/run_files.c
+++ b/src/firejail/run_files.c
@@ -122,6 +122,7 @@ void set_name_run_file(pid_t pid) {
122 // mode and ownership 122 // mode and ownership
123 SET_PERMS_STREAM(fp, 0, 0, 0644); 123 SET_PERMS_STREAM(fp, 0, 0, 0644);
124 fclose(fp); 124 fclose(fp);
125 free(fname);
125} 126}
126 127
127 128
@@ -141,6 +142,7 @@ void set_x11_run_file(pid_t pid, int display) {
141 // mode and ownership 142 // mode and ownership
142 SET_PERMS_STREAM(fp, 0, 0, 0644); 143 SET_PERMS_STREAM(fp, 0, 0, 0644);
143 fclose(fp); 144 fclose(fp);
145 free(fname);
144} 146}
145 147
146void set_profile_run_file(pid_t pid, const char *fname) { 148void set_profile_run_file(pid_t pid, const char *fname) {
diff --git a/src/firejail/util.c b/src/firejail/util.c
index 323133f8d..5d7c244b1 100644
--- a/src/firejail/util.c
+++ b/src/firejail/util.c
@@ -1392,6 +1392,7 @@ void enter_network_namespace(pid_t pid) {
1392 fprintf(stderr, "Error: the sandbox doesn't use a new network namespace\n"); 1392 fprintf(stderr, "Error: the sandbox doesn't use a new network namespace\n");
1393 exit(1); 1393 exit(1);
1394 } 1394 }
1395 free(name);
1395 1396
1396 // join the namespace 1397 // join the namespace
1397 EUID_ROOT(); 1398 EUID_ROOT();
diff --git a/src/firemon/netstats.c b/src/firemon/netstats.c
index 39dc38ec9..e70174b1e 100644
--- a/src/firemon/netstats.c
+++ b/src/firemon/netstats.c
@@ -152,10 +152,12 @@ static void print_proc(int index, int itv, int col) {
152 struct stat s; 152 struct stat s;
153 if (stat(name, &s) == -1) { 153 if (stat(name, &s) == -1) {
154 // the sandbox doesn't have a --net= option, don't print 154 // the sandbox doesn't have a --net= option, don't print
155 free(name);
155 if (cmd) 156 if (cmd)
156 free(cmd); 157 free(cmd);
157 return; 158 return;
158 } 159 }
160 free(name);
159 161
160 // pid 162 // pid
161 char pidstr[11]; 163 char pidstr[11];
diff --git a/src/jailcheck/access.c b/src/jailcheck/access.c
index 50c51839b..5fbcb5a15 100644
--- a/src/jailcheck/access.c
+++ b/src/jailcheck/access.c
@@ -80,10 +80,13 @@ void access_setup(const char *directory) {
80 FILE *fp = fopen(test_file, "w"); 80 FILE *fp = fopen(test_file, "w");
81 if (!fp) { 81 if (!fp) {
82 printf("Warning: I cannot create test file in directory %s, skipping...\n", directory); 82 printf("Warning: I cannot create test file in directory %s, skipping...\n", directory);
83 free(test_file);
84 free(path);
83 return; 85 return;
84 } 86 }
85 fprintf(fp, "this file was created by firetest utility, you can safely delete it\n"); 87 fprintf(fp, "this file was created by firetest utility, you can safely delete it\n");
86 fclose(fp); 88 fclose(fp);
89 free(path);
87 int rv = chown(test_file, user_uid, user_gid); 90 int rv = chown(test_file, user_uid, user_gid);
88 if (rv) 91 if (rv)
89 errExit("chown"); 92 errExit("chown");
diff --git a/src/jailcheck/noexec.c b/src/jailcheck/noexec.c
index 37234c648..e5657135d 100644
--- a/src/jailcheck/noexec.c
+++ b/src/jailcheck/noexec.c
@@ -55,6 +55,7 @@ void noexec_setup(void) {
55 execfile_len = s.st_size; 55 execfile_len = s.st_size;
56 close(fd); 56 close(fd);
57 } 57 }
58 free(self);
58 } 59 }
59} 60}
60 61
@@ -110,4 +111,5 @@ void noexec_test(const char *path) {
110 wait(&status); 111 wait(&status);
111 int rv = unlink(fname); 112 int rv = unlink(fname);
112 (void) rv; 113 (void) rv;
114 free(fname);
113} 115}
diff --git a/src/jailcheck/virtual.c b/src/jailcheck/virtual.c
index d4bfd1923..348efc784 100644
--- a/src/jailcheck/virtual.c
+++ b/src/jailcheck/virtual.c
@@ -49,6 +49,7 @@ void virtual_setup(const char *directory) {
49 FILE *fp = fopen(test_file, "w"); 49 FILE *fp = fopen(test_file, "w");
50 if (!fp) { 50 if (!fp) {
51 printf("Warning: I cannot create test file in directory %s, skipping...\n", directory); 51 printf("Warning: I cannot create test file in directory %s, skipping...\n", directory);
52 free(test_file);
52 return; 53 return;
53 } 54 }
54 fprintf(fp, "this file was created by firetest utility, you can safely delete it\n"); 55 fprintf(fp, "this file was created by firetest utility, you can safely delete it\n");
diff --git a/src/man/firejail.1.in b/src/man/firejail.1.in
index 87bd6fcc2..fa2329d67 100644
--- a/src/man/firejail.1.in
+++ b/src/man/firejail.1.in
@@ -95,7 +95,12 @@ $ firejail [OPTIONS] # starting the program specified in $SHELL,
95$ firejail [OPTIONS] firefox # starting Mozilla Firefox 95$ firejail [OPTIONS] firefox # starting Mozilla Firefox
96.PP 96.PP
97# sudo firejail [OPTIONS] /etc/init.d/nginx start 97# sudo firejail [OPTIONS] /etc/init.d/nginx start
98 98.PP
99When an option is specified multiple times (whether in a profile, on the
100command line, or both) or conflicts with a related option, the
101precedence/behavior is option-specific and usually documented in the
102\fBOPTIONS\fR section below. Note that an option specified in a profile can
103generally be disabled on the command line using \fB--ignore\fR.
99.SH OPTIONS 104.SH OPTIONS
100.TP 105.TP
101\fB\-\- 106\fB\-\-
@@ -1729,6 +1734,16 @@ See --keep-config-pulse.
1729Disable blacklist for this directory or file. 1734Disable blacklist for this directory or file.
1730.br 1735.br
1731 1736
1737Note that blacklist entries containing ${PATH} can not currently be partially
1738disabled for individual expanded paths. Only the whole unexpanded path
1739including ${PATH} can be disabled, which then applies to all expansions.
1740This limitation does not apply to expansions of other variables or wildcards.
1741For details, see
1742.UR https://github.com/netblue30/firejail/issues/6360
1743#6360
1744.UE
1745.br
1746
1732.br 1747.br
1733Example: 1748Example:
1734.br 1749.br
@@ -1744,6 +1759,14 @@ $ exit
1744.br 1759.br
1745$ firejail --noblacklist=/bin/nc 1760$ firejail --noblacklist=/bin/nc
1746.br 1761.br
1762bash: /bin/nc: Permission denied
1763.br
1764$ exit
1765.br
1766
1767.br
1768$ firejail --noblacklist='${PATH}/nc'
1769.br
1747$ nc dict.org 2628 1770$ nc dict.org 2628
1748.br 1771.br
1749220 pan.alephnull.com dictd 1.12.1/rf on Linux 3.14-1-amd64 1772220 pan.alephnull.com dictd 1.12.1/rf on Linux 3.14-1-amd64
diff --git a/src/profstats/main.c b/src/profstats/main.c
index ad27bfe79..10eee3c4b 100644
--- a/src/profstats/main.c
+++ b/src/profstats/main.c
@@ -344,7 +344,7 @@ int main(int argc, char **argv) {
344 if (cnt_seccomp > (seccomp + 1)) 344 if (cnt_seccomp > (seccomp + 1))
345 cnt_seccomp = seccomp + 1; 345 cnt_seccomp = seccomp + 1;
346 if (cnt_restrict_namespaces > (restrict_namespaces + 1)) 346 if (cnt_restrict_namespaces > (restrict_namespaces + 1))
347 cnt_seccomp = restrict_namespaces + 1; 347 cnt_restrict_namespaces = restrict_namespaces + 1;
348 if (cnt_dbus_user_none > (dbususernone + 1)) 348 if (cnt_dbus_user_none > (dbususernone + 1))
349 cnt_dbus_user_none = dbususernone + 1; 349 cnt_dbus_user_none = dbususernone + 1;
350 if (cnt_dbus_user_filter > (dbususerfilter + 1)) 350 if (cnt_dbus_user_filter > (dbususerfilter + 1))