6 if (len(sys.argv) < 4):
7 print "Usage: %s <type> ... " % (sys.argv[0])
8 print " type: openconnect"
9 print " <name> <host> <domain> <cookie> [servercert]"
10 print " type: openvpn"
11 print " <name> <host> <domain> <cafile> <certfile> <keyfile>"
14 bus = dbus.SystemBus()
16 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
17 "org.moblin.connman.Manager")
19 print "Attempting to connect service %s" % (sys.argv[3])
21 if sys.argv[1] == "openconnect":
22 if (len(sys.argv) > 6):
23 path = manager.ConnectProvider(({ "Type": "openconnect",
26 "VPN.Domain": sys.argv[4],
27 "OpenConnect.Cookie": sys.argv[5],
28 "OpenConnect.ServerCert": sys.argv[6]}))
30 path = manager.ConnectProvider(({ "Type": "openconnect",
33 "VPN.Domain": sys.argv[4],
34 "OpenConnect.Cookie": sys.argv[5]}))
35 elif sys.argv[1] == "openvpn":
36 path = manager.ConnectProvider(({ "Type": "openvpn",
39 "VPN.Domain": sys.argv[4],
40 "OpenVPN.CACert": sys.argv[5],
41 "OpenVPN.Cert": sys.argv[6],
42 "OpenVPN.Key": sys.argv[7]}))
44 print "Unknown VPN type"
47 print "VPN service path is %s" %(path)