summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README1
-rw-r--r--README.md2
-rw-r--r--RELNOTES4
-rw-r--r--etc/disable-programs.inc2
-rw-r--r--etc/qmmp.profile34
-rw-r--r--etc/sayonara.profile33
-rw-r--r--src/firejail/fs.c57
-rw-r--r--src/firejail/pulseaudio.c8
-rw-r--r--src/firejail/x11.c9
-rw-r--r--src/firemon/procevent.c44
10 files changed, 157 insertions, 37 deletions
diff --git a/README b/README
index 7384a8c99..368feb827 100644
--- a/README
+++ b/README
@@ -435,6 +435,7 @@ Pixel Fairy (https://github.com/xahare)
435PizzaDude (https://github.com/pizzadude) 435PizzaDude (https://github.com/pizzadude)
436 - add mpv support to smplayer 436 - add mpv support to smplayer
437 - added profile for torbrowser-launcher 437 - added profile for torbrowser-launcher
438 - added profile for sayonara and qmmp
438probonopd (https://github.com/probonopd) 439probonopd (https://github.com/probonopd)
439 - automatic build on Travis CI 440 - automatic build on Travis CI
440pshpsh (https://github.com/pshpsh) 441pshpsh (https://github.com/pshpsh)
diff --git a/README.md b/README.md
index cb040852a..854e02cd1 100644
--- a/README.md
+++ b/README.md
@@ -376,4 +376,4 @@ gnome-recipes, akonadi_control, evince-previewer, evince-thumbnailer, blender-2.
376thunderbird-beta, ncdu, gnome-logs, gcloud, musixmatch, gunzip, bunzip2, enchant, 376thunderbird-beta, ncdu, gnome-logs, gcloud, musixmatch, gunzip, bunzip2, enchant,
377enchant-2, enchant-lsmod, enchant-lsmod-2, Discord, acat, adiff, als, apack, arepack, 377enchant-2, enchant-lsmod, enchant-lsmod-2, Discord, acat, adiff, als, apack, arepack,
378aunpack profiles, ppsspp, scallion, clion, baloo_filemetadata_temp_extractor, 378aunpack profiles, ppsspp, scallion, clion, baloo_filemetadata_temp_extractor,
379AnyDesk, webstorm, xmind 379AnyDesk, webstorm, xmind, qmmp, sayonara
diff --git a/RELNOTES b/RELNOTES
index 4945e3d3c..f73793740 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -34,6 +34,7 @@ firejail (0.9.54~rc1) baseline; urgency=low
34 * private-dev support for overlay and chroot sandboxes 34 * private-dev support for overlay and chroot sandboxes
35 * private-tmp support for overlay and chroot sandboxes 35 * private-tmp support for overlay and chroot sandboxes
36 * added sandbox name support in firemon 36 * added sandbox name support in firemon
37 * firemon/prctl enhancements
37 * new profiles: basilisk, Tor Browser language packs, PlayOnLinux, sylpheed, 38 * new profiles: basilisk, Tor Browser language packs, PlayOnLinux, sylpheed,
38 * new profiles: discord-canary, pycharm-community, pycharm-professional, 39 * new profiles: discord-canary, pycharm-community, pycharm-professional,
39 * new profiles: pdfchain, tilp, vivaldi-snapshot, bitcoin-qt, kaffeine, 40 * new profiles: pdfchain, tilp, vivaldi-snapshot, bitcoin-qt, kaffeine,
@@ -43,7 +44,8 @@ firejail (0.9.54~rc1) baseline; urgency=low
43 * new profiles: musixmatch, gunzip, bunzip2, enchant-lsmod, enchant-lsmod-2, 44 * new profiles: musixmatch, gunzip, bunzip2, enchant-lsmod, enchant-lsmod-2,
44 * new profiles: enchant, enchant-2, Discord, acat, adiff, als, apack, 45 * new profiles: enchant, enchant-2, Discord, acat, adiff, als, apack,
45 * new profiles: arepack, aunpack profiles, ppsspp, scallion, clion, 46 * new profiles: arepack, aunpack profiles, ppsspp, scallion, clion,
46 * new profiles: baloo_filemetadata_temp_extractor, AnyDesk, webstorm, xmind 47 * new profiles: baloo_filemetadata_temp_extractor, AnyDesk, webstorm, xmind,
48 * new profiles: qmmp, sayonara
47 -- netblue30 <netblue30@yahoo.com> Sun, 6 May 2018 08:00:00 -0500 49 -- netblue30 <netblue30@yahoo.com> Sun, 6 May 2018 08:00:00 -0500
48 50
49firejail (0.9.52) baseline; urgency=low 51firejail (0.9.52) baseline; urgency=low
diff --git a/etc/disable-programs.inc b/etc/disable-programs.inc
index ea334c289..c7605d660 100644
--- a/etc/disable-programs.inc
+++ b/etc/disable-programs.inc
@@ -16,6 +16,7 @@ blacklist ${HOME}/.LuminanceHDR
16blacklist ${HOME}/.Mathematica 16blacklist ${HOME}/.Mathematica
17blacklist ${HOME}/.Natron 17blacklist ${HOME}/.Natron
18blacklist ${HOME}/.PyCharm* 18blacklist ${HOME}/.PyCharm*
19blacklist ${HOME}/.Sayonara
19blacklist ${HOME}/.Skype 20blacklist ${HOME}/.Skype
20blacklist ${HOME}/.Steam 21blacklist ${HOME}/.Steam
21blacklist ${HOME}/.Steampath 22blacklist ${HOME}/.Steampath
@@ -465,6 +466,7 @@ blacklist ${HOME}/.passwd-s3fs
465blacklist ${HOME}/.pingus 466blacklist ${HOME}/.pingus
466blacklist ${HOME}/.purple 467blacklist ${HOME}/.purple
467blacklist ${HOME}/.qemu-launcher 468blacklist ${HOME}/.qemu-launcher
469blacklist ${HOME}/.qmmp
468blacklist ${HOME}/.redeclipse 470blacklist ${HOME}/.redeclipse
469blacklist ${HOME}/.remmina 471blacklist ${HOME}/.remmina
470blacklist ${HOME}/.repo_.gitconfig.json 472blacklist ${HOME}/.repo_.gitconfig.json
diff --git a/etc/qmmp.profile b/etc/qmmp.profile
new file mode 100644
index 000000000..d785ddbbe
--- /dev/null
+++ b/etc/qmmp.profile
@@ -0,0 +1,34 @@
1# Firejail profile for qmmp
2# This file is overwritten after every install/update
3# Persistent local customizations
4include /etc/firejail/qmmp.local
5# Persistent global definitions
6include /etc/firejail/globals.local
7
8noblacklist ${HOME}/.qmmp
9
10include /etc/firejail/disable-common.inc
11include /etc/firejail/disable-devel.inc
12include /etc/firejail/disable-passwdmgr.inc
13include /etc/firejail/disable-programs.inc
14
15caps.drop all
16netfilter
17# no3d
18nodbus
19nogroups
20nonewprivs
21noroot
22notv
23novideo
24protocol unix,inet,inet6
25seccomp
26shell none
27tracelog
28
29private-bin qmmp
30private-dev
31private-tmp
32
33noexec ${HOME}
34noexec /tmp
diff --git a/etc/sayonara.profile b/etc/sayonara.profile
new file mode 100644
index 000000000..756bd99eb
--- /dev/null
+++ b/etc/sayonara.profile
@@ -0,0 +1,33 @@
1# Firejail profile for sayonara player
2# This file is overwritten after every install/update
3# Persistent local customizations
4include /etc/firejail/sayonara.local
5# Persistent global definitions
6include /etc/firejail/globals.local
7
8noblacklist ${HOME}/.Sayonara
9
10include /etc/firejail/disable-common.inc
11include /etc/firejail/disable-devel.inc
12include /etc/firejail/disable-passwdmgr.inc
13include /etc/firejail/disable-programs.inc
14
15caps.drop all
16netfilter
17no3d
18nogroups
19nonewprivs
20noroot
21notv
22novideo
23protocol unix,inet,inet6
24seccomp
25shell none
26tracelog
27
28private-bin sayonara
29private-dev
30private-tmp
31
32noexec ${HOME}
33noexec /tmp
diff --git a/src/firejail/fs.c b/src/firejail/fs.c
index 88f92ad74..f3ed67928 100644
--- a/src/firejail/fs.c
+++ b/src/firejail/fs.c
@@ -484,29 +484,44 @@ void fs_rdonly(const char *dir) {
484 484
485static void fs_rdwr(const char *dir) { 485static void fs_rdwr(const char *dir) {
486 assert(dir); 486 assert(dir);
487 // check directory exists 487 // check directory exists and ensure we have a resolved path
488 // the resolved path allows to run a sanity check after the mount
489 char *path = realpath(dir, NULL);
490 if (path == NULL)
491 return;
492 // allow only user owned directories, except the user is root
493 uid_t u = getuid();
488 struct stat s; 494 struct stat s;
489 int rv = stat(dir, &s); 495 int rv = stat(path, &s);
490 if (rv == 0) { 496 if (rv) {
491 // if the file is outside /home directory, allow only root user 497 free(path);
492 uid_t u = getuid(); 498 return;
493 if (u != 0 && s.st_uid != u) { 499 }
494 fwarning("you are not allowed to change %s to read-write\n", dir); 500 if (u != 0 && s.st_uid != u) {
495 return; 501 fwarning("you are not allowed to change %s to read-write\n", path);
496 } 502 free(path);
497 503 return;
498 // mount --bind /bin /bin 504 }
499 // mount --bind -o remount,rw /bin 505 // mount --bind /bin /bin
500 unsigned long flags = 0; 506 // mount --bind -o remount,rw /bin
501 get_mount_flags(dir, &flags); 507 unsigned long flags = 0;
502 if ((flags & MS_RDONLY) == 0) 508 get_mount_flags(path, &flags);
503 return; 509 if ((flags & MS_RDONLY) == 0) {
504 flags &= ~MS_RDONLY; 510 free(path);
505 if (mount(dir, dir, NULL, MS_BIND|MS_REC, NULL) < 0 || 511 return;
506 mount(NULL, dir, NULL, flags|MS_BIND|MS_REMOUNT|MS_REC, NULL) < 0)
507 errExit("mount read-write");
508 fs_logger2("read-write", dir);
509 } 512 }
513 flags &= ~MS_RDONLY;
514 if (mount(path, path, NULL, MS_BIND|MS_REC, NULL) < 0 ||
515 mount(NULL, path, NULL, flags|MS_BIND|MS_REMOUNT|MS_REC, NULL) < 0)
516 errExit("mount read-write");
517 fs_logger2("read-write", path);
518
519 // run a check on /proc/self/mountinfo to validate the mount
520 MountData *mptr = get_last_mount();
521 if (strncmp(mptr->dir, path, strlen(path)) != 0)
522 errLogExit("invalid read-write mount");
523
524 free(path);
510} 525}
511 526
512void fs_noexec(const char *dir) { 527void fs_noexec(const char *dir) {
diff --git a/src/firejail/pulseaudio.c b/src/firejail/pulseaudio.c
index eaaba86c0..15d44e4cc 100644
--- a/src/firejail/pulseaudio.c
+++ b/src/firejail/pulseaudio.c
@@ -178,10 +178,10 @@ void pulseaudio_init(void) {
178 178
179 // check /proc/self/mountinfo to confirm the mount is ok 179 // check /proc/self/mountinfo to confirm the mount is ok
180 MountData *mptr = get_last_mount(); 180 MountData *mptr = get_last_mount();
181 if (strncmp(mptr->dir, homeusercfg, strlen(homeusercfg)) != 0) 181 if (strcmp(mptr->dir, homeusercfg) != 0)
182 errLogExit("invalid mount on top of %s (should be %s)\n", mptr->dir, homeusercfg); 182 errLogExit("invalid pulseaudio mount");
183 if (strncmp(mptr->fstype, "tmpfs", 5) != 0) 183 if (strcmp(mptr->fstype, "tmpfs") != 0)
184 errLogExit("invalid mount on top of %s (filesystem type is %s)\n", mptr->dir, mptr->fstype); 184 errLogExit("invalid pulseaudio mount");
185 185
186 char *p; 186 char *p;
187 if (asprintf(&p, "%s/client.conf", homeusercfg) == -1) 187 if (asprintf(&p, "%s/client.conf", homeusercfg) == -1)
diff --git a/src/firejail/x11.c b/src/firejail/x11.c
index 0eace3215..ec8775370 100644
--- a/src/firejail/x11.c
+++ b/src/firejail/x11.c
@@ -1196,10 +1196,11 @@ void x11_xorg(void) {
1196 1196
1197 // check /proc/self/mountinfo to confirm the mount is ok 1197 // check /proc/self/mountinfo to confirm the mount is ok
1198 MountData *mptr = get_last_mount(); 1198 MountData *mptr = get_last_mount();
1199 if (strncmp(mptr->dir, dest, strlen(dest)) != 0) 1199 if (strcmp(mptr->dir, dest) != 0)
1200 errLogExit("invalid mount on top of %s (should be %s)\n", mptr->dir, dest); 1200 errLogExit("invalid .Xauthority mount");
1201 if (strncmp(mptr->fstype, "tmpfs", 5) != 0) 1201 if (strcmp(mptr->fstype, "tmpfs") != 0)
1202 errLogExit("invalid mount on top of %s (filesystem type is %s)\n", mptr->dir, mptr->fstype); 1202 errLogExit("invalid .Xauthority mount");
1203
1203 free(dest); 1204 free(dest);
1204#endif 1205#endif
1205} 1206}
diff --git a/src/firemon/procevent.c b/src/firemon/procevent.c
index 301e5397b..5b16191be 100644
--- a/src/firemon/procevent.c
+++ b/src/firemon/procevent.c
@@ -94,10 +94,21 @@ static int pid_is_firejail(pid_t pid) {
94 // list of firejail arguments that don't trigger sandbox creation 94 // list of firejail arguments that don't trigger sandbox creation
95 // the initial -- is not included 95 // the initial -- is not included
96 char *exclude_args[] = { 96 char *exclude_args[] = {
97 "ls", "list", "tree", "x11", "help", "version", "top", "netstats", "debug-syscalls", 97 // all print options
98 "debug-errnos", "debug-protocols", "protocol.print", "debug.caps", 98 "apparmor.print", "caps.print", "cpu.print", "dns.print", "fs.print", "netfilter.print",
99 "shutdown", "bandwidth", "caps.print", "cpu.print", "debug-caps", 99 "netfilter6.print", "profile.print", "protocol.print", "seccomp.print",
100 "fs.print", "get", "overlay-clean", NULL 100 // debug
101 "debug-caps", "debug-errnos", "debug-protocols", "debug-syscalls",
102 // file transfer
103 "ls", "get", "put",
104 // stats
105 "tree", "list", "top",
106 // network
107 "netstats", "bandwidth",
108 // etc
109 "help", "version", "overlay-clean",
110
111 NULL // end of list marker
101 }; 112 };
102 113
103 int i; 114 int i;
@@ -291,6 +302,7 @@ static int procevent_monitor(const int sock, pid_t mypid) {
291 child %= max_pids; 302 child %= max_pids;
292 pids[child].level = pids[pid].level + 1; 303 pids[child].level = pids[pid].level + 1;
293 pids[child].uid = pid_get_uid(child); 304 pids[child].uid = pid_get_uid(child);
305 pids[child].parent = pid;
294 } 306 }
295 sprintf(lineptr, " fork"); 307 sprintf(lineptr, " fork");
296 break; 308 break;
@@ -318,12 +330,22 @@ static int procevent_monitor(const int sock, pid_t mypid) {
318 sprintf(lineptr, " exit"); 330 sprintf(lineptr, " exit");
319 break; 331 break;
320 332
333
334
321 case PROC_EVENT_UID: 335 case PROC_EVENT_UID:
322 pid = proc_ev->event_data.id.process_tgid; 336 pid = proc_ev->event_data.id.process_tgid;
323#ifdef DEBUG_PRCTL 337#ifdef DEBUG_PRCTL
324 printf("%s: %d, event uid, pid %d\n", __FUNCTION__, __LINE__, pid); 338 printf("%s: %d, event uid, pid %d\n", __FUNCTION__, __LINE__, pid);
325#endif 339#endif
326 sprintf(lineptr, " uid "); 340 if (pids[pid].level == 1 ||
341 pids[pids[pid].parent].level == 1) {
342 sprintf(lineptr, "\n");
343 continue;
344 }
345 else
346 sprintf(lineptr, " uid (%d:%d)",
347 proc_ev->event_data.id.r.ruid,
348 proc_ev->event_data.id.e.euid);
327 break; 349 break;
328 350
329 case PROC_EVENT_GID: 351 case PROC_EVENT_GID:
@@ -331,9 +353,19 @@ static int procevent_monitor(const int sock, pid_t mypid) {
331#ifdef DEBUG_PRCTL 353#ifdef DEBUG_PRCTL
332 printf("%s: %d, event gid, pid %d\n", __FUNCTION__, __LINE__, pid); 354 printf("%s: %d, event gid, pid %d\n", __FUNCTION__, __LINE__, pid);
333#endif 355#endif
334 sprintf(lineptr, " gid "); 356 if (pids[pid].level == 1 ||
357 pids[pids[pid].parent].level == 1) {
358 sprintf(lineptr, "\n");
359 continue;
360 }
361 else
362 sprintf(lineptr, " gid (%d:%d)",
363 proc_ev->event_data.id.r.rgid,
364 proc_ev->event_data.id.e.egid);
335 break; 365 break;
336 366
367
368
337 case PROC_EVENT_SID: 369 case PROC_EVENT_SID:
338 pid = proc_ev->event_data.sid.process_tgid; 370 pid = proc_ev->event_data.sid.process_tgid;
339#ifdef DEBUG_PRCTL 371#ifdef DEBUG_PRCTL