Skip to content

Commit 5a61202

Browse files
committed
rename noautopulse to keep-config-pulse
Changes: * add the keep-config-pulse option * make noautopulse an alias for keep-config-pulse * deprecate the noautopulse option * misc: fix indentation of --keep-dev-shm on src/firejail/usage.c Even though noautopulse is not intended for hardening, it looks like it is, because it starts with "no", just like no3d, noroot, etc). In fact, it is the only "no" option that differs in such a way. And it has been accidentally misused as such before; see PR netblue30#4269 and commit e4beaea ("drop noautopulse from agetpkg"). So effectively rename it to keep-config-pulse in order to avoid confusion. This is similar to the keep-var-tmp and keep-dev-shm options, which are used to "leave a path alone", just like noautopulse. Note: The changes on this patch are based on the ones from commit 617ff40 ("add --noautopulse arg for complex pulse setups") / PR netblue30#1854. See netblue30#4269 for the discussion.
1 parent c9e7fe8 commit 5a61202

File tree

7 files changed

+32
-14
lines changed

7 files changed

+32
-14
lines changed

contrib/vim/syntax/firejail.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ syn match fjVar /\v\$\{(CFG|DESKTOP|DOCUMENTS|DOWNLOADS|HOME|MUSIC|PATH|PICTURES
4949
" Generate list with: { rg -o 'strn?cmp\(ptr, "([^"]+) "' -r '$1' src/firejail/profile.c; echo private-lib; } | grep -vEx '(include|ignore|caps\.drop|caps\.keep|protocol|seccomp|seccomp\.drop|seccomp\.keep|env|rmenv|net|ip)' | sort -u | tr $'\n' '|' # private-lib is special-cased in the code and doesn't match the regex; grep-ed patterns are handled later with 'syn match nextgroup=' directives (except for include which is special-cased as a fjCommandNoCond keyword)
5050
syn match fjCommand /\v(bind|blacklist|blacklist-nolog|cgroup|cpu|defaultgw|dns|hostname|hosts-file|ip6|iprange|join-or-start|mac|mkdir|mkfile|mtu|name|netfilter|netfilter6|netmask|nice|noblacklist|noexec|nowhitelist|overlay-named|private|private-bin|private-etc|private-home|private-lib|private-opt|private-srv|read-only|read-write|rlimit-as|rlimit-cpu|rlimit-fsize|rlimit-nofile|rlimit-nproc|rlimit-sigpending|timeout|tmpfs|veth-name|whitelist|xephyr-screen) / skipwhite contained
5151
" Generate list with: rg -o 'strn?cmp\(ptr, "([^ "]*[^ ])"' -r '$1' src/firejail/profile.c | grep -vEx '(include|rlimit|quiet)' | sed -e 's/\./\\./' | sort -u | tr $'\n' '|' # include/rlimit are false positives, quiet is special-cased below
52-
syn match fjCommand /\v(allusers|apparmor|caps|disable-mnt|ipc-namespace|keep-dev-shm|keep-var-tmp|machine-id|memory-deny-write-execute|netfilter|no3d|noautopulse|nodbus|nodvd|nogroups|noinput|nonewprivs|noroot|nosound|notv|nou2f|novideo|overlay|overlay-tmpfs|private|private-cache|private-dev|private-lib|private-tmp|seccomp|seccomp\.block-secondary|tracelog|writable-etc|writable-run-user|writable-var|writable-var-log|x11)$/ contained
52+
syn match fjCommand /\v(allusers|apparmor|caps|disable-mnt|ipc-namespace|keep-config-pulse|keep-dev-shm|keep-var-tmp|machine-id|memory-deny-write-execute|netfilter|no3d|noautopulse|nodbus|nodvd|nogroups|noinput|nonewprivs|noroot|nosound|notv|nou2f|novideo|overlay|overlay-tmpfs|private|private-cache|private-dev|private-lib|private-tmp|seccomp|seccomp\.block-secondary|tracelog|writable-etc|writable-run-user|writable-var|writable-var-log|x11)$/ contained
5353
syn match fjCommand /ignore / nextgroup=fjCommand,fjCommandNoCond skipwhite contained
5454
syn match fjCommand /caps\.drop / nextgroup=fjCapability,fjAll skipwhite contained
5555
syn match fjCommand /caps\.keep / nextgroup=fjCapability skipwhite contained

src/firejail/main.c

+3
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,9 @@ int main(int argc, char **argv, char **envp) {
18761876
}
18771877
arg_writable_etc = 1;
18781878
}
1879+
else if (strcmp(argv[i], "--keep-config-pulse") == 0) {
1880+
arg_noautopulse = 1;
1881+
}
18791882
else if (strcmp(argv[i], "--writable-var") == 0) {
18801883
arg_writable_var = 1;
18811884
}

src/firejail/profile.c

+6
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,12 @@ int profile_check_line(char *ptr, int lineno, const char *fname) {
11431143
arg_machineid = 1;
11441144
return 0;
11451145
}
1146+
1147+
if (strcmp(ptr, "keep-config-pulse") == 0) {
1148+
arg_noautopulse = 1;
1149+
return 0;
1150+
}
1151+
11461152
// writable-var
11471153
if (strcmp(ptr, "writable-var") == 0) {
11481154
arg_writable_var = 1;

src/firejail/usage.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ static char *usage_str =
114114
" --join-network=name|pid - join the network namespace.\n"
115115
#endif
116116
" --join-or-start=name|pid - join the sandbox or start a new one.\n"
117-
" --keep-dev-shm - /dev/shm directory is untouched (even with --private-dev).\n"
117+
" --keep-config-pulse - disable automatic ~/.config/pulse init.\n"
118+
" --keep-dev-shm - /dev/shm directory is untouched (even with --private-dev).\n"
118119
" --keep-var-tmp - /var/tmp directory is untouched.\n"
119120
" --list - list all sandboxes.\n"
120121
#ifdef HAVE_FILE_TRANSFER

src/man/firejail-profile.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ Mount-bind file1 on top of file2. This option is only available when running as
271271
\fBdisable-mnt
272272
Disable /mnt, /media, /run/mount and /run/media access.
273273
.TP
274+
\fBkeep-config-pulse
275+
Disable automatic ~/.config/pulse init, for complex setups such as remote
276+
pulse servers or non-standard socket paths.
277+
.TP
274278
\fBkeep-dev-shm
275279
/dev/shm directory is untouched (even with private-dev).
276280
.TP
@@ -718,9 +722,8 @@ name browser
718722
\fBno3d
719723
Disable 3D hardware acceleration.
720724
.TP
721-
\fBnoautopulse
722-
Disable automatic ~/.config/pulse init, for complex setups such as remote
723-
pulse servers or non-standard socket paths.
725+
\fBnoautopulse \fR(deprecated)
726+
See keep-config-pulse.
724727
.TP
725728
\fBnodvd
726729
Disable DVD and audio CD devices.

src/man/firejail.txt

+13-9
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,17 @@ Same as "firejail --join=name" if sandbox with specified name exists, otherwise
10511051
.br
10521052
Note that in contrary to other join options there is respective profile option.
10531053

1054+
.TP
1055+
\fB\-\-keep-config-pulse
1056+
Disable automatic ~/.config/pulse init, for complex setups such as remote
1057+
pulse servers or non-standard socket paths.
1058+
.br
1059+
1060+
.br
1061+
Example:
1062+
.br
1063+
$ firejail \-\-keep-config-pulse firefox
1064+
10541065
.TP
10551066
\fB\-\-keep-dev-shm
10561067
/dev/shm directory is untouched (even with --private-dev)
@@ -1460,15 +1471,8 @@ Example:
14601471
$ firejail --no3d firefox
14611472

14621473
.TP
1463-
\fB\-\-noautopulse
1464-
Disable automatic ~/.config/pulse init, for complex setups such as remote
1465-
pulse servers or non-standard socket paths.
1466-
.br
1467-
1468-
.br
1469-
Example:
1470-
.br
1471-
$ firejail \-\-noautopulse firefox
1474+
\fB\-\-noautopulse \fR(deprecated)
1475+
See --keep-config-pulse.
14721476

14731477
.TP
14741478
\fB\-\-noblacklist=dirname_or_filename

src/zsh_completion/_firejail.in

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ _firejail_args=(
9898
'*--ignore=-[ignore command in profile files]: :'
9999
'--ipc-namespace[enable a new IPC namespace]'
100100
'--join-or-start=-[join the sandbox or start a new one name|pid]: :_all_firejails'
101+
'--keep-config-pulse[disable automatic ~/.config/pulse init]'
101102
'--keep-dev-shm[/dev/shm directory is untouched (even with --private-dev)]'
102103
'--keep-var-tmp[/var/tmp directory is untouched]'
103104
'--machine-id[preserve /etc/machine-id]'

0 commit comments

Comments
 (0)