Skip to contentSkip to conversation

VNC password auth for paravirt framebuffer

PATCH New Daniel P. Berrange 1 participant 1 message Dec 5, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VNC password auth for paravirt framebuffer

Attached to this mail is an update of my original patches to add VNC pasword authentication support for the paravirt framebuffer server. These bring the PVFB VNC server to (near?) feature parity with the HVM VNC server. The rules for configuring the password are equivalent of those used for HVM, but the actual guest config option is a little different as a result of the recent refactoring of the PVFB config file syntax.

- If the 'vfb' option in the guest config has a 'vncpasswd' parameter specified
- If the passwd is not zero length, use that
- Else run with no authentication (important as it enables override of next rule)
- Else-if the xend-config.sxp has a password specified use that
- Else run with no authentication

Example configuration:

- To set an explicit guest password:

    vfb = [ "type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd=123456"]

- To disable authentication, overriding any XenD configured defalt password

    vfb = [ "type=vnc,vncunused=1,vnclisten=0.0.0.0,vncpasswd="]

- To run with default XenD configured password (if any)

    vfb = [ "type=vnc,vncunused=1,vnclisten=0.0.0.0"]

The changes basically affect 3 areas:

- tools/xenfb/vncfb.c - read the password from XenStore & configure LibVNCServer's authentication routines.
- tools/python/xen/xm/create.py - add vncpasswd parameter as a valid option
- tools/python/xen/xend/server/vfbif.py - read password from config file and write it into xenstore to access by xen-vncfb server

A functionally equivalent version of this patch is already in use in Fedora Core 5, 6 and RHEL-5 betas, so has seen some real world testing already.

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
.hgignore +1 -0
diff -r fd28a1b139de .hgignore
@@ -228,3 +228,4 @@
 ^unmodified_drivers/linux-2.6/.*\.cmd$
 ^unmodified_drivers/linux-2.6/.*\.ko$
 ^unmodified_drivers/linux-2.6/.*\.mod\.c$
+^LibVNCServer.*
tools/python/xen/xend/server/vfbif.py +12 -0
diff -r fd28a1b139de tools/python/xen/xend/server/vfbif.py
@@ -1,4 +1,5 @@ from xen.xend.server.DevController impor
 from xen.xend.server.DevController import DevController
+from xen.xend.XendLogging import log
 
 from xen.xend.XendError import VmError
 import xen.xend
@@ -41,6 +42,17 @@ class VfbifController(DevController):
                      "--title", self.vm.getName() ]
         t = config.get("type", None)
         if t == "vnc":
+            passwd = None
+            if config.has_key("vncpasswd"):
+                passwd = config["vncpasswd"]
+            else:
+                passwd = xen.xend.XendRoot.instance().get_vncpasswd_default()
+            if not(passwd is None or passwd == ""):
+                self.vm.storeVm("vncpasswd", passwd)
+                log.debug("Stored a VNC password for vfb access")
+            else:
+                log.debug("No VNC passwd configured for vfb access")
+
             # Try to start the vnc backend
             args = [xen.util.auxbin.pathTo("xen-vncfb")]
             if config.has_key("vncunused"):
tools/python/xen/xm/create.py +2 -2
diff -r fd28a1b139de tools/python/xen/xm/create.py
@@ -284,7 +284,7 @@ gopts.var('usbport', val='PATH',
           use="""Add a physical USB port to a domain, as specified by the path
           to that port.  This option may be repeated to add more than one port.""")
 
-gopts.var('vfb', val="type={vnc,sdl},vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY",
+gopts.var('vfb', val="type={vnc,sdl},vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD",
           fn=append_value, default=[],
           use="""Make the domain a framebuffer backend.
           The backend type should be either sdl or vnc.
@@ -584,7 +584,7 @@ def configure_vfbs(config_devs, vals):
             d['type'] = 'sdl'
         for (k,v) in d.iteritems():
             if not k in [ 'vnclisten', 'vncunused', 'vncdisplay', 'display',
-                          'xauthority', 'type' ]:
+                          'xauthority', 'type', 'vncpasswd' ]:
                 err("configuration option %s unknown to vfbs" % k)
             config.append([k,v])
         if not d.has_key("display") and os.environ.has_key("DISPLAY"):
tools/xenfb/vncfb.c +86 -9

132 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel