vm-bhyve
vm-bhyve copied to clipboard
Prevent MAC spoofing
Hello @churchers,
Currently MAC addresses inside guests can be changed at user's will. This definitely is not optimal security-wise. I figured there're two ways to improve this situation.
- Use if_bridge capabilities
ifconfig vm-public static tap0 58:9c:fc:0a:c2:08
ifconfig vm-public -learn tap0
ifconfig vm-public -discover tap0
- Use ipfw
IF="tap0"
MAC="58:9c:fc:0a:c2:08"
ipfw add 2000 allow all from any to any mac any $MAC via $IF
ipfw add 2010 allow all from any to any mac $MAC any via $IF
After enabling one of these on hypervisor, changing MAC address in guest results in no connectivity. While the first method is easier to implement in vm-bhyve (here) it's not switch type agnostic. The second one will make vm-bhyve depend on ipfw. On the other hand, it would be required for the next step: preventing IP spoofing. Let me know what do you think about this topic. I'll be happy to prepare pull request with this.
Thanks @pbiernacki and mzar for helping with bridge configuration.