diff --git a/authserv/app_common.py b/authserv/app_common.py index de8a4faae1d0c725eb46149670476188e97880a8..788b3a2fd3f5c94244b73aafb999945603363781 100644 --- a/authserv/app_common.py +++ b/authserv/app_common.py @@ -95,6 +95,7 @@ def _do_auth(mc, username, service, shard, password, otp_token, source_ip, bl.auth_failure('u', username) if (source_ip and not whitelisted(source_ip, current_app.config.get('SOURCE_IP_WHITELIST'))): - bl.auth_failure('ip', source_ip) + if bl.auth_failure('ip', source_ip): + current_app.logger.info('blacklisted IP %s', source_ip) return (retval, errmsg, out_shard) diff --git a/authserv/ratelimit.py b/authserv/ratelimit.py index 43529b61ea8c2c24533456df43768584b06ce4e8..d549ccacf4482ab33402343909d972f9d1a14d46 100644 --- a/authserv/ratelimit.py +++ b/authserv/ratelimit.py @@ -63,7 +63,7 @@ class RateLimit(object): except: result = None if result is None: - # Memcache is failing. + # Memcache is failing. Fail open. return True return result <= self.count @@ -98,6 +98,8 @@ class BlackList(object): key = _tostr(self.prefix + key) if not self.rl.check(mc, key): mc.set(key, 'true', time=self.ttl) + return True + return False class AuthBlackList(object): @@ -116,4 +118,4 @@ class AuthBlackList(object): if not value: return key = key_sep.join([tag, value]) - self.blacklist.incr(self.mc, key) + return self.blacklist.incr(self.mc, key) diff --git a/debian/changelog b/debian/changelog index 79b1ec5488e4f2d06de25c247401c7cf565095fe..6bf1f0fd873dce75a7e2c84a2b346282272bb7c0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +authserv (0.1.2) unstable; urgency=medium + + * Fixed memcache connection errors. + + -- Autistici/Inventati <debian@autistici.org> Thu, 06 Jul 2017 22:16:55 +0100 + authserv (0.1.1) unstable; urgency=medium * Systemd support.