pangdudu-ruby-dbus 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +782 -0
- data/NEWS +31 -0
- data/README +53 -0
- data/examples/gdbus/gdbus +255 -0
- data/examples/gdbus/gdbus.glade +184 -0
- data/examples/gdbus/launch.sh +4 -0
- data/examples/no-introspect/nm-test.rb +21 -0
- data/examples/no-introspect/tracker-test.rb +16 -0
- data/examples/rhythmbox/playpause.rb +25 -0
- data/examples/service/call_service.rb +25 -0
- data/examples/service/service_newapi.rb +51 -0
- data/examples/simple/call_introspect.rb +34 -0
- data/examples/utils/listnames.rb +11 -0
- data/examples/utils/notify.rb +19 -0
- data/lib/dbus/auth.rb +10 -92
- data/lib/dbus/bus.rb +59 -84
- data/lib/dbus/introspect.rb +2 -2
- data/lib/dbus.rb +2 -8
- metadata +34 -26
- data/README.rdoc +0 -111
- data/config/remote.session.dbus.conf +0 -39
- data/config/start_dbus_session.sh +0 -2
- data/test/simple_socket_test.rb +0 -27
data/README.rdoc
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
= Ruby D-Bus -> ffwd
|
2
|
-
|
3
|
-
Ruby D-Bus provides an implementation of the D-Bus protocol such that the
|
4
|
-
D-Bus system can be used in the Ruby programming language.
|
5
|
-
|
6
|
-
|
7
|
-
This is my personal dev-fork of mvidners upstream.
|
8
|
-
|
9
|
-
If you'd like to contrib to this fork, let me know.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Most of my work here is actually for another project: http://github.com/pangdudu/robots/tree/master
|
14
|
-
|
15
|
-
I might also start writing a less ugly version of: http://github.com/pangdudu/ruby-dbus-daemon/tree/master
|
16
|
-
|
17
|
-
If you know of a nice custom-dbus-daemon let me know. Still thinking about writing
|
18
|
-
a dbus spec compliant server/daemon implementation in (pure) Ruby, so that I can
|
19
|
-
play around with the network and authentification more easily.
|
20
|
-
|
21
|
-
Oki, will clean up a little now. :)
|
22
|
-
|
23
|
-
Peace.
|
24
|
-
|
25
|
-
== Requirements
|
26
|
-
|
27
|
-
* Ruby 1.8 (>= 1.8.6?)
|
28
|
-
|
29
|
-
== Installation
|
30
|
-
|
31
|
-
sudo gem install pangdudu-ruby-dbus --source=http://gems.github.com
|
32
|
-
|
33
|
-
== Features
|
34
|
-
|
35
|
-
Ruby D-Bus currently supports the following features:
|
36
|
-
|
37
|
-
* Connecting to local buses.
|
38
|
-
* Accessing remote services, objects and interfaces.
|
39
|
-
* Invoking methods on remote objects synchronously and asynchronously.
|
40
|
-
* Catch signals on remote objects and handle them via callbacks.
|
41
|
-
* Remote object introspection.
|
42
|
-
* Walking object trees.
|
43
|
-
* Creating services and registering them on the bus.
|
44
|
-
* Exporting objects with interfaces on a bus for remote use.
|
45
|
-
* Rubyish D-Bus object and interface syntax support that automatically
|
46
|
-
allows for introspection.
|
47
|
-
* Emitting signals on exported objects.
|
48
|
-
|
49
|
-
* Connection to a local or remote bus over TCP/IP
|
50
|
-
* Authentification mechanisms working now: External,CookieSHA1
|
51
|
-
|
52
|
-
== Usage
|
53
|
-
|
54
|
-
=== Basics:
|
55
|
-
|
56
|
-
View a tutorial online on http://trac.luon.net/data/ruby-dbus/tutorial/.
|
57
|
-
|
58
|
-
|
59
|
-
=== TCP/Remote stuff:
|
60
|
-
|
61
|
-
Take a look at 'config/remote.session.dbus.conf' and start 'config/start_dbus_session.sh'.
|
62
|
-
|
63
|
-
You can now try and run one of the tests e.g. 'test/simple_socket_test.rb'.
|
64
|
-
|
65
|
-
|
66
|
-
=== Problems you'll have with 'CookieSHA1' when using it remotely:
|
67
|
-
|
68
|
-
Unless we [including you :)] write a funkier SASL authentification mechanism that
|
69
|
-
makes sense when using it over-wire, we're stuck with the cookie auth.
|
70
|
-
|
71
|
-
Works like this:
|
72
|
-
|
73
|
-
There is a file in '~/.dbus-keyrings' named 'org_freedesktop_general'.
|
74
|
-
It is '-rw-------' so that only you can read it (if you change the permissions,
|
75
|
-
dbus-daemon will most likely ignore the file leaving you with 'External', which is
|
76
|
-
even worse remotely). It's kind of a secret key you use to auth against yourself
|
77
|
-
later on.
|
78
|
-
|
79
|
-
If you take a look at 'dbus/auth.rb line 40+' you'll see the problem:
|
80
|
-
|
81
|
-
# Search cookie file for id
|
82
|
-
path = File.join(ENV['HOME'], '.dbus-keyrings', context)
|
83
|
-
|
84
|
-
So if you're starting 'config/start_dbus_session.sh' on one host and 'config/start_dbus_session.sh'
|
85
|
-
on another one, you'll need to make sure that the content in '~/.dbus-keyrings/org_freedesktop_general'
|
86
|
-
is the same on both machines, in order for the 'CookieSHA1' auth to work.
|
87
|
-
|
88
|
-
Not cool. I can think of hacks with nfs,smb or fuse:sshfs making it less
|
89
|
-
painful to use.
|
90
|
-
|
91
|
-
The file content also get's updated every 5 minutes (when a client fails to auth etc.).
|
92
|
-
Making copy and paste from one shell to another very frolic.
|
93
|
-
|
94
|
-
To sum it up:
|
95
|
-
|
96
|
-
Today it's acceptable to use it like this, but until next week we'll need an easy
|
97
|
-
auth mechanism that works on the wire.
|
98
|
-
|
99
|
-
|
100
|
-
more infos:
|
101
|
-
http://dbus.freedesktop.org/doc/dbus-specification.html#auth-mechanisms
|
102
|
-
http://lists.freedesktop.org/archives/dbus/2007-June/008067.html
|
103
|
-
|
104
|
-
Booyaa.
|
105
|
-
|
106
|
-
== License
|
107
|
-
|
108
|
-
Ruby D-Bus is free software; you can redistribute it and/or modify it
|
109
|
-
under the terms of the GNU Lesser General Public License as published by the
|
110
|
-
Free Software Foundation; either version 2.1 of the License, or (at
|
111
|
-
your option) any later version.
|
@@ -1,39 +0,0 @@
|
|
1
|
-
<!-- This configuration file controls the per-user-login-session message bus.
|
2
|
-
Add a session-local.conf and edit that rather than changing this
|
3
|
-
file directly. -->
|
4
|
-
|
5
|
-
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
|
6
|
-
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
7
|
-
<busconfig>
|
8
|
-
<!-- Our well-known bus type, don't change this -->
|
9
|
-
<type>session</type>
|
10
|
-
|
11
|
-
<!-- If we fork, keep the user's original umask to avoid affecting
|
12
|
-
the behavior of child processes. -->
|
13
|
-
<keep_umask/>
|
14
|
-
|
15
|
-
<!-- <allow_anonymous/> -->
|
16
|
-
|
17
|
-
<!-- Listen to everything on tcp! -->
|
18
|
-
<listen>tcp:host=0.0.0.0,port=2687,family=ipv4</listen>
|
19
|
-
<!-- Listen on socket at this file location -->
|
20
|
-
<listen>unix:path=/tmp/socket_test_session_bus_socket</listen>
|
21
|
-
|
22
|
-
<standard_session_servicedirs />
|
23
|
-
|
24
|
-
<policy context="default">
|
25
|
-
<!-- Allow everything to be sent -->
|
26
|
-
<allow send_destination="*" eavesdrop="true"/>
|
27
|
-
<!-- Allow everything to be received -->
|
28
|
-
<allow eavesdrop="true"/>
|
29
|
-
<!-- Allow anyone to own anything -->
|
30
|
-
<allow own="*"/>
|
31
|
-
</policy>
|
32
|
-
|
33
|
-
<!-- raise the service start timeout to 40 seconds as it can timeout
|
34
|
-
on the live cd on slow machines -->
|
35
|
-
<limit name="service_start_timeout">60000</limit>
|
36
|
-
|
37
|
-
<include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
|
38
|
-
|
39
|
-
</busconfig>
|
data/test/simple_socket_test.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'rofl'
|
5
|
-
require 'dbus'
|
6
|
-
|
7
|
-
=begin
|
8
|
-
puts "NOW LISTING SYSTEM BUS:\n"
|
9
|
-
|
10
|
-
#show services on system bus
|
11
|
-
sysbus = DBus::SystemBus.instance
|
12
|
-
puts "\tsystem bus - listnames:"
|
13
|
-
sysbus.proxy.ListNames[0].each { |name| puts "\t\tservice: #{name}" } unless sysbus.nil?
|
14
|
-
=end
|
15
|
-
#test sockets
|
16
|
-
|
17
|
-
puts "NOW LISTING SESSION BUS:\n"
|
18
|
-
|
19
|
-
#show services on a tcp session bus
|
20
|
-
#socket_name = "unix:path=/tmp/socket_test_session_bus_socket" #look at: config/remote.session.dbus.conf
|
21
|
-
#socket_name = "tcp:host=0.0.0.0,port=2687,family=ipv4" #look at: config/remote.session.dbus.conf
|
22
|
-
socket_name = "tcp:host=10.11.12.13,port=2687,family=ipv4" #look at: config/remote.session.dbus.conf
|
23
|
-
dlog "\tsession socket name: #{socket_name}"
|
24
|
-
DBus.const_set("SessionSocketName", socket_name) #overwrite the modules constant
|
25
|
-
sesbus = DBus::SessionBus.instance
|
26
|
-
dlog "\tsession bus - listnames:"
|
27
|
-
sesbus.proxy.ListNames[0].each { |name| dlog "\t\tservice: #{name}" } unless sesbus.nil?
|