aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/firejail/firejail.h2
-rw-r--r--src/firejail/profile.c21
-rw-r--r--src/man/firejail-profile.txt17
-rwxr-xr-xtest/ignore.exp9
4 files changed, 45 insertions, 4 deletions
diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h
index 74958487c..ab2fedbd8 100644
--- a/src/firejail/firejail.h
+++ b/src/firejail/firejail.h
@@ -81,7 +81,7 @@ typedef struct config_t {
81 81
82 // filesystem 82 // filesystem
83 ProfileEntry *profile; 83 ProfileEntry *profile;
84#define MAX_PROFILE_IGNORE 16 84#define MAX_PROFILE_IGNORE 32
85 char *profile_ignore[MAX_PROFILE_IGNORE]; 85 char *profile_ignore[MAX_PROFILE_IGNORE];
86 char *chrootdir; // chroot directory 86 char *chrootdir; // chroot directory
87 char *home_private; // private home directory 87 char *home_private; // private home directory
diff --git a/src/firejail/profile.c b/src/firejail/profile.c
index 1195dd14d..3edeabee9 100644
--- a/src/firejail/profile.c
+++ b/src/firejail/profile.c
@@ -75,6 +75,27 @@ int profile_check_line(char *ptr, int lineno) {
75 if (strncmp(ptr, cfg.profile_ignore[i], strlen(cfg.profile_ignore[i])) == 0) 75 if (strncmp(ptr, cfg.profile_ignore[i], strlen(cfg.profile_ignore[i])) == 0)
76 return 0; // ignore line 76 return 0; // ignore line
77 } 77 }
78
79 if (strncmp(ptr, "ignore ", 7) == 0) {
80 char *str = strdup(ptr + 7);
81 if (*str == '\0') {
82 fprintf(stderr, "Error: invalid ignore option\n");
83 exit(1);
84 }
85 // find an empty entry in profile_ignore array
86 int j;
87 for (j = 0; j < MAX_PROFILE_IGNORE; j++) {
88 if (cfg.profile_ignore[j] == NULL)
89 break;
90 }
91 if (j >= MAX_PROFILE_IGNORE) {
92 fprintf(stderr, "Error: maximum %d --ignore options are permitted\n", MAX_PROFILE_IGNORE);
93 exit(1);
94 }
95 // ... and configure it
96 cfg.profile_ignore[j] = str;
97 return 0;
98 }
78 99
79 // seccomp, caps, private, user namespace 100 // seccomp, caps, private, user namespace
80 if (strcmp(ptr, "noroot") == 0) { 101 if (strcmp(ptr, "noroot") == 0) {
diff --git a/src/man/firejail-profile.txt b/src/man/firejail-profile.txt
index 1369fdc91..02a54e685 100644
--- a/src/man/firejail-profile.txt
+++ b/src/man/firejail-profile.txt
@@ -64,7 +64,10 @@ Child process initialized
64.RE 64.RE
65 65
66.SH Scripting 66.SH Scripting
67Include and comment support: 67Scripting commands:
68
69.TP
70# this is a comment
68 71
69.TP 72.TP
70\f\include other.profile exclude-token 73\f\include other.profile exclude-token
@@ -83,13 +86,21 @@ Example: "include ${HOME}/myprofiles/profile1" will load "~/myprofiles/profile1"
83Note: exclude-token is deprecated, use noblacklist command instead. 86Note: exclude-token is deprecated, use noblacklist command instead.
84 87
85.TP 88.TP
86# this is a comment 89\f\noblacklist file_name
90If the file name matches file_name, the file will not be blacklisted in any blacklist commands that follow.
91
92Example: "noblacklist ${HOME}/.mozilla"
93
94.TP
95\f\ignore command
96Ignore command.
97
98Example: "ignore seccomp"
87 99
88.SH Filesystem 100.SH Filesystem
89These profile entries define a chroot filesystem built on top of the existing 101These profile entries define a chroot filesystem built on top of the existing
90host filesystem. Each line describes a file element that is removed from 102host filesystem. Each line describes a file element that is removed from
91the filesystem (\fBblacklist\fR), a read-only file or directory (\fBread-only\fR), 103the filesystem (\fBblacklist\fR), a read-only file or directory (\fBread-only\fR),
92a filter for finer control of blacklisting (\fBnoblacklist\fR),
93a tmpfs mounted on top of an existing directory (\fBtmpfs\fR), 104a tmpfs mounted on top of an existing directory (\fBtmpfs\fR),
94or mount-bind a directory or file on top of another directory or file (\fBbind\fR). 105or mount-bind a directory or file on top of another directory or file (\fBbind\fR).
95Use \fBprivate\fR to set private mode. 106Use \fBprivate\fR to set private mode.
diff --git a/test/ignore.exp b/test/ignore.exp
index bdbd9d28c..ab7f0655f 100755
--- a/test/ignore.exp
+++ b/test/ignore.exp
@@ -33,6 +33,15 @@ expect {
33 "4" 33 "4"
34} 34}
35sleep 1 35sleep 1
36send -- "exit\r"
37sleep 1
38
39send -- "firejail --debug --profile=ignore2.profile\r"
40expect {
41 timeout {puts "TESTING ERROR 5\n";exit}
42 BLACKLIST {puts "TESTING ERROR 6\n";exit}
43 "Child process initialized"
44}
36 45
37 46
38puts "\nall done\n" 47puts "\nall done\n"