diff --git a/states/_modules/bl.py b/states/_modules/bl.py index 7d169d7..f247a00 100644 --- a/states/_modules/bl.py +++ b/states/_modules/bl.py @@ -5,11 +5,12 @@ from urllib.request import urlopen, Request def get_ips(url="https://ipbl.paulbsd.com"): - """get_jobs fetch jobs from dkron""" + """get_ips fetch ips blacklists from ipbl""" fullurl = f"{url}/ips" req = Request(method="GET", url=fullurl) res = urlopen(req) results = json.loads(res.read()) + ips = [i["ip"] for i in results] if res.status == 200: - return results + return ips return None diff --git a/states/nftables/blacklist.nft.j2 b/states/nftables/blacklist.nft.j2 index 2eaf40f..deed150 100644 --- a/states/nftables/blacklist.nft.j2 +++ b/states/nftables/blacklist.nft.j2 @@ -2,7 +2,7 @@ {% set blackips = salt["bl.get_ips"]() %} {% if blackips|length > 0 %} -define blacklist = { {{ blackips.join(",") }} } +define blacklist = { {{ blackips|join(", ") }} } {% else %} define blacklist = { 127.255.255.255 } {% endif %} \ No newline at end of file