From 3b8b9c4acf3834643ae97ac2efa54ed251a1cc8d Mon Sep 17 00:00:00 2001 From: "Sergey G. Brester" Date: Tue, 6 Feb 2018 17:02:23 +0100 Subject: [PATCH 1/2] README: extended systemd-prerequirements: python-systemd package --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 84eb33027..89ada1a18 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,8 @@ Optional: - [pyinotify >= 0.8.3](https://github.com/seb-m/pyinotify) - Linux >= 2.6.13 - [gamin >= 0.0.21](http://www.gnome.org/~veillard/gamin) -- [systemd >= 204](http://www.freedesktop.org/wiki/Software/systemd) +- [systemd >= 204](http://www.freedesktop.org/wiki/Software/systemd) and python bindings: + - [python-systemd package](https://www.freedesktop.org/software/systemd/python-systemd/index.html) - [dnspython](http://www.dnspython.org/) To install, just do: From 98f4d70371c4d168df86af2653f314ea6ad60a0d Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 6 Feb 2018 18:00:50 +0100 Subject: [PATCH 2/2] fixed cymru-info resolved to answers with multiple data-records (as comma-separated list now) --- fail2ban/server/banmanager.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fail2ban/server/banmanager.py b/fail2ban/server/banmanager.py index 1275d3a42..a341a7af7 100644 --- a/fail2ban/server/banmanager.py +++ b/fail2ban/server/banmanager.py @@ -166,15 +166,21 @@ class BanManager: answers = resolver.query(question, "TXT") if not answers: raise ValueError("No data retrieved") + asns = set() + countries = set() + rirs = set() for rdata in answers: asn, net, country, rir, changed =\ [answer.strip("'\" ") for answer in rdata.to_text().split("|")] asn = self.handleBlankResult(asn) country = self.handleBlankResult(country) rir = self.handleBlankResult(rir) - return_dict["asn"].append(self.handleBlankResult(asn)) - return_dict["country"].append(self.handleBlankResult(country)) - return_dict["rir"].append(self.handleBlankResult(rir)) + asns.add(self.handleBlankResult(asn)) + countries.add(self.handleBlankResult(country)) + rirs.add(self.handleBlankResult(rir)) + return_dict["asn"].append(', '.join(sorted(asns))) + return_dict["country"].append(', '.join(sorted(countries))) + return_dict["rir"].append(', '.join(sorted(rirs))) except dns.resolver.NXDOMAIN: return_dict["asn"].append("nxdomain") return_dict["country"].append("nxdomain")