Hi! virt-manager was hardcoded to always make ssh connections as root when connecting to remote consoles. This patch fixes it. -- Soren Hansen Ubuntu Server Team http://www.ubuntu.com/
Index: virt-manager-0.5.3/src/virtManager/console.py =================================================================== --- virt-manager-0.5.3.orig/src/virtManager/console.py 2008-01-15 14:01:00.588730411 +0100 +++ virt-manager-0.5.3/src/virtManager/console.py 2008-01-15 14:13:12.333230924 +0100 @@ -395,7 +395,7 @@ finally: gtk.gdk.threads_leave() - def open_tunnel(self, server, vncaddr ,vncport): + def open_tunnel(self, server, vncaddr, vncport, username): if self.vncTunnel is not None: return @@ -409,7 +409,11 @@ os.close(1) os.dup(fds[1].fileno()) os.dup(fds[1].fileno()) - os.execlp("ssh", "ssh", "-p", "22", "-l", "root", server, "nc", vncaddr, str(vncport)) + argv = ["ssh", "ssh", "-p", "22"] + if username: + argv += ['-l', username] + argv += [ server, "nc", vncaddr, str(vncport) ] + os.execlp(*argv) os._exit(1) else: fds[1].close() @@ -435,14 +439,18 @@ logging.debug("Trying console login") password = self.window.get_widget("console-auth-password").get_text() - protocol, host, port, trans = self.vm.get_graphics_console() + protocol, host, port, trans, username = self.vm.get_graphics_console() if protocol is None: logging.debug("No graphics configured in guest") self.activate_unavailable_page(_("Console not configured for guest")) return - uri = str(protocol) + "://" + str(host) + ":" + str(port) + uri = str(protocol) + "://" + if username: + uri = uri + str(username) + '@' + uri = uri + str(host) + ":" + str(port) + logging.debug("Graphics console configured at " + uri) if protocol != "vnc": @@ -459,7 +467,7 @@ logging.debug("Starting connect process for %s %s" % (host, str(port))) try: if trans is not None and trans in ("ssh", "ext"): - fd = self.open_tunnel(host, "127.0.0.1", port) + fd = self.open_tunnel(host, "127.0.0.1", port, username) self.vncViewer.open_fd(fd) else: self.vncViewer.open_host(host, str(port)) Index: virt-manager-0.5.3/src/virtManager/create.py =================================================================== --- virt-manager-0.5.3.orig/src/virtManager/create.py 2008-01-15 14:01:00.593230803 +0100 +++ virt-manager-0.5.3/src/virtManager/create.py 2008-01-15 14:12:16.724731987 +0100 @@ -598,7 +598,7 @@ if self.config.get_console_popup() == 1: # user has requested console on new created vms only vm = self.connection.get_vm(guest.uuid) - (gtype, host, port, transport) = vm.get_graphics_console() + (gtype, host, port, transport, username) = vm.get_graphics_console() if gtype == "vnc": self.emit("action-show-console", self.connection.get_uri(), guest.uuid) else: Index: virt-manager-0.5.3/src/virtManager/domain.py =================================================================== --- virt-manager-0.5.3.orig/src/virtManager/domain.py 2008-01-15 14:01:00.593230803 +0100 +++ virt-manager-0.5.3/src/virtManager/domain.py 2008-01-15 14:12:16.728731128 +0100 @@ -462,9 +462,9 @@ # reliably resolve 'localhost' into 127.0.0.1, either returning # the public IP, or an IPv6 addr. Neither work since QEMU only # listens on 127.0.0.1 for VNC. - return [type, "127.0.0.1", port, None] + return [type, "127.0.0.1", port, None, None] else: - return [type, self.connection.get_hostname(), port, transport] + return [type, self.connection.get_hostname(), port, transport, username] def get_disk_devices(self): Index: virt-manager-0.5.3/src/virtManager/manager.py =================================================================== --- virt-manager-0.5.3.orig/src/virtManager/manager.py 2008-01-15 14:01:00.593230803 +0100 +++ virt-manager-0.5.3/src/virtManager/manager.py 2008-01-15 14:12:16.728731128 +0100 @@ -398,7 +398,7 @@ logging.debug("VM %s started" % vm.get_name()) if self.config.get_console_popup() == 2 and not vm.is_management_domain(): # user has requested consoles on all vms - (gtype, host, port, transport) = vm.get_graphics_console() + (gtype, host, port, transport, username) = vm.get_graphics_console() if gtype == "vnc": self.emit("action-show-console", uri, vmuuid) elif not connect.is_remote():
Attachment:
signature.asc
Description: Digital signature
_______________________________________________ et-mgmt-tools mailing list et-mgmt-tools@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/et-mgmt-tools