Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1058339 - firewalld input_zones has default rule for public zone
Summary: firewalld input_zones has default rule for public zone
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: firewalld
Version: 7.0
Hardware: noarch
OS: Linux
high
urgent
Target Milestone: rc
: ---
Assignee: Thomas Woerner
QA Contact: Tomas Dolezal
URL:
Whiteboard:
Depends On: 1057875
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-27 15:24 UTC by Jiri Popelka
Modified: 2014-06-18 03:11 UTC (History)
2 users (show)

Fixed In Version: firewalld-0.3.9-4.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1057875
Environment:
Last Closed: 2014-06-13 12:14:30 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Jiri Popelka 2014-01-27 15:24:12 UTC
+++ This bug was initially created as a clone of Bug #1057875 +++

Description of problem:
I created my own zone (secure) and assigned my network interface to it.  Once I do this, I notice that the default rules still fail over to public. Here's the iptables output:

Chain INPUT_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination         
   49  2540 IN_secure  all  --  eth0   any     anywhere             anywhere            
   39  1940 IN_public  all  --  +      any     anywhere             anywhere   

firewall-cmd --get-active-zones:
 secure
  interfaces: eth0

Based on that, I wouldn't expect public to ever come into play, but I'm fairly certain the + on the in column wil match anything that doesn't get tossed out by the secure zone.

 
Version-Release number of selected component (if applicable):
firewalld-0.3.9.2-1.fc20.noarch

--- Additional comment from Thomas Woerner on 2014-01-27 11:04:22 CET ---

Please check if your interface is really named eth0. ethX is not used on any of my machines anymore. The default rule will match for anything that is not named eth0 in your case.

--- Additional comment from Andy Wang on 2014-01-27 15:12:09 CET ---

Yes it is using eth0.  This is within a kvm virtual machine using virtio device.  I've noticed that virtio network devices seem to be still named ethX.

That said, I'm not sure you're comment is accurate.  
For example, here's another machine of mine:

    0     0 IN_public  all  --  p128p1 *       0.0.0.0/0            0.0.0.0/0           
    0     0 IN_public  all  --  +      *       0.0.0.0/0            0.0.0.0/0           


The way i understand how the iptables rules are parsed, the + is a wildcard.
When I define a custom zone it creates the following IN_zone chain:
Chain IN_zone (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 IN_zone_log  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 IN_zone_deny  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 IN_zone_allow  all  --  *      *       0.0.0.0/0            0.0.0.0/0


If the packet doesn't match one of the rules in one of those targets, it'll simply be passed along the chain passing it through the:
    0     0 IN_public  all  --  +      *       0.0.0.0/0            0.0.0.0/0           

For example, if I create a zone that I only intended to allow https, but didn't explicitly deny ssh in the zone, the ssh connection would pass through to the public chain, which by default allows ssh.

--- Additional comment from Jiri Popelka on 2014-01-27 16:21:39 CET ---

(In reply to Andy Wang from comment #2)
> For example, if I create a zone that I only intended to allow https, but
> didn't explicitly deny ssh in the zone, the ssh connection would pass
> through to the public chain, which by default allows ssh.

Correct. Thank you for the investigation.

We had already fixed this problem (bug #912782) some time ago by using --goto instead of --jump, but then I made one incomplete fix and reintroduced this problem. Sorry!

Should be fixed upstream with
https://git.fedorahosted.org/cgit/firewalld.git/commit/?id=b2b5b88c56feffe09ddacf5ed348bc587f84160c

Comment 4 Ludek Smid 2014-06-13 12:14:30 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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