Removing invalid values in case they slip through, Issue #109

This commit is contained in:
Daniel Perna 2018-08-09 00:23:52 +02:00
parent bd4d23f4a9
commit e2266672c2

View file

@ -3497,6 +3497,7 @@ def load_settings(settingsfile):
ipaddress.ip_network(net)
except Exception:
LOG.warning("Invalid network in ALLOWED_NETWORKS: %s", net)
ALLOWED_NETWORKS.remove(net)
BANNED_IPS = settings.get("BANNED_IPS", BANNED_IPS)
if BANNED_IPS and not all(BANNED_IPS):
LOG.warning("Invalid value for BANNED_IPS. Using empty list.")
@ -3506,6 +3507,7 @@ def load_settings(settingsfile):
ipaddress.ip_address(banned_ip)
except Exception:
LOG.warning("Invalid IP address in BANNED_IPS: %s", banned_ip)
BANNED_IPS.remove(banned_ip)
BANLIMIT = settings.get("BANLIMIT", BANLIMIT)
DEV = settings.get("DEV", DEV)
IGNORE_PATTERN = settings.get("IGNORE_PATTERN", IGNORE_PATTERN)