This configures the recommended DROP, EDROP, and DROPv6 lists from Spamhaus as ipsets in firewalld. First we copy an empty placeholder ipset to seed firewalld, then we use a shell script to download the real lists and activate them. The same shell script is run daily as a service (update-spamhaus-lists.service) by a systemd timer. I am strictly avoiding any direct ipset commands here because I want to make sure that this works on older hosts where ipsets is used as well as newer hosts that have moved to nftables such as Ubuntu 20.04. So far I have tested this on Ubuntu 16.04, 18.04, and 20.04, but ev- entually I need to abstract the tasks and run them on CentOS 7+ as well. See: https://www.spamhaus.org/drop/
13 lines
216 B
SYSTEMD
13 lines
216 B
SYSTEMD
[Unit]
|
||
Description=Update Spamhaus lists
|
||
|
||
[Timer]
|
||
# Once a day at midnight
|
||
OnCalendar=*-*-* 00:00:00
|
||
# Add a random delay of 0–3600 seconds
|
||
RandomizedDelaySec=3600
|
||
Persistent=true
|
||
|
||
[Install]
|
||
WantedBy=timers.target
|