From mboxrd@z Thu Jan 1 00:00:00 1970 From: Havoc Pennington Date: Tue, 08 Apr 2003 04:37:44 +0000 Subject: communicating with user login sessions Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Hi, There's this text on the hotplug web site, not sure it's up to date: A gap in current Linux support is that policies with any sort of dynamic "interact with user" component aren't currently supported. For example, that's often needed the first time a network adapter or printer is connected, and to determine appropriate places to mount disk drives. It would seem that such actions could be supported for any case where a responsible human can be identified: single user workstations, or any system which is remotely administered. This is a classic "remote sysadmin" problem, where in this case hotplugging needs to deliver an event from one security domain (operating system processes) to another (desktop for logged-in user, or remote sysadmin), and any effective response must go the other way. At this writing, Linux doesn't have widely adopted solutions to such problems. This is by no means specific to device hotplugging - there's a general problem of delivering events from the OS out to user login sessions. Non-hotplug events might be things like "printer queue has changed" (from the lpd daemon), or "I need a password now" (from the VPN subsystem). I'm working on some code with some other people that may provide a nice solution to this problem: http://www.freedesktop.org/software/dbus/ I don't know if people outside of the desktop world have heard of it yet, or whether there are already similar solutions in progress for hotplug specifically. With D-BUS, the same code is used in three different use cases: - two applications communicate directly with each other by exchanging messages - applications send/receive broadcasts across a per-user per-login-session message bus daemon - applications send/receive broadcasts across a systemwide per-machine message bus daemon How it works: - there's a library which provides general "exchange messages between two applications" functionality; it handles authentication, creating a network transport, and serializing/unserializing messages to push them over the wire - on top of that general functionality, we've built a message bus daemon - the message bus daemon can be customized via configuration file to be systemwide or per-user-login-session. (See http://www.freedesktop.org/software/dbus/doc/config-file.txt) As an inside-login-session IPC mechanism, D-BUS gives us a way to link different kinds of application (GNOME, KDE, plain old command line or Xlib). This distinguishes it from tightly-bound-to-the-desktop APIs such as Bonobo and DCOP, that require more buy-in to the GNOME/KDE frameworks. My understanding of how D-BUS would interact with hotplug is that the hotplug scripts or daemon would briefly connect to the message bus, inject a broadcast message, then disconnect again. This could be done by linking to the D-BUS library, or by calling a simple command line tool that linked to the D-BUS library. Or for efficiency, a daemon could maintain a continuous connection to the message bus. The mostly-but-not-completely-implemented plan is that there are access controls built in to the message bus. So it's possible to specify that only certain users or certain groups can send or receive certain kinds of message. The hope is that by making D-BUS useful in three different contexts, portable to many operating systems, and X-style-licensed, it will be widely used and will thus be robust and something that application authors are comfortable relying on. We're also hoping to see GNOME and KDE both adopt the system, which should help make it widely available. If all desktop apps are linking to D-BUS anyhow, then it would be really easy and simple for any app to monitor the systemwide message bus and implement hardware-related features. There is nothing X-specific about D-BUS, and it does not link to Xlib (or indeed to much of anything - it's basically dependency-free with the exception of "some XML parser to load the config file" - even the XML parser dependency is on the daemon binary, not on the shared lib). Some of the interesting features of D-BUS so far: - 63% of basic blocks covered by "make check" tests - dual licensed your choice of AFL (MIT/X license equivalent) or GPL - 100% API documentation, substantial internals documentation - partially complete protocol specification - significant amount of code implemented Caveats: - the library is about 50% test code, unless you build with --disable-asserts --disable-verbose-mode --disable-tests - don't ship D-BUS in production yet, it has a number of unimplemented yet essential security features (such as timing out unauthenticated connections) - some stuff is just broken - the API is still in flux If this sounds interesting to the hotplug community, I'd hugely appreciate it if people could read some of the D-BUS docs, hop on our mailing list, play with the code, give feedback, or whatever interests you. Right now most of the core desktop developers are on the D-BUS mailing list, but we don't have a lot of representation from hackers working on the system and hardware end of things. There are a couple of TODO lists on the web page, and help on any of that stuff would be welcome. Perhaps the most invaluable contribution would be any amount of code auditing people have time for, whether it's one file or a complete audit. Third party eyes are always a help. If D-BUS proves useful for hardware events, I'd like to see a standard set of events spec'd out, and used across all distributions. That way projects such as GNOME and KDE can easily use those events without a bunch of #ifdef SUSE #ifdef RED_HAT kind of stuff. In any case, feedback is welcome. Specifics of D-BUS that aren't directly related to its use with hotplug are probably best posted to message-bus-list@freedesktop.org rather than this list, I don't want to start an off-topic thread. Thanks a lot, Havoc ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel