-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dbus: check whether the client wanted interactive authentication #546
dbus: check whether the client wanted interactive authentication #546
Conversation
I'm coming from https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/676 and I haven't been able to test this, yet. Sorry. |
@hartwork may have an opinion here, too :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @muelli,
that's a nice idea, thanks for bringing this to my attention and for taking it upstream! 👍
Some notes:
-
Flag
G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION
seems to require glib >=2.46 according to https://libsoup.org/gio/GDBusMessage.html.
configure.ac
does not require a specific version of glib as of today and glib <2.46 may (or may not) be used on some to-be-supported environments.
So we either need pre-processor if-else for glib <2.46 and >=2.46 or we need to make glib >=2.46 a known and checked-for build time dependency inconfigure.ac
.
@radosroka any thoughts on these options? -
CI does not like the current code formatting, see:
- log at https://github.com/USBGuard/usbguard/runs/6035863630?check_suite_focus=true#step:7:139
- helper
./scripts/reformat-sources.sh
-
(My picky vote for
GDBusMessage* const message
addingconst
.) -
(Pull request pull request polkit: Always allow getParameter/listDevices/listRules in active sessions (fixes #544) #545 probably already "fixed" the situation for gnome-settings-daemon (but this change still seems like a good idea).)
What do you think?
Best, Sebastian
good catch. |
0a86714
to
6d890cd
Compare
@muelli alright, let's start with that approach then, I guess |
that indeed addresses part of the problem. The other part is that we try to authorise keyboards when the screen is locked. We may or may not be able to do that currently. With this change we can detect whether the user is actually allowed to authorise the device. It would still be better if the user could actually perform the authorisation, but this change probably encodes the right behaviour, because it checks whether the caller is fine with asking for authorisation. |
We should also should check with (say) d-feet if interactive auth still works with this patch in practice before merging, to be sure. I haven't done that, yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that while this patch is correct, it causes a timeout error from the client (https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/676#note_1430710). The problem is that in various places there is code like:
Which is obviously wrong, as it means that no error is returned. Instead, the code needs to call
at some point. Though, not sure if |
uh. But it feels like it would be easy to add. reg. the type of error: The docs have this to say:
(from https://www.freedesktop.org/software/gstreamer-sdk/data/docs/latest/gio/gio-GDBusError.html - why does it show up under the gstreamer namespace? Rather than a more generic "dbus" namespace or something.) |
@benzea thanks for your input, that's definitely helpful! 👍 @muelli how should we proceed with this pull request? Should I (a) cherry-pick your commit and make a new pull request applying the ideas of @benzea or (b) make commits for those, export using |
The broker isn't doing the access control, so it can't react anymore. |
Who is the broker in this picture? |
The server that forwards messages between clients. i.e. dbus-daemon or dbus-broker in almost all cases. |
Regarding the missing reply aspect brought up by @benzea, there is pull request #548 ready fro review and testing now. Regarding the allow-interactive-flag aspect brought up by @muelli: I'm looking forward to your feedback 🍻 |
That's a problem of the tool, i.e. d-feet. |
@Cropi @muelli >=2.46 please, see https://libsoup.org/gio/GDBusMessage.html#GDBusMessageFlags |
@muelli I believe we need something like this: #
# Check for required D-Bus modules
#
- PKG_CHECK_MODULES([dbus], [dbus-1 gio-2.0 polkit-gobject-1],
+ PKG_CHECK_MODULES([dbus], [dbus-1 gio-2.0 >= 2.46 polkit-gobject-1],
[AC_DEFINE([HAVE_DBUS], [1], [Required GDBus API available])
dbus_summary="system-wide; $dbus_CFLAGS $dbus_LIBS"],
[AC_MSG_FAILURE([Required D-Bus modules (dbus-1, gio-2.0, polkit-gobject-1) not found!])] You can try with a version that your system has no way of satisfying — e.g. |
Some clients do not want to prompt for passwords, e.g. when authorising keyboards when the screen is locked, prompting for a password doesn't make sense because the user cannot enter anything. This change extracts the flags and checks whether the client called with G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION. The flag is available since 2.46: https://libsoup.org/gio/GDBusMessage.html#GDBusMessageFlags Hence, we update the dependency in configure.ac.
6d890cd
to
e70d445
Compare
I've added the check now. I haven't tested these changes, though. |
okay, I've managed to test the change. Probably this is causing me getting unconditional access:
|
I managed to get a proper test case, now.
So I conclude that the patch is working as intended. |
Some clients do not want to prompt for passwords, e.g. when authorising keyboards
when the screen is locked, prompting for a password doesn't make sense because
the user cannot enter anything.
This change extracts the flags and checks whether the client called with
G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION.