2

My server uses Centos8 quite recently installed (~1 year).

After trying to ban an IP:

firewall-cmd --permanent --zone=extz --add-rich-rule='rule family="ipv4" source address="49.88.112.70" drop'

My system seams to be corrupt:

# firewall-cmd --reload
Error: COMMAND_FAILED: Direct: '/usr/sbin/iptables-restore -w -n' failed: iptables-restore v1.4.21: Set blacklist doesn't exist.

Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

But the restart of the service works without error messages:

# systemctl restart firewalld

If would like (besides to understand what happened)

  1. Either to restore the old situation (a --remove-rich-rule does not seam to be enough)
  2. or make the banning method work (somehow add a set with ipset?)
3
  • 1
    Are you sure this is CentOS 8? This distribution does not use iptables. Commented Jun 13, 2020 at 14:01
  • @MichaelHampton I installed it last year and I could have bet any amount of money, but you are right: CentOS Linux release 7.8.2003 (Core) Commented Jun 14, 2020 at 8:58
  • @A.B, yes, CentOS Linux release 7.8.2003 (Core) Commented Jun 14, 2020 at 8:59

1 Answer 1

0

As documented here we create the blacklist set:

# sudo yum install ipset # was already installed
# sudo ipset create blacklist hash:ip hashsize 4096
# firewall-cmd --reload
success

As pointed out by @MichaelHampto in the comments, the error arrises probably from a previous (partial) attempt to reach the same goal (to block IPs); something like the the following: drop ip blacklist with firewalld centos 7

The solution of the error should be correct but is not related with the rich rules.

2
  • Hmm. The rich rule you referred to doesn't create or reference an ipset blacklist (or any ipset). Likely the problem is elsewhere, and only showed up when you reloaded firewalld. Commented Jun 14, 2020 at 15:25
  • @MichaelHampton, I probably tried something else before using the rich rules to reach the same goal. I edit the answer. Commented Jun 14, 2020 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .