Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 929426

Summary: firewalld: forward chain
Product: [Retired] Fedora Documentation Reporter: Frank Ansari <mail>
Component: security-guideAssignee: Nobody's working on this, feel free to take it <nobody>
Status: CLOSED EOL QA Contact: Fedora Docs QA <docs-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: develCC: egarver, mailinglists35, me, nman64, rjones, seleznev.ru, tuju, yann.soubeyrand, zach
Target Milestone: ---   
Target Release: ---   
Hardware: arm   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-07 15:29:47 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:
Attachments:
Description Flags
ip6tables -L -n > ip6tables.conf none

Description Frank Ansari 2013-03-30 13:37:53 UTC
Description of problem:
How can I configure firewalld in a way that ip forwarding (not port forwarding) works?

I checked this documentation 

https://fedoraproject.org/wiki/FirewallD

but I could not figure it out.

I have set this is /etc/sysctl.conf

net.ipv4.conf.all.forwarding = 1
net.ipv6.conf.all.forwarding = 1

and when I stop firewalld the forwarding works.

Version-Release number of selected component (if applicable):
0.2.12

How reproducible:
See below.

Steps to Reproduce:
1. Start firewalld on router
2. Try an ssh connection from public network to another device within the LAN via router
3. 
  
Actual results:
ssh: connect to host xx.xx.xx.xx port 222: Permission denied

Expected results:
ssh connect

Additional info:

Comment 1 Frank Ansari 2013-03-30 13:40:55 UTC
Created attachment 718252 [details]
ip6tables -L -n > ip6tables.conf

Comment 2 Pete Travis 2013-06-17 14:49:08 UTC
Reassigning to the Security Guide component, firewalld will be covered there.

Comment 3 Frank Ansari 2013-09-28 15:54:36 UTC
So far it is still unclear to me how to configure the forward chain. I tried again to find some documentation about it but could not find any.

Everything in the documentations seems to be about how to accept or block incoming traffic. What about how to configure outgoing or forwarding traffic?

Comment 4 Frank Ansari 2013-10-10 08:52:45 UTC
Only solution so far is to add an iptables rule doing something like this:

ip6tables -I FORWARD 7 -p tcp --dport  22 -j ACCEPT;

Is thre no way doing this with firewall-cmd?

Comment 5 Alexander Seleznev 2013-10-10 09:28:43 UTC
(In reply to Frank Ansari from comment #4)
> Only solution so far is to add an iptables rule doing something like this:
> 
> ip6tables -I FORWARD 7 -p tcp --dport  22 -j ACCEPT;
> 
> Is thre no way doing this with firewall-cmd?

Why you don't use this command?

firewall-cmd --direct --add-rule ipv6 filter FORWARD 1 -p tcp --dport  22 -j ACCEPT

Also, under Fedora 20 the "--permanent" key works fine for me.

Comment 6 Frank Ansari 2014-06-09 12:34:34 UTC
Because I did not know this. 

Today I again tried to figure it out and found it.

Also I found I could make it permanent with /etc/firewalld/direct.xml.

<?xml version="1.0" encoding="utf-8"?>
<direct>
   [ <rule ipv="ipv6" table="filter" chain="FORWARD_direct" priority="0"> -p tcp --dport 22 -j ACCEPT </rule> ]
</direct>

This is working.

In this documentation

https://fedoraproject.org/wiki/FirewallD

the "direct" method is mentioned but not the direct.xml file.

The main problem is: how shall one know that you have to check for the keyword "direct" when you want want to do forwarding?

In the documentation you only find "port forwarding" when you search for the keyword "forward". 

Here where I found it:

http://superuser.com/questions/654687/how-to-allow-forwarding-with-firewalld-on-a-fedora-19-router

This was the right clue. Something like this should be added to the documentation.

Comment 7 Mai Ling 2018-06-08 16:05:01 UTC
this is stupid. having to add direct rules is stupid. why does not firewalld offer a native way to add rules to chain FORWARD in table filter?

Comment 8 Mai Ling 2018-06-08 16:12:08 UTC
this is even more stupid. direct rules do not work with interface 'any', you must explicitly set both physical interface name for input and output.

so "-i interface1 -o any" does not work! (tested on RHEL 7.5)

Comment 9 Mai Ling 2018-06-08 16:13:50 UTC
and another stupid thing is that you must specify the physical interface name like in traditional iptables, but I expected it to integrate nicely with networkmanager and I expected to be able to write connection names, not interface names, and then I expected it to automatically translate to physical interface names!
but I guess I have too high expectations of firewalld...

Comment 10 Juha Tuomala 2019-10-04 15:44:56 UTC
Ha, I was wondering the exactly the same thing and found this bug entry. :)

The whole point firewalld was (I assume) of having a 'daemon' and a user inteface, which would together provide a safe way to make modifications to traffic filtering rules without sawing your own branch off where you were sitting on. Every network specialist knows this risk.

Well, it turns out that firewalld is what I suspected from the start: a workstation firewall solution, not a network firewall solution.

Which is funny as the term firewall is historically just about the network device (a wall), not about host filtering.

Which also funny, that it comes with predefined 'zones' like 'dmz'. Well, where the hell you're supposed to have that DMZ-zone else than in your backbone network which is protected by network firewall? Maybe with VPN you could connect it to your workstation and it would make sense. Or not.

Looks like modifying the dmz service rules go into IN_dmz_allow chain, that is called by hopping chain to antoher:

INPUT 
  INPUT_ZONES
    IN_dmz
      IN_dmz_allow


and in case of network firewall, that would be traffic directed to firewall itself. If it would be traffic that firewall would be routing through itself, it should be in FORWARD.

Using --direct removes the whole point of having that daemon+userinterface and removes the benefits they provide. Only thing left are the other limitations, missing documenation, weird "concepts" and broken XML (and who knows what else crap).

Comment 11 Eric Garver 2019-10-15 20:11:56 UTC
(In reply to Mai Ling from comment #7)
> this is stupid. having to add direct rules is stupid. why does not firewalld
> offer a native way to add rules to chain FORWARD in table filter?

Because no one has implemented the feature.

Comment 12 Eric Garver 2019-10-15 20:14:25 UTC
(In reply to Mai Ling from comment #8)
> this is even more stupid. direct rules do not work with interface 'any', you
> must explicitly set both physical interface name for input and output.
> 
> so "-i interface1 -o any" does not work! (tested on RHEL 7.5)

"-o any" attempts to match an output interface with name "any". If you want to match _any_ output interface, then omit the option. You can also use wildcarding with "+". This is covered pretty thoroughly in the iptables man page.

Comment 13 Eric Garver 2019-10-15 20:16:00 UTC
(In reply to Mai Ling from comment #9)
> and another stupid thing is that you must specify the physical interface
> name like in traditional iptables, but I expected it to integrate nicely
> with networkmanager and I expected to be able to write connection names, not
> interface names, and then I expected it to automatically translate to
> physical interface names!
> but I guess I have too high expectations of firewalld...

What you describe already occurs. firewalld integrates with NetworkManager. You can set the "zone" in the NM connection settings.

Comment 14 Eric Garver 2019-10-15 20:19:48 UTC
(In reply to Juha Tuomala from comment #10)
[..]
> Using --direct removes the whole point of having that daemon+userinterface
> and removes the benefits they provide. Only thing left are the other
> limitations, missing documenation, weird "concepts" and broken XML (and who
> knows what else crap).

If you have documentation topics that you'd like to see, then file an issue upstream.. or better yet add them and submit a PR.

Comment 15 Juha Tuomala 2019-10-17 10:24:19 UTC
(In reply to Eric Garver from comment #14)
> If you have documentation topics that you'd like to see, then file an issue
> upstream.. or better yet add them and submit a PR.

This is the 15th comment on this topic. Are you sure you're the right person writing the documentation if you need to ask this - when someone already filed a report that there is a problem?

Comment 16 Eric Garver 2019-10-17 13:51:47 UTC
(In reply to Juha Tuomala from comment #15)
> (In reply to Eric Garver from comment #14)
> > If you have documentation topics that you'd like to see, then file an issue
> > upstream.. or better yet add them and submit a PR.
> 
> This is the 15th comment on this topic. Are you sure you're the right person
> writing the documentation if you need to ask this - when someone already
> filed a report that there is a problem?

I was referring to the upstream firewalld documentation as many of the items you mentioned are relevant to upstream. This bug is for fedora downstream documentation. Both accept contributions.

Comment 17 Petr Bokoc 2019-11-07 15:29:47 UTC
I'm closing this bug as part of a Bugzilla cleanup effort. The most likely reason is that the bug has been opened either against a component we no longer publish, or against Release Notes for an EOL release.