Red Hat Bugzilla – Bug 979485
[RFE] firewall-cmd should have --direct commands --append-rule and --flush-chain
Last modified: 2015-02-17 10:44:20 EST
Description of problem:
When I use firewall-cmd --direct commands (for creating an action.d file for fail2ban) I missed the following commands:
--direct --append-rule: It should do the same as "iptables --append".
A workaround for this command is to use a high number of priority with --add-rule, but this is not the same as we cound not be sure what the highest used number is. An extra command would be useful.
--direct --flush-chain: It should do the same as "iptables --flush".
A workaround for this command is to get all rules of a chain and loop over all these rules and remove each of them. An extra command would be useful.
A chain must be empty before it can be removed, so a command that does this is required.
For my use case (to remove a chain that may not be empty) would be an option to --remove-chain to force the removing of a chain even if it is not empty - then the command should first remove all rules (doing the same as the flush command of iptables do) and then remove the chain. I think this option would be useful, but is not a substitute for --flush-chain, because sometimes a chain should be cleared (to fill it with new rules) but not removed.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
The commands are not documented ("man firewall-cmd") and not implemented (trying these gives an error).
I missed some examples for using --direct commands. It would be useful to add some to the manpage. Here are some examples:
firewall-cmd --direct --add-chain ipv4 filter fail2ban-SSH
firewall-cmd --direct --add-rule ipv4 filter fail2ban-SSH 1000 -j RETURN
# A better command would be the following, but this is not implemented currently.
firewall-cmd --direct --append-rule ipv4 filter fail2ban-SSH -j RETURN
firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 1 -m state --state NEW -p tcp --dport 22 -j fail2ban-SSH
firewall-cmd --direct --remove-rule ipv4 filter INPUT_direct -m state --state NEW -p tcp --dport 22 -j fail2ban-SSG
## This command does not work (because firewalld does not flush the chain, only iptables):
firewall-cmd --direct --passthrough ipv4 -F fail2ban-SSH
## This command should be implemented:
firewall-cmd --direct --flush-chain ipv4 fail2ban-SSH
firewall-cmd --direct --remove-chain ipv4 filter fail2ban-SSH
firewall-cmd --direct --get-chains ipv4 filter INPUT_direct
firewall-cmd --direct --add-rule ipv4 filter fail2ban-SSH 1 -s 192.0.2.10 -j DROP
firewall-cmd --direct --remove-rule ipv4 filter fail2ban-SSH -s 192.0.2.10 -j DROP
This message is a notice that Fedora 19 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 19. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 19 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.