Improved Systemwide Firewall Disable Logic
This commit is contained in:
parent
c4ffe9be3c
commit
208cb29f77
1 changed files with 8 additions and 8 deletions
|
|
@ -57,24 +57,24 @@ def turn_on_firewall(profile_id: str, process_output: str) -> Result:
|
||||||
|
|
||||||
# This raises errors on failure.
|
# This raises errors on failure.
|
||||||
def check_and_kill_firewall():
|
def check_and_kill_firewall():
|
||||||
firewall_status = killswitch.status()
|
firewall_on = killswitch.status()
|
||||||
logger.info(f"Inside check_and_kill_firewall the firewall status is {firewall_status}")
|
logger.info(f"Inside check_and_kill_firewall the firewall status is {firewall_on}")
|
||||||
|
|
||||||
logger.info(f"Terminate connection ran check_and_kill_firewall which evaluated the status as {firewall_status}")
|
logger.info(f"Terminate connection ran check_and_kill_firewall which evaluated the status as {firewall_on}")
|
||||||
|
|
||||||
# is it even armed? if not, get lost,
|
# is it even armed? if not, get lost,
|
||||||
if firewall_status == "on":
|
if firewall_on:
|
||||||
# if it's armed, kill it,
|
# if it's armed, kill it,
|
||||||
logger.info(f"Killing the firewall")
|
logger.info(f"Killing the firewall")
|
||||||
firewall_results = killswitch.disarm()
|
disable_result_object = killswitch.disarm()
|
||||||
|
|
||||||
# did that work?
|
# did that work?
|
||||||
if firewall_results.valid:
|
if disable_result_object.valid:
|
||||||
logger.info(f"We disabled the firewall correctly.")
|
logger.info(f"We disabled the firewall correctly.")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
logger.error(f"[FIREWALL] CRITICAL ISSUE with the Firewall being disabled: {firewall_results.message}")
|
logger.error(f"[FIREWALL] CRITICAL ISSUE with the Firewall being disabled: {disable_result_object.message}")
|
||||||
error_msg = f"Firewall couldn't be disabled: {firewall_results.message}"
|
error_msg = f"Firewall couldn't be disabled: {disable_result_object.message}"
|
||||||
raise ConnectionTerminationError(error_msg)
|
raise ConnectionTerminationError(error_msg)
|
||||||
else:
|
else:
|
||||||
logger.info("We are skipping disabling the firewall, because it's already off.")
|
logger.info("We are skipping disabling the firewall, because it's already off.")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue