updated nftables state
This commit is contained in:
parent
abe739eb94
commit
891bf239ae
@ -5,11 +5,12 @@ from urllib.request import urlopen, Request
|
|||||||
|
|
||||||
|
|
||||||
def get_ips(url="https://ipbl.paulbsd.com"):
|
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"
|
fullurl = f"{url}/ips"
|
||||||
req = Request(method="GET", url=fullurl)
|
req = Request(method="GET", url=fullurl)
|
||||||
res = urlopen(req)
|
res = urlopen(req)
|
||||||
results = json.loads(res.read())
|
results = json.loads(res.read())
|
||||||
|
ips = [i["ip"] for i in results]
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
return results
|
return ips
|
||||||
return None
|
return None
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{% set blackips = salt["bl.get_ips"]() %}
|
{% set blackips = salt["bl.get_ips"]() %}
|
||||||
|
|
||||||
{% if blackips|length > 0 %}
|
{% if blackips|length > 0 %}
|
||||||
define blacklist = { {{ blackips.join(",") }} }
|
define blacklist = { {{ blackips|join(", ") }} }
|
||||||
{% else %}
|
{% else %}
|
||||||
define blacklist = { 127.255.255.255 }
|
define blacklist = { 127.255.255.255 }
|
||||||
{% endif %}
|
{% endif %}
|
Loading…
Reference in New Issue
Block a user