On Tue, 2009-02-10 at 11:26 +0200, Tambet Ingo wrote: > On Mon, Feb 9, 2009 at 18:47, Dan Williams <[email protected]> wrote: > > On Mon, 2009-02-09 at 11:37 +1100, David Guest wrote: > >> I am attempting to create a dispatcher script to autostart an OpenVPN > >> connection, I am stuck on how to get the vpn to connect through dbus. > >> Would anyone have a working example, preferably in python but any > >> language will do? > >> > >> I am running Ubuntu 8.10 (NetworkManager 0.7), I have found at least one > >> example on the web but it appears to be for an earlier dbus Network > >> Manager API version as I get errors when running them. > >> > >> I have looked at the 0.7 dbus API but can't figure out what to send to > >> the org.freedesktop.NetworkManager.VPN.Plugin.Connect method or even if > >> this is the right approach? > > > > That's actually the wrong approach here; what you want to do is tell > > _NetworkManager_ to connect the VPN connection. So you'll be using the > > org.freedesktop.NetworkManager.ActivateConnection method, and pass it > > the service name of the settings service (either user or system) that > > provides the connection, the object path of the connection as exported > > by that settings service, and the device you'd like to activate the VPN > > on (which would be the object path of the interface your script got > > called with, probably). > > This functionality is very often requested and a dispatcher script to > do that is quite hard to implement. I wrote a script to do that, see > the attachment. It needs some configuration first: The UUID of the VPN > connection you'd like to get automatically activated, the UUID of the > connection with which you want your VPN automatically activated, and > the UID of the user who has the VPN connection defined. For the first > two, just run the script without any arguments and it'll print out all > known connections and their UUIDS. Find your UID with `id -u`. After > changing these variables in the beginning of the script with your > data, copy it to /etc/NetworkManager/dispatcher.d/ and make sure it's > executable. > > Dan, maybe it makes sense to add some example dispatcher scripts to > the tree, starting with this one? There's a lot you can do with these, > change active printers, proxies, mounts, ..., and many people have no > idea how useful they can be.
Sure! Feel free to add it. Note that git as of this morning allows root to activate user connections as well; so the comment in the script is somewhat misleading. Dan _______________________________________________ NetworkManager-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/networkmanager-list
