DBUS_TYPE_LINUX_CRED ?

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Dec 16 03:23:32 PST 2013


On 13/12/13 18:17, Lennart Poettering wrote:
> On Fri, 13.12.13 11:39, Serge Hallyn (serge.hallyn at ubuntu.com) wrote:
> 
>> Hi,
>>
>> dbus-protocol.h defines DBUS_TYPE_UNIX_FD as an iter type which can
>> be appended to a message.  Would it be acceptable to add something
>> along the lines of DBUS_TYPE_LINUX_CRED ?  Better yet, is there already
>> a way of sending a struct ucred as SCM_CREDENTIAL by appending it to
>> a dbus message?
> 
> You can also query the identity of a bus peer with the bus driver calls
> GetConnectionUnixUser and GetConnectionUnixProcessID.

... and in the 1.7 development branch, there's
GetConnectionCredentials(), which returns everything we know about the
connection in one convenient a{sv}. (Hopefully the kdbus prototypes
implement that too?)

At the moment GetConnectionCredentials only returns the (Unix uid, pid);
if you like SELinux, AppArmor, SMACK, Solaris ADT or other security
frameworks, please attach patches to Bugzilla that extend it to return
their additional flavours of credentials.

> In kdbus you will also get a variety of creds attached to all messages
> implicitly (pid, gid, uid, pid_starttime, tid, comm, tid_comm, cmdline,
> cgroup, unit, slice, user unit, session, owner uid, eff caps, inh caps,
> perm caps, bounding caps, selinux context, audit session, audit login
> uid), and this can be selected by the receiver.

I think this is likely to be a better approach. If something like this
ever exists in traditional D-Bus, it should be a header field; if that
requires extra types as an implementation detail, then IMO they should
only be allowed in headers, and forbidden in message bodies.

    S



More information about the dbus mailing list