Bug 1569688

Summary: firewall-cmd: sort output of --direct --get-all-rules also by priority
Product: [Fedora] Fedora Reporter: Marcelo Ricardo Leitner <mleitner>
Component: firewalldAssignee: Eric Garver <egarver>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 31CC: egarver, jpopelka, twoerner
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-24 19:28:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Marcelo Ricardo Leitner 2018-04-19 19:37:50 UTC
Currently it seems to sort only by the chain, but by not the rule priority. Sample output:

ipv4 filter FORWARD 95 -i enp3s0 -p tcp -m multiport --dports 3389:3391 -j ACCEPT
ipv4 filter FORWARD 95 -p tcp -d 172.30.0.2 -m multiport --dports 80,443 -j ACCEPT
ipv4 filter FORWARD 70 -i lan -m set --match-set hosts src -j ACCEPT
ipv4 filter FORWARD 75 -i lan -m set --match-set sites dst -p tcp -m multiport --dports 80,443 -j ACCEPT
ipv4 filter FORWARD 50 -i enp2s0 -d 172.0.0.0/8 -j DROP
ipv4 filter FORWARD 100 -i lan -o enp3s0 -j REJECT
ipv4 filter FORWARD 45 -d 172.0.0.0/8 -p tcp -m multiport --dports 80,443 -j ACCEPT

It's tough to find a rule in it. If we also sort by priority:

# firewall-cmd --direct --get-all-rules | sort -k 1,3 -k 4h
ipv4 filter FORWARD 45 -d 172.0.0.0/8 -p tcp -m multiport --dports 80,443 -j ACCEPT
ipv4 filter FORWARD 50 -i enp2s0 -d 172.0.0.0/8 -j DROP
ipv4 filter FORWARD 60 -i enp2s0 -o lan -p tcp -d 192.168.1.250 -j ACCEPT
ipv4 filter FORWARD 70 -i lan -m set --match-set hosts src -j ACCEPT
ipv4 filter FORWARD 70 -i lan -o enp3s0 -p tcp --dport 8017 -j ACCEPT
ipv4 filter FORWARD 70 -i lan -p tcp --dport 21 -j ACCEPT
ipv4 filter FORWARD 75 -i lan -m set --match-set sites dst -p tcp -j ACCEPT
ipv4 filter FORWARD 75 -i lan -m set --match-set direto dst -p tcp -m multiport --dports 80,443 -j ACCEPT
ipv4 filter FORWARD 80 -i lan -p tcp -m multiport --dports 25,465,587,993,995 -o enp3s0 -j ACCEPT
...

Hopefully users won't assume this is the order that it will match. Documentation is clear that there is no guarantee on which rule on rules with same priority will match first.

Comment 1 Jan Kurik 2018-08-14 10:56:43 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 2 Ben Cotton 2019-10-31 20:45:51 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

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 29 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 3 Ben Cotton 2020-11-03 17:22:01 UTC
This message is a reminder that Fedora 31 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-24.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '31'.

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 31 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 4 Ben Cotton 2020-11-24 19:28:57 UTC
Fedora 31 changed to end-of-life (EOL) status on 2020-11-24. Fedora 31 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
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.