summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/services
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-05-19 17:51:58 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-05-21 15:31:20 -0300
commitbaeb605e53c2e8a7dceee86035f6d4cc6b49e131 (patch)
treed4ee942f17283d90601ff0a99888e90f19773b1e /src/leap/bitmask/services
parent10cf84e5f8be978574b7a7e1a145903b37801753 (diff)
Improve wait and quit process.
Refactor logic from backend to the vpnprocess.
Diffstat (limited to 'src/leap/bitmask/services')
-rw-r--r--src/leap/bitmask/services/eip/vpnprocess.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/leap/bitmask/services/eip/vpnprocess.py b/src/leap/bitmask/services/eip/vpnprocess.py
index 734b88df..81eac6d9 100644
--- a/src/leap/bitmask/services/eip/vpnprocess.py
+++ b/src/leap/bitmask/services/eip/vpnprocess.py
@@ -17,6 +17,7 @@
"""
VPN Manager, spawned in a custom processProtocol.
"""
+import commands
import logging
import os
import shutil
@@ -232,6 +233,17 @@ class VPN(object):
BM_ROOT, "firewall", "start"] + gateways)
return True if exitCode is 0 else False
+ def is_fw_down(self):
+ """
+ Return whether the firewall is down or not.
+
+ :rtype: bool
+ """
+ BM_ROOT = linuxvpnlauncher.LinuxVPNLauncher.BITMASK_ROOT
+ fw_up_cmd = "pkexec {0} firewall isup".format(BM_ROOT)
+ fw_is_down = lambda: commands.getstatusoutput(fw_up_cmd)[0] == 256
+ return fw_is_down()
+
def _tear_down_firewall(self):
"""
Tear the firewall down using the privileged wrapper.