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 1057875 - firewalld input_zones has default rule for public zone
Summary: firewalld input_zones has default rule for public zone
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: firewalld
Version: 20
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: ---
Assignee: Thomas Woerner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1058339
TreeView+ depends on / blocked
 
Reported: 2014-01-25 15:47 UTC by Andy Wang
Modified: 2014-03-09 04:43 UTC (History)
4 users (show)

Fixed In Version: firewalld-0.3.9.3-1.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1058339 (view as bug list)
Environment:
Last Closed: 2014-02-11 23:02:59 UTC


Attachments (Terms of Use)

Description Andy Wang 2014-01-25 15:47:47 UTC
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

Comment 1 Thomas Woerner 2014-01-27 10:04:22 UTC
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.

Comment 2 Andy Wang 2014-01-27 14:12:09 UTC
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.

Comment 3 Jiri Popelka 2014-01-27 15:21:39 UTC
(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 Toby Ovod-Everett 2014-02-01 00:32:32 UTC
I can confirm that I saw the same behavior as well.  I did my rebuild onto Fedora 20 yesterday and noticed this (I try to run with full shields up before I hook up the external interface and start downloading updates with yum) - try as I might, I couldn't get the firewall to start blocking ssh (I was using Shields Up to scan the machine from outside).

I ended up working around it by setting the default zone to block (instead of default).  I just finished verifying all the docs to make sure I had a bug on my hand and then starting scanning the bug list when I came across this one.  :-)

Glad to see the fix is in progress (and Andy Wang's analysis looks just like mine did)!

For what it's worth, here are my chains (after setting the default zone to block):

Chain FORWARD_IN_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination
   32  1751 FWDI_trusted  all  --  p6p1   any     anywhere             anywhere
    0     0 FWDI_external  all  --  p1p1   any     anywhere             anywhere
    0     0 FWDI_block  all  --  +      any     anywhere             anywhere

Chain FORWARD_OUT_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 FWDO_trusted  all  --  any    p6p1    anywhere             anywhere
    0     0 FWDO_external  all  --  any    p1p1    anywhere             anywhere
    0     0 FWDO_block  all  --  any    +       anywhere             anywhere

Comment 5 Fedora Update System 2014-02-05 17:10:19 UTC
firewalld-0.3.9.3-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/firewalld-0.3.9.3-1.fc20

Comment 6 Fedora Update System 2014-02-05 17:16:14 UTC
firewalld-0.3.9.3-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/FEDORA-2014-0752/firewalld-0.3.9.3-1.fc19

Comment 7 Fedora Update System 2014-02-07 03:05:04 UTC
Package firewalld-0.3.9.3-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing firewalld-0.3.9.3-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-2100/firewalld-0.3.9.3-1.fc20
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2014-02-11 23:02:59 UTC
firewalld-0.3.9.3-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2014-03-09 04:43:23 UTC
firewalld-0.3.9.3-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.


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