diff options
-rw-r--r-- | src/firejail/firejail.h | 2 | ||||
-rw-r--r-- | src/firejail/fs_dev.c | 22 | ||||
-rw-r--r-- | src/firejail/main.c | 3 | ||||
-rw-r--r-- | src/firejail/profile.c | 4 | ||||
-rw-r--r-- | src/firejail/sandbox.c | 7 | ||||
-rw-r--r-- | src/man/firejail-profile.txt | 3 | ||||
-rw-r--r-- | src/man/firejail.txt | 9 |
7 files changed, 46 insertions, 4 deletions
diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h index bb16ea42b..b19aded44 100644 --- a/src/firejail/firejail.h +++ b/src/firejail/firejail.h | |||
@@ -361,6 +361,7 @@ extern int arg_disable_mnt; // disable /mnt and /media | |||
361 | extern int arg_noprofile; // use default.profile if none other found/specified | 361 | extern int arg_noprofile; // use default.profile if none other found/specified |
362 | extern int arg_memory_deny_write_execute; // block writable and executable memory | 362 | extern int arg_memory_deny_write_execute; // block writable and executable memory |
363 | extern int arg_notv; // --notv | 363 | extern int arg_notv; // --notv |
364 | extern int arg_nodvd; // --nodvd | ||
364 | 365 | ||
365 | extern int login_shell; | 366 | extern int login_shell; |
366 | extern int parent_to_child_fds[2]; | 367 | extern int parent_to_child_fds[2]; |
@@ -514,6 +515,7 @@ void fs_dev_disable_sound(void); | |||
514 | void fs_dev_disable_3d(void); | 515 | void fs_dev_disable_3d(void); |
515 | void fs_dev_disable_video(void); | 516 | void fs_dev_disable_video(void); |
516 | void fs_dev_disable_tv(void); | 517 | void fs_dev_disable_tv(void); |
518 | void fs_dev_disable_dvd(void); | ||
517 | 519 | ||
518 | // fs_home.c | 520 | // fs_home.c |
519 | // private mode (--private) | 521 | // private mode (--private) |
diff --git a/src/firejail/fs_dev.c b/src/firejail/fs_dev.c index d94a6de5a..0dbbb65a0 100644 --- a/src/firejail/fs_dev.c +++ b/src/firejail/fs_dev.c | |||
@@ -38,6 +38,7 @@ typedef enum { | |||
38 | DEV_3D, | 38 | DEV_3D, |
39 | DEV_VIDEO, | 39 | DEV_VIDEO, |
40 | DEV_TV, | 40 | DEV_TV, |
41 | DEV_DVD, | ||
41 | } DEV_TYPE; | 42 | } DEV_TYPE; |
42 | 43 | ||
43 | 44 | ||
@@ -74,6 +75,7 @@ static DevEntry dev[] = { | |||
74 | {"/dev/video8", RUN_DEV_DIR "/video8", DEV_VIDEO}, | 75 | {"/dev/video8", RUN_DEV_DIR "/video8", DEV_VIDEO}, |
75 | {"/dev/video9", RUN_DEV_DIR "/video9", DEV_VIDEO}, | 76 | {"/dev/video9", RUN_DEV_DIR "/video9", DEV_VIDEO}, |
76 | {"/dev/dvb", RUN_DEV_DIR "/dvb", DEV_TV}, // DVB (Digital Video Broadcasting) - TV device | 77 | {"/dev/dvb", RUN_DEV_DIR "/dvb", DEV_TV}, // DVB (Digital Video Broadcasting) - TV device |
78 | {"/dev/sr0", RUN_DEV_DIR "/sr0", DEV_DVD}, // for DVD and audio CD players | ||
77 | {NULL, NULL, DEV_NONE} | 79 | {NULL, NULL, DEV_NONE} |
78 | }; | 80 | }; |
79 | 81 | ||
@@ -87,7 +89,8 @@ static void deventry_mount(void) { | |||
87 | if ((dev[i].type == DEV_SOUND && arg_nosound == 0) || | 89 | if ((dev[i].type == DEV_SOUND && arg_nosound == 0) || |
88 | (dev[i].type == DEV_3D && arg_no3d == 0) || | 90 | (dev[i].type == DEV_3D && arg_no3d == 0) || |
89 | (dev[i].type == DEV_VIDEO && arg_novideo == 0) || | 91 | (dev[i].type == DEV_VIDEO && arg_novideo == 0) || |
90 | (dev[i].type == DEV_TV && arg_notv == 0)) { | 92 | (dev[i].type == DEV_TV && arg_notv == 0) || |
93 | (dev[i].type == DEV_DVD && arg_nodvd == 0)) { | ||
91 | 94 | ||
92 | int dir = is_dir(dev[i].run_fname); | 95 | int dir = is_dir(dev[i].run_fname); |
93 | if (arg_debug) | 96 | if (arg_debug) |
@@ -251,6 +254,14 @@ void fs_private_dev(void){ | |||
251 | create_link("/proc/self/fd/1", "/dev/stdout"); | 254 | create_link("/proc/self/fd/1", "/dev/stdout"); |
252 | create_link("/proc/self/fd/2", "/dev/stderr"); | 255 | create_link("/proc/self/fd/2", "/dev/stderr"); |
253 | #endif | 256 | #endif |
257 | |||
258 | // symlinks for DVD/CD players | ||
259 | if (stat("/dev/sr0", &s) == 0) { | ||
260 | create_link("/dev/sr0", "/dev/cdrom"); | ||
261 | create_link("/dev/sr0", "/dev/cdrw"); | ||
262 | create_link("/dev/sr0", "/dev/dvd"); | ||
263 | create_link("/dev/sr0", "/dev/dvdrw"); | ||
264 | } | ||
254 | } | 265 | } |
255 | 266 | ||
256 | 267 | ||
@@ -343,3 +354,12 @@ void fs_dev_disable_tv(void) { | |||
343 | i++; | 354 | i++; |
344 | } | 355 | } |
345 | } | 356 | } |
357 | |||
358 | void fs_dev_disable_dvd(void) { | ||
359 | int i = 0; | ||
360 | while (dev[i].dev_fname != NULL) { | ||
361 | if (dev[i].type == DEV_DVD) | ||
362 | disable_file_or_dir(dev[i].dev_fname); | ||
363 | i++; | ||
364 | } | ||
365 | } | ||
diff --git a/src/firejail/main.c b/src/firejail/main.c index 3718c82ff..31857ee57 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -113,6 +113,7 @@ int arg_disable_mnt = 0; // disable /mnt and /media | |||
113 | int arg_noprofile = 0; // use default.profile if none other found/specified | 113 | int arg_noprofile = 0; // use default.profile if none other found/specified |
114 | int arg_memory_deny_write_execute = 0; // block writable and executable memory | 114 | int arg_memory_deny_write_execute = 0; // block writable and executable memory |
115 | int arg_notv = 0; // --notv | 115 | int arg_notv = 0; // --notv |
116 | int arg_nodvd = 0; // --nodvd | ||
116 | int login_shell = 0; | 117 | int login_shell = 0; |
117 | 118 | ||
118 | 119 | ||
@@ -1690,6 +1691,8 @@ int main(int argc, char **argv) { | |||
1690 | arg_no3d = 1; | 1691 | arg_no3d = 1; |
1691 | else if (strcmp(argv[i], "--notv") == 0) | 1692 | else if (strcmp(argv[i], "--notv") == 0) |
1692 | arg_notv = 1; | 1693 | arg_notv = 1; |
1694 | else if (strcmp(argv[i], "--nodvd") == 0) | ||
1695 | arg_nodvd = 1; | ||
1693 | 1696 | ||
1694 | //************************************* | 1697 | //************************************* |
1695 | // network | 1698 | // network |
diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 54670483f..7753ee3b2 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c | |||
@@ -229,6 +229,10 @@ int profile_check_line(char *ptr, int lineno, const char *fname) { | |||
229 | arg_notv = 1; | 229 | arg_notv = 1; |
230 | return 0; | 230 | return 0; |
231 | } | 231 | } |
232 | else if (strcmp(ptr, "nodvd") == 0) { | ||
233 | arg_nodvd = 1; | ||
234 | return 0; | ||
235 | } | ||
232 | else if (strcmp(ptr, "novideo") == 0) { | 236 | else if (strcmp(ptr, "novideo") == 0) { |
233 | arg_novideo = 1; | 237 | arg_novideo = 1; |
234 | return 0; | 238 | return 0; |
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index 4af8b747b..472f09355 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c | |||
@@ -894,10 +894,11 @@ int sandbox(void* sandbox_arg) { | |||
894 | if (arg_notv) | 894 | if (arg_notv) |
895 | fs_dev_disable_tv(); | 895 | fs_dev_disable_tv(); |
896 | 896 | ||
897 | if (arg_novideo) { | 897 | if (arg_nodvd) |
898 | // disable /dev/video* | 898 | fs_dev_disable_dvd(); |
899 | |||
900 | if (arg_novideo) | ||
899 | fs_dev_disable_video(); | 901 | fs_dev_disable_video(); |
900 | } | ||
901 | 902 | ||
902 | //**************************** | 903 | //**************************** |
903 | // install trace | 904 | // install trace |
diff --git a/src/man/firejail-profile.txt b/src/man/firejail-profile.txt index 489e70c95..5bd4f6ef8 100644 --- a/src/man/firejail-profile.txt +++ b/src/man/firejail-profile.txt | |||
@@ -411,6 +411,9 @@ env LD_LIBRARY_PATH=/opt/test/lib | |||
411 | env CFLAGS="-W -Wall -Werror" | 411 | env CFLAGS="-W -Wall -Werror" |
412 | 412 | ||
413 | .TP | 413 | .TP |
414 | \fBnodvd | ||
415 | Disable DVD and audio CD devices. | ||
416 | .TP | ||
414 | \fBnogroups | 417 | \fBnogroups |
415 | Disable supplementary user groups | 418 | Disable supplementary user groups |
416 | .TP | 419 | .TP |
diff --git a/src/man/firejail.txt b/src/man/firejail.txt index ddcaa1412..e7b427e7e 100644 --- a/src/man/firejail.txt +++ b/src/man/firejail.txt | |||
@@ -974,6 +974,15 @@ $ nc dict.org 2628 | |||
974 | 220 pan.alephnull.com dictd 1.12.1/rf on Linux 3.14-1-amd64 | 974 | 220 pan.alephnull.com dictd 1.12.1/rf on Linux 3.14-1-amd64 |
975 | .br | 975 | .br |
976 | .TP | 976 | .TP |
977 | \fB\-\-nodvd | ||
978 | Disable DVD and audio CD devices. | ||
979 | .br | ||
980 | |||
981 | .br | ||
982 | Example: | ||
983 | .br | ||
984 | $ firejail \-\-nodvd | ||
985 | .TP | ||
977 | \fB\-\-noexec=dirname_or_filename | 986 | \fB\-\-noexec=dirname_or_filename |
978 | Remount directory or file noexec, nodev and nosuid. | 987 | Remount directory or file noexec, nodev and nosuid. |
979 | .br | 988 | .br |