Bug 606889

Summary: Fix enforcement of direction of traffic for rules describing incoming traffic
Product: Red Hat Enterprise Linux 6 Reporter: Stefan Berger <stefanb>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: berrange, clalance, dallan, dyuan, hbrock, mjenner, xen-maint
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0_8_1-12_el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-11 14:50:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Berger 2010-06-22 16:42:32 UTC
Description of problem:

The below patches fix a network filtering / security problem due to network traffic filtering rules not enforcing the direction in which for example a TCP connection is established; also give user control over the enforcement of the direction of the traffic by adding a new attribute to the XML.


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

libvirt-0.8.1-9.el6

Steps to Reproduce:
1. Create an nwfilter containing the following XML fragment:

  [...]
   <rule action='accept' direction='in' priority='500'>
      <tcp dstportstart='22'/>
   </rule>
  [...]

2. Create a VM referencing the nwfilter with above fragment
3. Start the VM
  
Actual results:

A filtering rule for the above will created that looks like this if dumped using iptables -L -n:

[...]
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:22
[...]


Expected results:

The rule that we would like to have would be this one here:

[...]
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:22 state NEW,ESTABLISHED
[...]

Additional info:

Please add the following two patches in the order shown below -- both apply cleanly to recent -9.

ID                                      ,proposed patch name

2dce970162b3e45c796dfab9da8490c7b18b4533,libvirt-0.8.1-nwfilter-state-match-on-incoming-traffic.patch
51d3fb02768bb10fbba70e9c4466456c0488ced6,libvirt-0.8.1-nwfilter-xml-attribute-for-state-match.patch

[ git log -p -n 1 ${id} > ${patch} ]

Comment 2 RHEL Program Management 2010-06-22 17:13:24 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 5 Dave Allan 2010-06-30 02:13:43 UTC
libvirt-0_8_1-12_el6 has been built in RHEL-6-candidate with the fix.

Dave

Comment 6 dyuan 2010-07-01 09:17:46 UTC
Verified PASSED with libvirt-0.8.1-13.el6.

# cat filter.xml 
<filter name='filter'>
  <rule action='accept' direction='in' priority='500'>
    <tcp dstportstart='22'/>
  </rule>
  </filter>

start VM referencing the nwfilter with above fragment

# iptables -L -n

[...]
Chain FI-vnet0 (1 references)
target     prot opt source               destination         
RETURN     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp spt:22 state ESTABLISHED 

Chain FO-vnet0 (1 references)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:22 state NEW,ESTABLISHED 
[...]

Comment 7 releng-rhel@redhat.com 2010-11-11 14:50:54 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.