DBus

From Mumble Wiki
Revision as of 05:56, 10 June 2008 by Luckyb (talk | contribs) (Changed the python example to show how to wrap a proxy object with an interface so that interface becomes default and it doesn't bug out.)
Jump to: navigation, search

Configuring DBus for Murmur

Since point-to-point DBus connections don't work in Qt yet, you have two options to configure Murmur for dbus use.

A Windows machine

Since Murmur can't run without an active desktop on windows, you can safely ignore this setup. Just make sure your murmur.ini says

dbus=session

Your own machine with root access

If you own the box you're running murmur on, and you have only one murmur process, you'll want to use the system dbus. The first step is creating a new file called /etc/dbus-1/system.d/murmurd.conf

<!DOCTYPE busconfig PUBLIC
 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

  <policy user="mumble">
    <allow own="net.sourceforge.mumble.murmur"/>
  </policy>
  <policy user="root">
    <allow own="net.sourceforge.mumble.murmur"/>
  </policy>

  <policy context="default">
    <allow send_destination="net.sourceforge.mumble.murmur"/>
    <allow receive_sender="net.sourceforge.mumble.murmur"/>
  </policy>
</busconfig>

Then restart the system dbus daemon. Please note that this configuration allows anyone with a user on your machine to control the murmur process, so you might want to tighten security slightly.

In your murmur.ini, make sure it says

dbus=system

A shared machine

First, we'll have to start a dbus daemon and place the session info somewhere.

dbus-launch --sh-syntax > ~/.dbus.sh
source ~/.dbus.sh

Make sure your murmur.ini has

dbus=session

Since there can be many session busses on a system, you'll always need to specify which one to use. So for every new shell you open, you should always

source ~/.dbus.sh

You should not put the above into your .bashrc or similar, as most X sessions will have their own and separate session dbus.

When using the session bus, only the userid who created the bus can use it. Hence, you have to make sure that any scripts you write run with the same user ID.

Making sure it works

Start murmur with the options -fg -v, which will run it in the foreground with full debugging. You should see the line "DBus registration succeeded".

If your distribution includes the full Qt4 tools package, you'll have a program called qdbus which can be used to inspect the dbus system. Try running

qdbus --system net.sourceforge.mumble.murmur /

or if you're using the session bus:

qdbus --session net.sourceforge.mumble.murmur /

You should see a long list of function names. You can actually use the simpler functions directly from qdbus. For example, you can set a new superuser password with

qdbus --system net.sourceforge.mumble.murmur / net.sourceforge.mumble.Meta.setSuperUserPassword 1 supahsecret

Documentation

You can use the Introspect method for receiving a list of all available commands. A simple script to create an output can look like this:

#!/usr/bin/python
import dbus

dbus_base = 'net.sourceforge.mumble.murmur'
bus = dbus.SystemBus()
proxy = bus.get_object(dbus_base, '/')
murmur = dbus.Interface(proxy, 'net.sourceforge.mumble.Meta')
print murmur.Introspect(dbus_interface='org.freedesktop.DBus.Introspectable')

For a documentation of all dbus methods have a look at DBus Methods.

Showing the list of users on a webpage

There is a small perl example called scripts/weblist.pl in the mumble distribution. It works as a CGI for most systems.

Using a PhpBB3 as authentication source

There is an extended example of how to use the authenticator called scripts/dbusauth.pl. You'll need to configure where your phpBB3 database resides, but once that is done you'll simply have to run the script after starting murmur to allow authentication to be done through the phpBB3 database.

Any group associations the user has on phpBB3 is copied to a temporary group on a root channel (and by default inherited to all subchannels). Please note that this is a temporary group membership and as such will not show up in the Edit ACL dialogs.