99cbc7
From ceeba568bf66491826fdd2c16002890375790a4f Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <ceeba568bf66491826fdd2c16002890375790a4f@dist-git>
99cbc7
From: Ales Musil <amusil@redhat.com>
99cbc7
Date: Sun, 29 Jul 2018 16:56:18 +0200
99cbc7
Subject: [PATCH] examples: Add clean-traffic-gateway into nwfilters
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
The filter purpose is to simulate isolated private VLAN.
99cbc7
99cbc7
The behavior can be achieved by limiting network traffic
99cbc7
to traffic between VM and gateway. Because there is no
99cbc7
concept of the PVLAN in the linux bridge.
99cbc7
99cbc7
The filter also contains parts from clean-traffic
99cbc7
to prevent VM from spoofing its IP and MAC address.
99cbc7
99cbc7
To use this filter the user just needs to set
99cbc7
the GATEWAY_MAC variable to gateway MAC address.
99cbc7
99cbc7
Signed-off-by: Ales Musil <amusil@redhat.com>
99cbc7
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
99cbc7
(cherry picked from commit ac01fbc90b7eb4ccc7a6140d618d1a3859365155)
99cbc7
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1603115
99cbc7
99cbc7
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 .../xml/nwfilter/clean-traffic-gateway.xml    | 34 +++++++++++++++++++
99cbc7
 1 file changed, 34 insertions(+)
99cbc7
 create mode 100644 examples/xml/nwfilter/clean-traffic-gateway.xml
99cbc7
99cbc7
diff --git a/examples/xml/nwfilter/clean-traffic-gateway.xml b/examples/xml/nwfilter/clean-traffic-gateway.xml
99cbc7
new file mode 100644
99cbc7
index 0000000000..b8c204041a
99cbc7
--- /dev/null
99cbc7
+++ b/examples/xml/nwfilter/clean-traffic-gateway.xml
99cbc7
@@ -0,0 +1,34 @@
99cbc7
+<filter name='clean-traffic-gateway'>
99cbc7
+    
99cbc7
+            from a VM by
99cbc7
+              - preventing MAC spoofing -->
99cbc7
+    <filterref filter='no-mac-spoofing'/>
99cbc7
+
99cbc7
+    
99cbc7
+    <filterref filter='no-ip-spoofing'/>
99cbc7
+
99cbc7
+    
99cbc7
+    <filterref filter='no-arp-spoofing'/>
99cbc7
+
99cbc7
+    
99cbc7
+    <rule action='accept' direction='inout' priority='-500'>
99cbc7
+        <mac protocolid='arp'/>
99cbc7
+    </rule>
99cbc7
+
99cbc7
+    
99cbc7
+    <rule action='accept' direction='in'>
99cbc7
+        <mac match='yes' srcmacaddr='$GATEWAY_MAC'/>
99cbc7
+    </rule>
99cbc7
+
99cbc7
+    
99cbc7
+    <rule action='accept' direction='out'>
99cbc7
+        <mac match='yes' dstmacaddr='$GATEWAY_MAC'/>
99cbc7
+    </rule>
99cbc7
+
99cbc7
+    
99cbc7
+    and ARP -->
99cbc7
+    <filterref filter='no-other-l2-traffic'/>
99cbc7
+
99cbc7
+    
99cbc7
+    <filterref filter='qemu-announce-self'/>
99cbc7
+</filter>
99cbc7
-- 
99cbc7
2.18.0
99cbc7