summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/vpn/process.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-06-08 15:36:37 -0700
committerKali Kaneko (leap communications) <kali@leap.se>2017-06-09 00:48:40 +0200
commita003e13cec2c44160b46047d0fee8d52dfc6253f (patch)
tree6322f118707e5ce5da435873744024eee9afb3d6 /src/leap/bitmask/vpn/process.py
parent6f961fc09dd633d0bcf5397787139c0032e0661e (diff)
[bug] make openvpn and firewall able to launch
with these fixes, I'm able to finally launch openvpn and firewall on osx. :) all that's left for a minimum vpn release is packaging and installing all the helpers in the proper place.
Diffstat (limited to 'src/leap/bitmask/vpn/process.py')
-rw-r--r--src/leap/bitmask/vpn/process.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/leap/bitmask/vpn/process.py b/src/leap/bitmask/vpn/process.py
index 895cd0a2..844cd0ff 100644
--- a/src/leap/bitmask/vpn/process.py
+++ b/src/leap/bitmask/vpn/process.py
@@ -50,6 +50,10 @@ class _VPNProcess(protocol.ProcessProtocol, _management.VPNManagement):
log = Logger()
+ # HACK - reactor is expected to set this up when the process is spawned.
+ # should try to get it from within this class.
+ pid = None
+
# TODO do we really need the vpnconfig/providerconfig objects in here???
def __init__(self, vpnconfig, providerconfig, socket_host, socket_port,
@@ -183,6 +187,9 @@ class _VPNProcess(protocol.ProcessProtocol, _management.VPNManagement):
# launcher
+ def preUp(self):
+ pass
+
def getCommand(self):
"""
Gets the vpn command from the aproppriate launcher.
@@ -252,11 +259,19 @@ elif IS_MAC:
This is a workaround to allow the state machine to be notified when
openvpn process is spawned by the privileged helper.
"""
+
def setupHelper(self):
+ # TODO use get_vpn_launcher instead
self.helper = darwin.HelperCommand()
+ def preUp(self):
+ self.setupHelper()
+ cmd = self.getVPNCommand()
+ self.helper.send('openvpn_start %s' % ' '.join(cmd))
+
def connectionMade(self):
- VPNProcess.connectionMade(self)
+ super(_VPNProcess, self).connectionMade()
+ self.setupHelper()
reactor.callLater(2, self.registerPID)
def registerPID(self):
@@ -268,7 +283,8 @@ elif IS_MAC:
self.helper.send(cmd)
def getVPNCommand(self):
- return VPNProcess.getCommand(self)
+ vpncmd = _VPNProcess.getCommand(self)
+ return vpncmd
def getCommand(self):
canary = '''import sys, signal, time