Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 979485 - [RFE] firewall-cmd should have --direct commands --append-rule and --flush-chain
Summary: [RFE] firewall-cmd should have --direct commands --append-rule and --flush-chain
Alias: None
Product: Fedora
Classification: Fedora
Component: firewalld
Version: 19
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Thomas Woerner
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2013-06-28 16:14 UTC by Edgar Hoch
Modified: 2015-02-17 15:44 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-02-17 15:44:20 UTC
Type: Bug

Attachments (Terms of Use)

Description Edgar Hoch 2013-06-28 16:14:09 UTC
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):

How reproducible:

Steps to Reproduce:
The commands are not documented ("man firewall-cmd") and not implemented (trying these gives an error).

Additional info:
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 -j DROP
firewall-cmd --direct --remove-rule ipv4 filter fail2ban-SSH -s -j DROP

Comment 1 Fedora End Of Life 2015-01-09 18:34:32 UTC
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.

Comment 2 Fedora End Of Life 2015-02-17 15:44:20 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.