weizhouapache opened a new pull request, #8951:
URL: https://github.com/apache/cloudstack/pull/8951

   ### Description
   
   In shared, isolated networks and vpcs in advanced zone, user vms can easily 
perform ip/arp/mac spoofing by pretending to be another vm in the same network.
   
   - change mac
   ```
   ip link set dev eth0 down
   ip link set dev eth0 address <MAC of another vm>
   ip link set dev eth0 up
   ```
   - change IP
   ```
   ip addr add dev eth0 <IP/cidr of another vm in same network>
   ip addr del dev eth0 <old IP/cidr>
   ```
   
   - these can also be done by netplan/network-scripts configurations.
   
   libvirt has a network traffic filtering subsystem which can be used to 
prevent spoofing. (https://libvirt.org/formatnwfilter.html#concepts)
   - It provides some pre-existing network filters 
(https://libvirt.org/formatnwfilter.html#pre-existing-network-filters), 
no-mac-spoofing is missed in the table. 
   - Ideally we should use `clean-traffic`, however, the `IP/ARP anti-spoofing 
does not work` in our testing, as the IP is not specified in the libvirt vm 
definition XML by cloudstack.
   -  libvirt can auto-detect the IP but the auto-detected IP is not always 
correct, for example, when user configures (wrong) static IP inside the user VM.
   
   This PR adds `no-mac-spoofing` for each nic to prevent mac spoofing.
   
   It could be an improvement PR to support all MAC/IP/ARP spoofing
   - it might lead to some overhead.
   - it is better to be configurable for guest network, network offering or 
account
   - IP/network information needs to be added to the InterfaceDef for each type 
of interface (bridge, direct, network, vhostuser, etc).
   - it might be not needed in advanced zone with security groups, as there are 
already iptables/ebtables/ipset rules to prevent the spoofings
   - it needs some discussion and testing. `clean-traffic` is good, but it 
might not be what we want. we need to evaluate the pre-existing network filters 
and probably consider creating customized filters. refer to 
https://libvirt.org/firewall.html#the-network-filter-driver
   
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally 
changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to 
reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be 
closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- 
******************************************************************************* 
-->
   <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE 
DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- 
******************************************************************************* 
-->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   
   ### Screenshots (if appropriate):
   
   
   ### How Has This Been Tested?
   
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to 
-->
   
   #### How did you try to break this feature and the system with this change?
   
   <!-- see how your change affects other areas of the code, etc. -->
   
   
   <!-- Please read the 
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) 
document -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to