- 1 What is DBus for Murmur
- 2 Configuring DBus for Murmur
- 3 Making sure it works
- 4 Documentation
- 5 Showing the list of users on a webpage
- 6 Using a PhpBB3 as authentication source
- 7 DBus in the Mumble client
What is DBus for Murmur
D-Bus is a free software project which offers a simple way for applications to communicate with one another. It is developed by Red Hat as part of the freedesktop.org project. - Wikipedia
DBus can be used as an RPC method for controlling murmur from another application.
WARNING: The DBus interface for the server is deprecated and will not be extended any more. Use the Ice interface instead.
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 on Linux/OSX
For DBus we need an isolated daemon, different from the one running under, say, a X11 session, so we specifically spawn our own. The following small shell script will ensure a deamon is ready (copied from murmur-user-wrapper):
#! /bin/bash DIR=$HOME/murmur DBUSFILE=$DIR/.dbus.sh DBUS_SESSION_BUS_ADDRESS=invalid:/ [ -f $DBUSFILE ] && . $DBUSFILE if ! dbus-send --print-reply --dest=org.freedesktop.DBus --type=method_call / org.freedesktop.DBus.GetId 2> /dev/null > /dev/null; then echo "Launching D-Bus session" dbus-launch --sh-syntax > $DBUSFILE . $DBUSFILE if ! dbus-send --print-reply --dest=org.freedesktop.DBus --type=method_call / org.freedesktop.DBus.GetId 2> /dev/null > /dev/null; then echo "Failed to launch session DBUS, bailing out." fi fi
Before running this for the first time, make sure ~/murmur exists
And to use it
You should always source this script before starting murmur, and you also need to run it before using any DBus commands.
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
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
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
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
If you don't have qdbus, try this
dbus-send --system --dest=net.sourceforge.mumble.murmur --type=method_call --print-reply / org.freedesktop.DBus.Introspectable.Introspect
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.
DBus in the Mumble client
The Mumble client itself can also be controlled over DBus. At the moment the following functionality is exposed: