diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2017-02-04 17:01:25 +0100 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-02-23 00:40:37 +0100 |
commit | 701fe5ebc70fb49bb32e81e6d6605f27ad09925b (patch) | |
tree | 0763df29131f3abe4604fc3626f51ed4360b5ff1 /src/leap/bitmask/vpn/fw | |
parent | 409a4c663ec3c0b4a394fcaa6d4b1c6b527f8522 (diff) |
[feature] parse status
- simple status parsing
- add separate firewall status
- set status for abnormal termination
Diffstat (limited to 'src/leap/bitmask/vpn/fw')
-rw-r--r-- | src/leap/bitmask/vpn/fw/firewall.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/leap/bitmask/vpn/fw/firewall.py b/src/leap/bitmask/vpn/fw/firewall.py index 4335b8e..5eace20 100644 --- a/src/leap/bitmask/vpn/fw/firewall.py +++ b/src/leap/bitmask/vpn/fw/firewall.py @@ -13,7 +13,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# alng with this program. If not, see <http://www.gnu.org/licenses/>. """ Firewall Manager @@ -44,6 +44,7 @@ class FirewallManager(object): :param remotes: the gateway(s) that we will allow :type remotes: list """ + self.status = 'OFF' self._remotes = remotes def start(self, restart=False): @@ -65,7 +66,13 @@ class FirewallManager(object): # FIXME -- use a processprotocol exitCode = subprocess.call(cmd + gateways) - return True if exitCode is 0 else False + + if exitCode == 0: + self.status = 'ON' + return True + else: + self.status = 'OFF' + return False # def tear_down_firewall(self): def stop(self): @@ -78,9 +85,13 @@ class FirewallManager(object): exitCode = subprocess.call(["pkexec", self.BITMASK_ROOT, "firewall", "stop"]) - return True if exitCode is 0 else False + if exitCode == 0: + self.status = 'OFF' + return True + else: + self.status = 'ON' + return False - # def is_fw_down(self): def is_up(self): """ Return whether the firewall is up or not. |