mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3402] implement xdg-dbus-proxy --log / log denied D-Bus access tries #2138
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2138
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rusty-snake on GitHub (May 4, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3402
Originally assigned to: @kris7t on GitHub.
Implement xdg-dbus-proxy --log to log blocked D-Bus calls. Without this it is difficult debug things like #3400 or #3399.
Alternative we could log all calls for writing for writing profiles or simply forward the --log output (stdout of xdg-dbus-proxy) to a file (e.g. /tmp/pid_of_sandbox-dbus) and parse it with a python/bash/... program in contrib.
see also https://github.com/netblue30/firejail/pull/3265#issuecomment-609477194
cc @kris7t
@kris7t commented on GitHub (May 4, 2020):
Sorry for not getting back to this earlier. I think capturing
xdg-dbus-proxyoutput is the way forward, then post-processing it with a script (either to create a more human-readable log, or to generate profile line directly). The format of the logs looks way too annoying to process in a C program.A complication is that
xdg-dbus-proxydoesn't log separately for the session and system buses. Sometimes, interactive with the session and system buses is easily to filter out, but some names may be present on both buses. So to avoid confusion, I am now experimenting with single--dbus-user.logand--dbus-session.logoptions, as well as adbus-log=option to direct output to a log file. A post-processing Python script may attempt to ingest a single log, connecting to the session and system buses to discern where each names belong (this can be somewhat of an approximation, if some names have disappeared since generating the log file), or take two logs (but then we have to run the application with logging two separate times).Another annoyance is that while filter rules are bound to well-known names, but communication on the bus might use unique names. See e.g.,
which is a log from
notify-send "foo". There is no mention oforg.freedesktop.Notificationsas bus name anywhere, we instead get:1.4. Filter rules are "sticky" to bus names, so even though I had--dbus-user.call=org.freedesktop.Notifications=org.freedesktop.Notifications.*@/org/freedesktop/Notifications, the call went through::1.4also holds the bus nameorg.freedesktop.Notifications. So we probably need the helper script to connect to the bus, and try to resolve unique names into well-known names. Now, a program might hold multiple well-know names, but only one will make sense for a filter rule (org.freedesktop.Notificationsinstead oforg.gnome.Shell, for example), so we might also need some heuristics (e.g., pick the well-known name most similar to the object path or interface name). But relations between these names are loose enough in practice that some manual intervention may be needed nevertheless.In principle, we could even generate very fine-grained policies with
--calland--broadcastfilters that take bus name, interface member, object path triples. I added--dbus-{user,system}.{call,broadcast}=options to firejail to this end. However, these profiles can be unwieldy to write (hence the need for automatic generation from logs).@rusty-snake commented on GitHub (May 4, 2020):
Thanks for the explanations.
Going this way, would allow different scripts for different things (generate profile, warn on violation, ...)
From that what I saw (with --log and
dbus-monitor) the output still contains the addresses (at least one time).