Commit graph

105 commits

Author SHA1 Message Date
Kelvin M. Klann
34f12c442e
feature: add ${PUBLICSHARE} and ${TEMPLATES} macros (#7164)
Some checks are pending
Build-extra / build-gcc (push) Waiting to run
Build-extra / build-clang (push) Waiting to run
Build / build (push) Waiting to run
Check-C / scan-build (push) Waiting to run
Check-C / cppcheck (push) Waiting to run
Check-C / codeql-cpp (push) Waiting to run
Check-Profiles / profile-checks (push) Waiting to run
Codespell / codespell (push) Waiting to run
Test / test-main (push) Waiting to run
Test / test-fs (push) Waiting to run
Test / test-environment (push) Waiting to run
Test / test-utils (push) Waiting to run
Test / test-network (push) Waiting to run
Add the following directories from the xdg-user-dirs specification[1]:

* `XDG_PUBLICSHARE_DIR="$HOME/Public"`
* `XDG_TEMPLATES_DIR="$HOME/Templates"`

With this, all directories from the specification are supported as
macros.

See also /etc/xdg/user-dirs.defaults.

Relates to #7157 #7163.

[1] https://www.freedesktop.org/wiki/Software/xdg-user-dirs/
2026-05-15 13:11:54 +00:00
Kelvin M. Klann
2f722c85da profiles: sort macros in profile.template
Some checks failed
Build-extra / build-gcc (push) Has been cancelled
Build-extra / build-clang (push) Has been cancelled
Build / build (push) Has been cancelled
Check-C / scan-build (push) Has been cancelled
Check-C / cppcheck (push) Has been cancelled
Check-C / codeql-cpp (push) Has been cancelled
Check-Profiles / profile-checks (push) Has been cancelled
Codespell / codespell (push) Has been cancelled
Test / test-main (push) Has been cancelled
Test / test-fs (push) Has been cancelled
Test / test-environment (push) Has been cancelled
Test / test-utils (push) Has been cancelled
Test / test-network (push) Has been cancelled
Added on commit d4f824519 ("Mention macros in profile.template (#2759)",
2019-06-11).

Kind of relates to #7157.
2026-05-13 11:32:56 -03:00
Kelvin M. Klann
5abf0577a7
feature: add ${PROJECTS} macro (#7157)
Based on the new ~/Projects directory from version 0.20 of the
xdg-user-dirs specification[1]:

* `XDG_PROJECTS_DIR="$HOME/Projects"`

Relates to #7147 #7151.

[1] https://www.freedesktop.org/wiki/Software/xdg-user-dirs/
2026-05-09 13:19:42 +00:00
Kelvin M. Klann
a7a66c5e6e new_syscalls.txt: fix trailing whitespace
This amends commit e9cccefe1 ("update all system call headers",
2026-03-05).
2026-04-17 15:29:25 -03:00
pierretom
9d90daff22 create a new syscall group: @program-keep
`@default-keep` should be used for syscalls used by Firejail itself only.
We are moving some syscalls from `@default-keep` that do not meet this condition into the new group `@program-keep`.
Syscalls in `@program-keep` are not forced to whitelist (we let users decide), but should never be present in `@default` and its sub-groups.

Also move `execv` into `@obsolete` (sparc only, replaced by `execve`).
2026-04-01 14:26:38 +02:00
Kelvin M. Klann
09329b990f modif: replace --keep-hostname with new --hostname-randomize
Changes:

* Keep hostname by default (same as using `--keep-hostname`)
* Add  `--hostname-randomize` command to randomize the hostname
* Ignore `--keep-hostname` command and print a warning if it is used

Setting a different hostname inside of the sandbox may prevent X11
programs from authenticating to the X server and displaying windows at
all (see #7062).

To avoid breakage, keep the hostname as is by default and only set it to
a random value if a new `hostname-randomize` command is used.

This also avoids potentially surprising behavior, as the user might not
expect the hostname to be changed inside of the sandbox, considering
that usually the protections that are applied firejail involve
restricting access to resources (like file paths), rather than modifying
their values inside of the sandbox.

Fixes #7062

Relates to #7048 #7069.
2026-03-08 02:12:26 -03:00
pierretom
0a786af928 include the syscall header for the x32 ABI
Also add the new syscall `rseq_slice_yield` to the `@process` group.
2026-03-05 15:40:49 +01:00
pierretom
e9cccefe1d update all system call headers 2026-03-05 14:49:33 +01:00
pierretom
4d14e1da4b update for the gettimeofday syscall
- src/lib/syscall.c
  - Update the comment to also match `gettimeofday`
  - Sort the content of `@default-keep` by alphabetical order
- etc/templates/syscalls.txt
  - Update the Definition of groups
2026-03-02 09:40:12 +01:00
Kelvin M. Klann
e31d872a51 profiles: add keep-hostname to profile.template
Put it together with the other `keep-` commands.

And move it to the allow section in libreoffice.profile.

Related commits:

* cc8b019b5 ("--keep-hostname part 1 (#7048)", 2026-02-03)
* fbc94070e ("adding keep-hostname to libreoffice.profile", 2026-02-11).

Relates to #7048.
2026-02-11 16:10:47 -03:00
pierretom
f281d76f24 move other syscalls considered deprecated into @obsolete
`futimesat`, `gettimeofday`, `remap_file_pages`, `settimeofday`, `tkill` and `utime`.
2026-01-28 16:09:05 +01:00
pierretom
825fb24ff1 place some syscalls with access to a clock, used for time reading, theoretical resolution and sleep functions into @default-keep
Also move `stime` into `@obsolete`, see `man 2 stime`.
2026-01-28 13:11:23 +01:00
pierretom
85625e46e6 add missing syscalls in groups 2026-01-24 15:11:49 +01:00
pierretom
f5e01fcc56 update system call groups - part 4
- Remove extra empty lines
- Definition of groups:
  - Add the two new groups `@memfd` and `@sandbox`
  - Add new syscalls
- Inheritance of groups:
  - Redraw it in a clearer form of groups and subgroups
  - Add the two new groups
  - Sort `@mount` and `@obsolete` groups by alphabetical order

This is the last part.
2026-01-22 16:21:01 +01:00
pierretom
380e90169e update and add system calls for several architectures
Closes #6956.
2025-11-10 08:35:20 +01:00
pierretom
ec6b976f25
bugfix: add missing macros in profile.template (#6948) 2025-10-28 16:13:59 +00:00
Kelvin M. Klann
326a3102a4 profiles: fix private-opt comment misc in profile.template
This amends commit b66da99f9 ("profiles: finish converting private-opt
to whitelist (#6785)", 2025-06-22).
2025-06-26 07:17:50 -03:00
Kelvin M. Klann
b66da99f9a
profiles: finish converting private-opt to whitelist (#6785)
Changes:

* Convert all private-opt entries (other than `private-opt none`) to
  whitelist entries
* Remove remaining commented private-opt entries and related comments
  (for profiles that also have a corresponding whitelist entry)
* Enable `whitelist /opt/basilisk` in basilisk.profile (similarly to
  mullvad-browser.profile and palemoon.profile)
* Update private-opt comment in etc/templates/profile.template

Most private-opt entries were converted into whitelist entries on commit
175905530 ("profiles: exchange private-opt with a whitelist (#6021)",
2023-10-18), while some of them were left alone due to the program size
being deemed small enough as not to break file-copy-limit in
firejail.config.

For the sake of simplicity and clarity (and to avoid potential issues
with program install sizes increasing over time), convert those
private-opt entries into whitelist entries as well (note that users can
still enable private-opt in the corresponding .local profile).

Also, some commented private-opt entries remain (with a note about
potential issues with private-opt).

Since commit 175905530 also documented the drawbacks of private-opt in
firejail.1, it should be fine to remove the commented entries and
related comments (note that in all of the profiles containing such
comments, there is already an equivalent whitelist entry).

Related commits:

* f3f739c5d ("microsoft-edge.profile: rewrite profile for stable
  channel", 2022-08-11) /
  PR #5709
* 121e043df ("microsoft-edge-{dev,beta}: replaced private-opt by
  whitelist #5307", 2022-08-11) /
  PR #5709
* 2cb40fbec ("microsoft-edge fixes (#5697)", 2023-03-14)
* 58732a654 ("Add profiles for jami and postman (#5691)", 2023-03-15)
* 175905530 ("profiles: exchange private-opt with a whitelist (#6021)",
  2023-10-18)
2025-06-22 05:07:18 +00:00
Kelvin M. Klann
dd3ef2a1d0
feature: add warn command (#6710)
And use it in etc/inc/disable-X11.inc.

This allows printing a warning message from inside a profile.

Everything after the command is printed in a warning message as is (that
is, without macro expansion).

Example:

    $ firejail --noprofile --include=/etc/firejail/disable-X11.inc true
    Reading profile /etc/firejail/disable-X11.inc
    Warning: /etc/firejail/disable-X11.inc:5: This file is deprecated; use disable-x11.inc (lowercase) instead.
    Reading profile /etc/firejail/disable-x11.inc
    [...]

Relates to #6294.

This is a follow-up to #6709.
2025-04-21 10:49:27 +00:00
Kelvin M. Klann
4d34d4c336 modif: block TPM devices & turn notpm command into keep-dev-tpm
Instead of having a `notpm` command and potentially adding it to almost
all profiles (as few programs should need direct access to TPM devices),
add a `keep-dev-tpm` command and use it only in profiles that need
access to TPM devices.

Changes:

* Turn `notpm` command into `keep-dev-tpm` command
* Warn and ignore if `notpm` is used
* Block `/dev/tpm*` devices by default
* Allow `/dev/tpm*` devices with `keep-dev-tpm` (even if `private-dev`
  is used)

Added on commit 001320226 ("feature: add notpm command & keep tpm
devices in private-dev (#6390)", 2024-07-09).

See also commit ee1c264c5 ("feature: block /dev/ntsync & add
keep-dev-ntsync command (#6660)", 2025-03-06) and the discussion at
PR #6660.

This is a follow-up to #6687.
2025-04-05 15:52:30 -03:00
Kelvin M. Klann
21bb8dbe96 profiles: add missing allow-/keep- commands to profile.template
See etc/profile-m-z/noprofile.profile.
2025-03-26 16:23:46 -03:00
Kelvin M. Klann
c90f4600e4 profiles: split commands that increase/reduce access (template)
This should clarify which commands do what (increase/reduce access) and
also make etc/templates/profile.template more consistent with
etc/profile-m-z/noprofile.profile.

This is a follow-up to #6660.

See also the discussion at [1].

[1] https://github.com/netblue30/firejail/pull/6660#discussion_r1975233984
2025-03-26 16:23:43 -03:00
weebnix
ee1c264c5f
feature: block /dev/ntsync & add keep-dev-ntsync command (#6660)
Changes:

* Block access to /dev/ntsync by default
* Add the `keep-dev-ntsync` command to allow access to /dev/ntsync (even
  if `private-dev` is used)
* Add `keep-dev-ntsync` to wine.profile and similar profiles

Closes #6655.
2025-03-06 06:36:00 +00:00
qdii
001320226c
feature: add notpm command & keep tpm devices in private-dev (#6390)
An ssh private key may be stored in a Trusted Platform Module (TPM)
device and `private-dev` in ssh.profile currently breaks this use-case,
as it does not keep tpm devices (see #6379).

So add a new `notpm` command and keep tpm devices in /dev by default
with `private-dev` unless `notpm` is used.
2024-07-09 01:43:55 +00:00
Kelvin M. Klann
1cfa06b4c5
profiles: clarify and add opengl-game to profile.template (#6300)
To make it consistent with the other include profiles.

See etc/templates/profile.template.

With this, all `etc/inc/allow-*` files are listed in profile.template.

The explanation is based on a comment by @rusty-snake[1].

Relates to #4071.

This is a follow-up to #6299.

[1] https://github.com/netblue30/firejail/pull/4071#issuecomment-822003473
2024-04-05 12:09:04 +00:00
Kelvin M. Klann
e6b10a45cd
profiles: add allow-php.inc to profile.template (#6299)
To make it consistent with the other include profiles.

See etc/templates/profile.template.

Note: It is not currently included in any profile.

Added on commit 89f30f1f2 ("Create allow-php.inc", 2020-01-25).

This is a follow-up to #6298.
2024-04-03 00:02:41 +00:00
Kelvin M. Klann
baad57d4cd
profiles: add allow-nodejs.inc to profile.template (#6298)
To make it consistent with the other include profiles.

See etc/templates/profile.template.

Relates to #3866 #5881.
2024-03-30 20:38:01 +00:00
Kelvin M. Klann
0060b5105b
profiles: rename disable-X11.inc to disable-x11.inc (#6294)
That is, make "X11" lowercase so that the order of the includes in the
disable- section remain the same when sorted with `LC_ALL=C`, as is the
case for most of the other sections.  That is also likely to be the
default in text editors (such as in vim on Arch), so this should make
the disable- section more consistent and easier to sort when editing the
profile.

Also, keep the old include as a redirect to the new one for now to avoid
breakage.

Commands used to search and replace:

    git mv etc/inc/disable-X11.inc etc/inc/disable-x11.inc
    git grep -Ilz 'disable-X11' -- etc | xargs -0 \
      perl -pi -e 's/disable-X11/disable-x11/'

Relates to #4462 #4854 #6070 #6289.

This is a follow-up to #6286.
2024-03-27 12:13:47 +00:00
Kelvin M. Klann
9cfeb485eb landlock: use "landlock.fs." prefix in filesystem commands
Since Landlock ABI v4 it is possible to restrict actions related to the
network and potentially more areas will be added in the future.

So use `landlock.fs.` as the prefix in the current filesystem-related
commands (and later `landlock.net.` for the network-related commands) to
keep them organized and to match what is used in the kernel.

Examples of filesystem and network access flags:

* `LANDLOCK_ACCESS_FS_EXECUTE`: Execute a file.
* `LANDLOCK_ACCESS_FS_READ_DIR`: Open a directory or list its content.
* `LANDLOCK_ACCESS_NET_BIND_TCP`: Bind a TCP socket to a local port.
* `LANDLOCK_ACCESS_NET_CONNECT_TCP`: Connect an active TCP socket to a
  remote port.

Relates to #6078.
2024-02-27 22:27:46 -03:00
Kelvin M. Klann
f70ffbe76c landlock: split .special into .makeipc and .makedev
As discussed with @topimiettinen[1], it is unlikely that an unprivileged
process would need to directly create block or character devices.  Also,
`landlock.special` is not very descriptive of what it allows.

So split `landlock.special` into:

* `landlock.makeipc`: allow creating named pipes and sockets (which are
  usually used for inter-process communication)
* `landlock.makedev`: allow creating block and character devices

Misc: The `makedev` name is based on `nodev` from mount(8), which makes
mount not interpret block and character devices.  `ipc` was suggested by
@rusty-snake[2].

Relates to #6078.

[1] https://github.com/netblue30/firejail/pull/6078#pullrequestreview-1740569786
[2] https://github.com/netblue30/firejail/pull/6187#issuecomment-1924107294
2024-02-02 19:37:06 -03:00
Kelvin M. Klann
760f50f78a landlock: move commands into profile and add landlock.enforce
Changes:

* Move commands from --landlock and --landlock.proc= into
  etc/inc/landlock-common.inc
* Remove --landlock and --landlock.proc=
* Add --landlock.enforce

Instead of hard-coding the default commands (and having a separate
command just for /proc), move them into a dedicated profile to make it
easier for users to interact with the entries (view, copy, add ignore
entries, etc).

Only enforce the Landlock commands if --landlock.enforce is supplied.
This allows safely adding Landlock commands to (upstream) profiles while
keeping their enforcement opt-in.  It also makes it simpler to
effectively disable all Landlock commands, by using
`--ignore=landlock.enforce`.

Relates to #6078.
2023-12-11 22:47:11 -03:00
glitsj16
1759055304
profiles: exchange private-opt with a whitelist (#6021)
* profiles: drop private-opt (existing whitelist)

* profiles: replace private-opt with whitelist

In most profiles.

Kept private-opt for enpass (~85MB), mate-dictionary (<20MB),
minecraft-launcher (~1.6MB) and ppsspp (~44MB). The only app I couldn't
check: xmr-stak.

* docs: note potential issues with private-opt
2023-10-18 22:47:07 +00:00
Topi Miettinen
7e8ba3a8be
Fix wrong syscall names for s390_pci_mmio_{read,write}
Closes #5965
2023-08-26 21:48:44 +03:00
glitsj16
9863f982ca
modif: drop deprecated 'shell' option references (#5894)
The `shell` option has been removed. Remove stale references.

This does NOT remove `shell none`-related code comments in:

- src/firejail/fs_lib.c (L433-L441)
- src/firejail/join.c (L415-L417)

Relates to #5196.

Suggested by #5891.
2023-07-19 12:54:53 +00:00
Kelvin M. Klann
24f2a89200 profile.template: note to put read-only entries in dc 2023-03-29 04:06:30 -03:00
Dpeta
817180fce5
Update DBus wiki link 2022-12-23 19:26:10 +01:00
smitsohu
87afef810c introduce new option restrict-namespaces 2022-07-23 16:21:14 +02:00
smitsohu
f4f44a5f96 refresh syscall groups (#5188)
now covers syscalls up to including process_madvise (440)

group assignment was blindly copied from systemd:
729d2df806/src/shared/seccomp-util.c (L305)

the only exception is close_range, which was added to both @basic-io and @file-system

this commit adds the following syscalls to the default blacklist:
pidfd_getfd,fsconfig,fsmount,fsopen,fspick,move_mount,open_tree
2022-07-17 17:05:36 +02:00
rusty-snake
56ebc8ac98 Fix chromium browsers in firejail 0.9.68
closes #4965
2022-04-14 22:15:54 +02:00
Kelvin M. Klann
58b58cfaa1 profile.template: add noprinters
See commit bd15e763e ("--noprinter option", 2021-10-20) and commit
d9403dcdc ("small fix", 2021-10-20).

Relates to #4607.
2022-01-05 19:02:52 -03:00
smitsohu
e20960ab45 deterministic-shutdown option 2021-10-28 13:41:52 +02:00
smitsohu
72e90164ec
Merge pull request #4521 from rusty-snake/disable-proc.inc
Create disable-proc.inc
2021-10-20 16:10:19 +02:00
a1346054
47f7347715
fix spelling (#4573) 2021-09-22 23:05:33 +02:00
rusty-snake
23f6bb9e2f Create disable-proc.inc 2021-09-09 17:06:23 +02:00
rusty-snake
1b6bdca8b7 Update profile.template to use disable-X11.inc 2021-09-08 12:37:16 +02:00
Reiner Herrmann
8278936e5f add disable-X11.inc to profile template 2021-08-14 22:50:34 +02:00
rusty-snake
40ad5ce594 Move disable-passwordmgr.inc into disable-common.inc/disable-programs.inc follow up 2021-08-12 19:41:46 +02:00
rusty-snake
8d3d67e896 Add wru to firefox-common, chromium-common and profile.template
Still unresolved:
> If someone who use systemd-resolved can say more which resolv.conf is necessary on such system.
> whitelist /run/systemd/resolve/resolv.conf
> whitelist /run/systemd/resolve/stub-resolv.conf
2021-08-04 16:34:38 +02:00
rusty-snake
f4b36e8032 Profile fixes
- Fix #4157 -- [Feature] Should rmenv GitHub auth tokens
  There are still more token variables from other program that should be
  added.
- Fix #4093 -- darktable needs read access to liblua*
- Fix #4383 -- move noblacklist ${HOME}/.bogofilter to email-common.profile for claws-mail (and other mailers)
- Fix xournalpp.profile
- syscalls.txt: ausyscall i386 -> firejail --debug-syscalls32
2021-08-04 16:33:11 +02:00
rusty-snake
bf886377ae Update etc/templates/syscalls.txt
Rework + suggest --seccomp-error-action=log
2021-07-28 09:30:16 +02:00