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