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

[Xen-changelog] [xen-unstable] Import the Xend parts of xen-unstable changeset



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Node ID 4441715c9a67c5c63cf507b5202204bf67e36767
# Parent  f3be4922cc8b25f8aa5efde8ce40f2545bbe80e7
Import the Xend parts of xen-unstable changeset
11840:02506a7443155611d6bbf03e49fbf193e96d24db.

[HVM] Implement password authentication of VNC connections.

The specification is as mentioned at
http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00666.html
(However, password came to describe plain text)

The difference is follows.
- protocol_authtype() without the necessity was deleted.
- The check on the protocol version was added.
- And, some small modification.

Signed-off-by: Masami Watanabe <masami.watanabe@xxxxxxxxxxxxxx>
---
 tools/examples/xend-config.sxp    |    9 +++++++++
 tools/python/xen/xend/XendRoot.py |    6 ++++++
 tools/python/xen/xend/image.py    |   28 +++++++++++++++++++++++++++-
 tools/python/xen/xm/create.py     |    5 +++++
 4 files changed, 47 insertions(+), 1 deletion(-)

diff -r f3be4922cc8b -r 4441715c9a67 tools/examples/xend-config.sxp
--- a/tools/examples/xend-config.sxp    Fri Oct 20 09:32:16 2006 +0100
+++ b/tools/examples/xend-config.sxp    Wed Nov 01 10:30:02 2006 +0000
@@ -130,3 +130,12 @@
 
 # The tool used for initiating virtual TPM migration
 #(external-migration-tool '')
+
+# The interface for VNC servers to listen on. Defaults
+# to 127.0.0.1  To restore old 'listen everywhere' behaviour
+# set this to 0.0.0.0
+#(vnc-listen '127.0.0.1')
+
+# The default password for VNC console on HVM domain.
+# Empty string is no authentication.
+(vncpasswd '')
diff -r f3be4922cc8b -r 4441715c9a67 tools/python/xen/xend/XendRoot.py
--- a/tools/python/xen/xend/XendRoot.py Fri Oct 20 09:32:16 2006 +0100
+++ b/tools/python/xen/xend/XendRoot.py Wed Nov 01 10:30:02 2006 +0000
@@ -92,6 +92,8 @@ class XendRoot:
     dom0_min_mem_default = '0'
 
     dom0_vcpus_default = '0'
+
+    vncpasswd_default = None
 
     """Default interface to listen for VNC connections on"""
     xend_vnc_listen_default = '127.0.0.1'
@@ -287,6 +289,10 @@ class XendRoot:
     def get_vnclisten_address(self):
         return self.get_config_value('vnc-listen', 
self.xend_vnc_listen_default)
 
+    def get_vncpasswd_default(self):
+        return self.get_config_value('vncpasswd',
+                                     self.vncpasswd_default)
+
 def instance():
     """Get an instance of XendRoot.
     Use this instead of the constructor.
diff -r f3be4922cc8b -r 4441715c9a67 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Fri Oct 20 09:32:16 2006 +0100
+++ b/tools/python/xen/xend/image.py    Wed Nov 01 10:30:02 2006 +0000
@@ -354,23 +354,49 @@ class HVMImageHandler(ImageHandler):
         sdl = sxp.child_value(config, 'sdl')
         ret = []
         nographic = sxp.child_value(config, 'nographic')
+
+        # get password from VM config (if password omitted, None)
+        vncpasswd_vmconfig = sxp.child_value(config, 'vncpasswd')
+
         if nographic:
             ret.append('-nographic')
+            # remove password
+            if vncpasswd_vmconfig:
+                config.remove(['vncpasswd', vncpasswd_vmconfig])
             return ret
+
         if vnc:
             vncdisplay = sxp.child_value(config, 'vncdisplay',
                                          int(self.vm.getDomid()))
+
             vncunused = sxp.child_value(config, 'vncunused')
             if vncunused:
                 ret += ['-vncunused']
             else:
                 ret += ['-vnc', '%d' % vncdisplay]
+
             ret += ['-k', 'en-us']
+
             vnclisten = sxp.child_value(config, 'vnclisten')
             if not(vnclisten):
-                vnclisten = 
xen.xend.XendRoot.instance().get_vnclisten_address()
+                vnclisten = (xen.xend.XendRoot.instance().
+                             get_vnclisten_address())
             if vnclisten:
                 ret += ['-vnclisten', vnclisten]
+
+            vncpasswd = vncpasswd_vmconfig
+            if vncpasswd is None:
+                vncpasswd = (xen.xend.XendRoot.instance().
+                             get_vncpasswd_default())
+                if vncpasswd is None:
+                    raise VmError('vncpasswd is not set up in ' +
+                                  'VMconfig and xend-config.')
+            if vncpasswd != '':
+                self.vm.storeVm("vncpasswd", vncpasswd)
+
+        # remove password
+        config.remove(['vncpasswd', vncpasswd_vmconfig])
+
         return ret
 
     def createDeviceModel(self):
diff -r f3be4922cc8b -r 4441715c9a67 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Fri Oct 20 09:32:16 2006 +0100
+++ b/tools/python/xen/xm/create.py     Wed Nov 01 10:30:02 2006 +0000
@@ -103,6 +103,10 @@ gopts.opt('console_autoconnect', short='
 gopts.opt('console_autoconnect', short='c',
           fn=set_true, default=0,
           use="Connect to the console after the domain is created.")
+
+gopts.var('vncpasswd', val='NAME',
+          fn=set_value, default=None,
+          use="Password for VNC console on HVM domain.")
 
 gopts.var('vncviewer', val='no|yes',
           fn=set_bool, default=None,
@@ -660,6 +664,7 @@ def configure_hvm(config_image, vals):
     for a in args:
         if (vals.__dict__[a]):
             config_image.append([a, vals.__dict__[a]])
+    config_image.append(['vncpasswd', vals.vncpasswd])
 
 def run_bootloader(vals, config_image):
     if not os.access(vals.bootloader, os.X_OK):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.