( makgab | 2020. 10. 30., p - 19:41 )

Szerkesztve: 2020. 10. 30., p - 20:10

Elvileg firewalld-hez ez kell:

https://www.linode.com/community/questions/11143/top-tip-firewalld-and-…

 

# create blacklist

firewall-cmd --permanent --new-ipset=blacklist --type=hash:net --option=family=inet --option=hashsize=4096 --option=maxelem=200000

wget http://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz
tar -vxzf all-zones.tar.gz

# add cn.zone to blacklist
firewall-cmd --permanent --ipset=blacklist --add-entries-from-file=./cn.zone

# add custom entry:
# firewall-cmd --permanent --ipset=blacklist --add-entry=$1
# firewall-cmd --ipset=blacklist --add-entry=$1

# redirect blacklist to drop zone
firewall-cmd --permanent --zone=drop --add-source=ipset:blacklist
firewall-cmd --reload