From a658abc95fc63ab42364ffb0587ce046d1ddce52 Mon Sep 17 00:00:00 2001 From: Michael Kroes Date: Sat, 8 Oct 2016 20:35:19 +0200 Subject: [PATCH] Fix status checks for ufw when the system doesn't support iptables (#961) --- CHANGELOG.md | 1 + management/status_checks.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85693229..d1750be0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ In Development Control panel: * Remove recommendations for Certificate Providers +* Status checks failed if the system doesn't support iptables v0.20 (September 23, 2016) -------------------------- diff --git a/management/status_checks.py b/management/status_checks.py index 4077066a..f138b5e9 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -169,8 +169,15 @@ def run_system_checks(rounded_values, env, output): check_free_memory(rounded_values, env, output) def check_ufw(env, output): - ufw = shell('check_output', ['ufw', 'status']).splitlines() + code, ufw = shell('check_output', ['ufw', 'status'], trap=True) + if code != 0: + # The command failed, it's safe to say the firewall is disabled + output.print_warning("""The firewall is not working on this machine. An error was received + while trying to check the firewall. To investigate run 'sudo ufw status'.""") + return + + ufw = ufw.splitlines() if ufw[0] == "Status: active": not_allowed_ports = 0 for service in get_services():