<br><tt><font size=2>"Daniel P. Berrange" <berrange@redhat.com>
wrote on 03/31/2010 03:44:48 PM:<br>
<br>
> Please respond to "Daniel P. Berrange"</font></tt>
<br><tt><font size=2>> <br>
> On Tue, Mar 30, 2010 at 01:56:52PM -0400, Stefan Berger wrote:<br>
> > Subject: Support for learning a VM's IP address<br>
> <br>
> > A caveat: The algorithm does not know which one is the appropriate
IP<br>
> > address of a VM. If the VM spoofs an IP address in its first
ARP traffic<br>
> > or IPv4 packets its filtering rules will be instantiated for
this IP<br>
> > address, thus 'locking' it to the found IP address. So, it's
still<br>
> > 'safer' to explicitly provide the IP address of a VM's interface
in the<br>
> > filter description if it is known beforehand.<br>
> <br>
> While this code is very clever, I'm not really convinced that having
a<br>
> learning capability that snifs arbitrary IP packets for an address
is<br>
> desirable. The primary task of the nwfilter mechanism is to provide
secure<br>
> isolation of the VM from other VMs & network protocols. Basing
this ontop <br>
> of a learning mode that we know can be trivially poisoned/exploited
by <br>
> sending fake ARPs just doesn't seem like a good plan - it is providing
<br>
> users a false sense of security.</font></tt>
<br>
<br><tt><font size=2>That's correct. It mostly provides 'convenience'.</font></tt>
<br><tt><font size=2><br>
> <br>
> The only way I could see this working in a reasonably secure manner
is to<br>
> start from the assigned MAC address that we know & can trust.
Then listen for<br>
> DHCP OFFERS (IPv4/6) matching the MAC address, and extract the IP
from that.</font></tt>
<br>
<br><tt><font size=2>I am actually doing that, though I am only comparing
the destination MAC address</font></tt>
<br><tt><font size=2>in that case so far and not the MAC address in the
DHCP OFFER itself. The DHCP response</font></tt>
<br><tt><font size=2>is unicasted, so I don't currently compare the MAC
address in the DHCP OFFER, but </font></tt>
<br><tt><font size=2>that would be trivial to add.</font></tt>
<br>
<br><tt><font size=2>The problem with libpcap is that the sockets it is
using don't give a guarantee that</font></tt>
<br><tt><font size=2>none of the packets will be missed -- afaik. Missing
that one DHCP OFFER could then be fatal</font></tt>
<br><tt><font size=2>and waiting for the lease timeout probably not an
option. Are there other options?</font></tt>
<br>
<br><tt><font size=2>I'd like to keep the algorithm as much as possible
as it is now but be able to tell</font></tt>
<br><tt><font size=2>the thread to only look for dhcp offers for example,
provided that this could be</font></tt>
<br><tt><font size=2>done in a reliable manner. If a trusted DHCP server
was provided, the thread could</font></tt>
<br><tt><font size=2>be acting this way, otherwise it could rely on ARP,
IPv4 or DHCP Offer. It would </font></tt>
<br><tt><font size=2>be a matter of configuration of libvirt how the learning
actually works.</font></tt>
<br><tt><font size=2><br>
> This assumes DHCP OFFERS come from a trusted server, so we need to
make sure<br>
> that other VMs can't spoof DHCP OFFERS. Either the admin could include
a<br>
> DHCP blocking rule in the nwfilter config for all VMs (needs to be
on all<br>
> hosts), or have a host config parameter for nwfilter to specify the
trusted <br>
> DHCP server address. If done right, this gives a IP addr learning
mode which<br>
> the VM can't poison with an IP of its choosing.</font></tt>
<br>
<br><tt><font size=2>Only the missing of packets is fatal...</font></tt>
<br>
<br><tt><font size=2>> <br>
> For IPv6 the network might use DHCPv6 which we can procss in much
the same<br>
> way, or it might be doing stateless autoconfig. So we'd need some
host level<br>
> config parameter to specify whether to learn based on DHCPv6, or based
on<br>
> the router advertisments. In the latter case a VM auto-assigns  itself
an<br>
> IPv6 address based on the router prefix + its MAC address. So if we
spot<br>
> the router prefix + know the MAC addr we can safely set the IPv6 addr
filter</font></tt>
<br>
<br><tt><font size=2>The issue with looking out for multiple parameters,
i.e., IP and IPv6 (as well know</font></tt>
<br><tt><font size=2>address parameters) is that if only one parameter
was found a partial instantiation of </font></tt>
<br><tt><font size=2>the filters would be possible. I don't support something
like this at the moment, so</font></tt>
<br><tt><font size=2>I would only want to wait for one parameter 'IP'...
:-/ Also waiting for IP or</font></tt>
<br><tt><font size=2>IPv6 while the other is already known could take some
time...</font></tt>
<br>
<br><tt><font size=2>Regards,</font></tt>
<br><tt><font size=2>   Stefan</font></tt>
<br><tt><font size=2><br>
> <br>
> Regards,<br>
> Daniel<br>
> -- <br>
> |: Red Hat, Engineering, London    -o-   </font></tt><a href=http://people.redhat.com/berrange/:|><tt><font size=2>http://people.redhat.com/berrange/:|</font></tt></a><tt><font size=2><br>
> |: </font></tt><a href=http://libvirt.org/><tt><font size=2>http://libvirt.org</font></tt></a><tt><font size=2>
-o- </font></tt><a href="http://virt-manager.org/"><tt><font size=2>http://virt-manager.org</font></tt></a><tt><font size=2>
-o- </font></tt><a href=http://deltacloud.org:|/><tt><font size=2>http://deltacloud.org:|</font></tt></a><tt><font size=2><br>
> |: </font></tt><a href=http://autobuild.org/><tt><font size=2>http://autobuild.org</font></tt></a><tt><font size=2>
       -o-         </font></tt><a href=http://search.cpan.org/~danberr/:|><tt><font size=2>http://search.cpan.org/~danberr/:|</font></tt></a><tt><font size=2><br>
> |: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1
B3DF F742 7D3B 9505 :|<br>
</font></tt>