libvirt/tests
Laine Stump 2abde0ac07 network: use dnsmasq --bind-dynamic when available
This bug resolves CVE-2012-3411, which is described in the following
bugzilla report:

  https://bugzilla.redhat.com/show_bug.cgi?id=833033

The following report is specifically for libvirt on Fedora:

  https://bugzilla.redhat.com/show_bug.cgi?id=874702

In short, a dnsmasq instance run with the intention of listening for
DHCP/DNS requests only on a libvirt virtual network (which is
constructed using a Linux host bridge) would also answer queries sent
from outside the virtualization host.

This patch takes advantage of a new dnsmasq option "--bind-dynamic",
which will cause the listening socket to be setup such that it will
only receive those requests that actually come in via the bridge
interface. In order for this behavior to actually occur, not only must
"--bind-interfaces" be replaced with "--bind-dynamic", but also all
"--listen-address" options must be replaced with a single
"--interface" option. Fully:

   --bind-interfaces --except-interface lo --listen-address x.x.x.x ...

(with --listen-address possibly repeated) is replaced with:

   --bind-dynamic --interface virbrX

Of course libvirt can't use this new option if the host's dnsmasq
doesn't have it, but we still want libvirt to function (because the
great majority of libvirt installations, which only have mode='nat'
networks using RFC1918 private address ranges (e.g. 192.168.122.0/24),
are immune to this vulnerability from anywhere beyond the local subnet
of the host), so we use the new dnsmasqCaps API to check if dnsmasq
supports the new option and, if not, we use the "old" option style
instead. In order to assure that this permissiveness doesn't lead to a
vulnerable system, we do check for non-private addresses in this case,
and refuse to start the network if both a) we are using the old-style
options, and b) the network has a publicly routable IP
address. Hopefully this will provide the proper balance of not being
disruptive to those not practically affected, and making sure that
those who *are* affected get their dnsmasq upgraded.

(--bind-dynamic was added to dnsmasq in upstream commit
54dd393f3938fc0c19088fbd319b95e37d81a2b0, which was included in
dnsmasq-2.63)

(cherry picked from commit 753ff83a50)
Conflicts:
        src/network/bridge_driver.c
        * needed to change virReportError() to the older
          networkReportError()

	tests/networkxml2argvdata/nat-network-dns-txt-record.argv
        * this test file has an example of an arg with embedded space,
          which gets sorrounded by '' in newer releases. Other
          items on the same line had been modified.

	tests/networkxml2argvdata/routed-network.argv
        * in the newer releases, this test file had an --addn-hosts
          arg that didn't exist on this branch. Again, it was in the
          surrounding context of the changes that had been made on
          master.
2012-11-29 21:52:30 -05:00
..
capabilityschemadata
commanddata command: avoid deadlock on EPIPE situation 2012-06-14 18:38:25 -04:00
confdata Change the default of mdns_adv to false 2012-03-27 09:54:49 -06:00
cputestdata Removed more AMD-specific features from cpu64-rhel* models 2012-03-09 14:36:31 +01:00
domainschemadata xml: output memory unit for clarity 2012-03-07 18:24:43 -07:00
domainsnapshotxml2xmlin
domainsnapshotxml2xmlout qemu: Support numad 2012-03-15 12:24:56 +08:00
interfaceschemadata
lxcxml2xmldata Add support for setting init argv for LXC 2012-03-27 15:52:25 +01:00
networkxml2argvdata network: use dnsmasq --bind-dynamic when available 2012-11-29 21:52:30 -05:00
networkxml2xmlin Adding the element pf to network xml. 2012-01-11 13:10:21 -07:00
networkxml2xmlout Adding the element pf to network xml. 2012-01-11 13:10:21 -07:00
nodedevschemadata
nodeinfodata Modify the tests/nodeinfotest.c to use sysfs in addition 2011-12-08 08:39:26 -05:00
nwfilterxml2xmlin Add test cases for new ways to access variables in filters 2012-01-11 06:42:37 -05:00
nwfilterxml2xmlout Add test cases for new ways to access variables in filters 2012-01-11 06:42:37 -05:00
qemuhelpdata Add support for QEMU 1.0 2011-12-05 13:02:54 +01:00
qemuxml2argvdata Fix /domain/features setting in qemuParseCommandLine 2012-08-12 19:23:51 -04:00
qemuxml2xmloutdata Set a sensible default master start port for ehci companion controllers 2012-06-14 18:22:30 -04:00
qemuxmlnsdata xml: output memory unit for clarity 2012-03-07 18:24:43 -07:00
sexpr2xmldata Xen: Fix <clock> handling 2012-04-02 09:33:54 -06:00
storagepoolxml2xmlin
storagepoolxml2xmlout xml: output memory unit for clarity 2012-03-07 18:24:43 -07:00
storagevolxml2xmlin storage: support more scaling suffixes 2012-03-07 18:24:43 -07:00
storagevolxml2xmlout xml: output memory unit for clarity 2012-03-07 18:24:43 -07:00
vmx2xmldata xml: output memory unit for clarity 2012-03-07 18:24:43 -07:00
xencapsdata Add suspend info to Xen, LXC and UML hypervisor capabilities 2011-11-30 10:12:30 +00:00
xmconfigdata Xen: Fix <clock> handling 2012-04-02 09:33:54 -06:00
xml2sexprdata Xen: Fix <clock> handling 2012-04-02 09:33:54 -06:00
xml2vmxdata xml: output memory unit for clarity 2012-03-07 18:24:43 -07:00
.valgrind.supp
capabilityschematest
commandhelper.c command: avoid deadlock on EPIPE situation 2012-06-14 18:38:25 -04:00
commandtest.c command: avoid deadlock on EPIPE situation 2012-06-14 18:38:25 -04:00
conftest.c
cpuset
cputest.c test: fix build errors with gcc 4.7.0 and -O0 2012-04-16 12:39:58 +01:00
daemon-conf
define-dev-segfault xml: output memory unit for clarity 2012-03-07 18:24:43 -07:00
domainschematest Add LXC XML files to schema test & fix problems this uncovers 2012-03-27 15:52:25 +01:00
domainsnapshotschematest
domainsnapshotxml2xmltest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
esxutilstest.c build: properly skip tests 2011-12-01 13:49:20 -07:00
eventtest.c
int-overflow
interfaceschematest
interfacexml2xmltest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
jsontest.c
libvirtd-fail
libvirtd-pool
lxcxml2xmltest.c build: silence recent syntax check violations 2012-03-29 21:23:59 -06:00
Makefile.am tests: run valgrind on real executables, not libtool wrappers 2012-06-14 18:22:52 -04:00
networkschematest
networkxml2argvtest.c util: capabilities detection for dnsmasq 2012-11-29 16:29:14 -05:00
networkxml2xmltest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
nodedevschematest
nodedevxml2xmltest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
nodeinfotest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
nwfilterschematest
nwfilterxml2xmltest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
object-locking.ml
oomtrace.pl
openvzutilstest.c xml: output memory unit for clarity 2012-03-07 18:24:43 -07:00
openvzutilstest.conf
pkix_asn1_tab.c
qemuargv2xmltest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
qemuhelptest.c qemu: Use scsi-block for lun passthrough instead of scsi-disk 2012-03-14 23:32:53 +08:00
qemumonitortest.c qemu: unescape HMP commands before converting them to json 2012-02-27 16:06:02 -07:00
qemuxml2argvtest.c Fix for parallel port passthrough for QEMU 2012-06-14 18:38:26 -04:00
qemuxml2xmltest.c Fix logic for assigning PCI addresses to USB2 companion controllers 2012-06-14 18:16:49 -04:00
qemuxmlnstest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
read-bufsiz
read-non-seekable
reconnect.c tests: avoid xend ABRT crash report 2011-11-18 15:00:18 -07:00
schematestutils.sh tests: fix schema checks sorting 2011-12-22 13:01:09 -07:00
seclabeltest.c tests: avoid seclabeltest crash 2012-08-12 21:15:48 -04:00
sexpr2xmltest.c Consistent style for usage of sizeof operator 2012-03-30 11:47:24 +01:00
shunloadhelper.c
shunloadtest.c build: properly skip tests 2011-12-01 13:49:20 -07:00
sockettest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
ssh.c Disable build of commandhelper & ssh on Win32 2012-03-30 11:47:14 +01:00
start
statstest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
storagepoolschematest
storagepoolxml2xmltest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
storagevolschematest
storagevolxml2xmltest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
test_conf.sh
test-lib.sh
testutils.c tests: back to short test names 2012-06-14 18:22:52 -04:00
testutils.h Fix format specifiers in test cases on Win32 2012-04-16 12:39:05 +01:00
testutilslxc.c Add support for setting init argv for LXC 2012-03-27 15:52:25 +01:00
testutilslxc.h Add support for setting init argv for LXC 2012-03-27 15:52:25 +01:00
testutilsqemu.c tests: avoid compiler warnings 2012-04-16 12:40:02 +01:00
testutilsqemu.h
testutilsxen.c Fix default console type setting 2011-11-03 12:01:48 +00:00
testutilsxen.h
undefine
utiltest.c
vcpupin
virauthconfigtest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
virbuftest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
virhashdata.h Rename hash.h and hash.c to virhash.h and virhash.c 2012-01-26 14:11:13 +00:00
virhashtest.c Fix format specifiers in test cases on Win32 2012-04-16 12:39:05 +01:00
virkeyfiletest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
virnetmessagetest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
virnetsockettest.c Fix test failure when no IPv6 is avail 2012-08-12 19:23:51 -04:00
virnettlscontexttest.c test: fix build errors with gcc 4.7.0 and -O0 2012-04-16 12:39:58 +01:00
virsh-all
virsh-optparse build: update to latest gnulib 2011-12-01 14:12:59 -07:00
virsh-schedinfo build: update to latest gnulib 2011-12-01 14:12:59 -07:00
virsh-synopsis
virshtest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
virt-aa-helper-test
virtimetest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
viruritest.c tests: avoid compiler warnings 2012-04-16 12:40:02 +01:00
vmx2xmltest.c vmx: Better Workstation vmx handling 2012-02-24 11:53:23 +01:00
xencapstest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
xmconfigtest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
xml2sexprtest.c Cleanup for a return statement in source files 2012-03-26 14:45:22 -06:00
xml2vmxtest.c vmx: Better Workstation vmx handling 2012-02-24 11:53:23 +01:00