Request for opinions
@4u
fd4u at vplace.de
Sat Dec 13 03:22:09 PST 2008
Hi,
first of all I wanted to inform you that the PHP d-bus binding isn't
dead yet. I just added support for interfaces and the DBUS_COOKIE_SHA1
authentification.
It needs some tests but now PHP d-bus code looks similar to Python :)
---
$dbus_session = new direct_dbus_session ("unix:///tmp/dbus","",true);
$dbus_session->dclass_connect ();
$dbusinterface = $dbus_session->dclass_get_interface
("/org/freedesktop/Hal/Manager","org.freedesktop.Hal.Manager","org.freedesktop.Hal");
print_r ($dbusinterface->dclass_get_methods ());
// Do a HAL method call
print_r ($dbusinterface->GetAllDevices ());
$dbus_session->dclass_disconnect ();
---
Unfortunately in PHP most d-bus calls will be based on HTTP somehow. For
that reason I want to write a daemon application in Python that should
work as a proxy between the PHP d-bus script and the system (and
session) d-bus instance. It will use a similar cookie authentification
as DBUS_COOKIE_SHA1 (you have to read a file and use the provided key to
generate a SHA256-HMAC response for the file content).
Does this sound secure enough (based that you may access the system bus
from the internet)?
Right after the connection is established you will use the D-BUS
protocol to call methods in the python proxy or it may sent messages
received to the "external" system or session bus. The first call you
will have to do is something like "my session ID is xyz" (which must be
maintained in the PHP script somehow). This should provide a cache
mechanism for the python proxy. You may close and reopen the connection
from PHP to the proxy and receive all responses (for async method calls
for example) you "lost" earlier because the PHP script ended.
Well ... that the theory - I think it can be used with TCP as well as
sockets and it may be used with other languages as well. But I'm not
sure if this is a good design idea to add yet another daemon application
(D-Bus itself is a daemon application as well ...).
What do you think?
Best regards,
@4u
More information about the dbus
mailing list