summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/services/eip
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-05-21 18:14:27 -0300
committerTomás Touceda <chiiph@leap.se>2014-05-21 18:14:27 -0300
commit2ba353fbc87eb81dde2f169b8facdb2104107f70 (patch)
treebff5220bc7e0f89febd053bc8b924b613f00234d /src/leap/bitmask/services/eip
parentfcdd3f8c1c2689798a8ffb8cff7313bc887a2377 (diff)
parenta61889110118d04703b023936048b44517947516 (diff)
Merge remote-tracking branch 'refs/remotes/ivan/feature/refactor-soledad-to-backend' into develop
Diffstat (limited to 'src/leap/bitmask/services/eip')
-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.