Skip to content

Commit

Permalink
Refactor firewall rules creation
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Mar 20, 2024
1 parent 693a45b commit 5c7fdbc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions imageroot/bin/firewall-rules
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

action=$1
if [[ $action == 'create-ipset' ]]; then
if [[ ! -f /etc/firewalld/ipsets/crowdsec-blacklists.xml ]]; then
firewall-cmd --permanent --new-ipset=crowdsec-blacklists --type=hash:ip --option="timeout=0" --option="maxelem=150000"
if ! ipset -L crowdsec-blacklists >/dev/null 2>&1; then
ipset create crowdsec-blacklists hash:ip timeout 0 maxelem 150000
fi
if [[ ! -f /etc/firewalld/ipsets/crowdsec6-blacklists.xml ]]; then
firewall-cmd --permanent --new-ipset=crowdsec6-blacklists --option=family=inet6 --type=hash:ip --option="timeout=0" --option="maxelem=150000"
if ! ipset -L crowdsec6-blacklists >/dev/null 2>&1; then
ipset create crowdsec6-blacklists hash:ip family inet6 timeout 0 maxelem 150000
fi
firewall-cmd --reload
elif [[ $action == 'add-rule' ]]; then
Expand Down

0 comments on commit 5c7fdbc

Please sign in to comment.