Centos – How to remove ipset entry with timeout from firewalld using firewall-cmd

centosfirewallfirewalld

Using Centos 8 with firewalld. I created 2 ipsets, one permanent, one with timeout:

firewall-cmd --permanent --new-ipset=blacklist_temp --type=hash:ip --option=timeout=86400
firewall-cmd --permanent --new-ipset=blacklist --type=hash:ip
firewall-cmd --reload

# ipset list
Name: blacklist_temp
Type: hash:ip
Revision: 4
Header: family inet hashsize 1024 maxelem 65536 timeout 86400
Size in memory: 120
References: 0
Number of entries: 0
Members:

Name: blacklist
Type: hash:ip
Revision: 4
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 120
References: 0
Number of entries: 0
Members:

I then redirect traffic to drop zone:

firewall-cmd --zone=drop --add-source=ipset:blacklist_temp
firewall-cmd --zone=drop --add-source=ipset:blacklist

And now to the problem:

# firewall-cmd --ipset=blacklist --add-entry=1.2.3.4
success
# firewall-cmd --ipset=blacklist_temp --add-entry=5.6.7.8
success
# firewall-cmd --ipset=blacklist --remove-entry=1.2.3.4
success
# firewall-cmd --ipset=blacklist_temp --remove-entry=5.6.7.8
Warning: NOT_ENABLED: '5.6.7.8' not in 'blacklist_temp'
success

I cannot remove IP from ipset with timout

# ipset list
Name: blacklist_temp
Type: hash:ip
Revision: 4
Header: family inet hashsize 1024 maxelem 65536 timeout 86400
Size in memory: 216
References: 0
Number of entries: 1
Members:
5.6.7.8 timeout 86376

Name: blacklist
Type: hash:ip
Revision: 4
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 120
References: 0
Number of entries: 0
Members:

Any ideas how to achieve removal using firewall-cmd? Is this a bug?

Best Answer

Well as it says in the official firewalld docs,

Adding an entry to an ipset with option timeout is permitted, but these entries are not tracked by firewalld.

I guess that answers my question.