[PATCH 08/11] Don't allow renaming of domains by the backdoor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Several APIs allow for custom XML to be passed in. This is
checked for ABI stability, which will ensure the UUID is
not being changed. There isn't validation that the name
did not change though. This could allow renaming of guests
via the backdoor, which in turn could allow for bypassing
access control restrictions based on names.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/conf/domain_conf.c    | 11 +++++++++++
 src/qemu/qemu_migration.c |  6 ------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a8b5dfd..d945b74 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12560,6 +12560,17 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
         return false;
     }
 
+    /* Not strictly ABI related, but we want to make sure domains
+     * don't get silently re-named through the backdoor when passing
+     * custom XML into various APIs, since this would create havoc
+     */
+    if (STRNEQ(src->name, dst->name)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target domain name '%s' does not match source '%s'"),
+                       dst->name, src->name);
+        return false;
+    }
+
     if (src->mem.max_balloon != dst->mem.max_balloon) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain max memory %lld does not match source %lld"),
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c0b6453..ebd0382 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1941,12 +1941,6 @@ char *qemuMigrationBegin(virQEMUDriverPtr driver,
                                             VIR_DOMAIN_XML_INACTIVE)))
             goto cleanup;
 
-        if (STRNEQ(def->name, vm->def->name)) {
-            virReportError(VIR_ERR_INVALID_ARG, "%s",
-                           _("target domain name doesn't match source name"));
-            goto cleanup;
-        }
-
         if (!virDomainDefCheckABIStability(vm->def, def))
             goto cleanup;
 
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]