VNC authentification
Hi all,
My understanding of main_loop of vl.c was insufficient. I have improved the point to have set the handler doubly. The protocol of protocol 3.3 and (UltraVNC's ?)3.4 did not actually need the response of the authentification type from the client. Therefore, protocol_authtype operated without being called.
I will post the take 4 patch after this.
The patch has limited RFB protocol to 3.3 and 3.4.
I also think that it should support 3.8 without being support 3.3 in the future.
However, Leaving like non authetification is not good. You will think the patch to be provisional action till then.
Another.
ill the RFB protocol still keep evolving in the future?
Best regards,
Watanabe
Quoted 50 lines · Anthony Liguori
Quoted 30 lines · Daniel P. Berrange
Quoted 24 lines · Anthony Liguori
Quoted 9 lines · Masami Watanabe
(quoted diff) +7
-0+static int vnc_auth(VncState *vs) +{ + extern char vncpasswd[64]; + extern unsigned char challenge[AUTHCHALLENGESIZE]; + + if (*vncpasswd == '\0') { + /* AuthType is None */Review
Quoted 10 lines
(quoted diff) +10
-0+ vnc_write_u32(vs, 1); + vnc_flush(vs); + vnc_read_when(vs, protocol_client_init, 1); + } else { + /* AuthType is VncAuth */ + vnc_write_u32(vs, 2); + vnc_flush(vs); + + /* Read AuthType */ + vnc_read_when(vs, protocol_authtype, 1);As I mentioned before, you cannot have to vnc_read_when()'s execution path without returning the the mainloop.
Quoted 3 lines
protocol_authtype()cannot possibly be invoked. If the code is working now, it's pure luck.Quoted 6 lines
Yeah, the impl of
protocol_authtype()in there is a no-op too - it should be rejecting auth types which aren't supported, even if it was being invoked. With the code as it is,protocol_authtypenever runs & the server starts doing VNCAuth regardless of what the client says it wants to do, which is clearly not correct.Another thing to keep in mind, is that the reason I did 3.3 instead of 3.8 is that I knew there was only one auth type we would be supporting. If we do support multiple auth types, we really ought to move to using the 3.8 protocol since that provides a negotiation mechanism.
Regards,
Anthony Liguori
Quoted 2 lines
Dan.
Quoted 8 lines · Masami Watanabe
Hi all,
My understanding of
main_loopofvl.cwas insufficient. I have improved the point to have set the handler doubly. The protocol of protocol 3.3 and (UltraVNC's ?)3.4 did not actually need the response of the authentification type from the client. Therefore,protocol_authtypeoperated without being called.
Quoted 8 lines
I will post the take 4 patch after this.
The patch has limited RFB protocol to 3.3 and 3.4.
I also think that it should support 3.8 without being support 3.3 in the future.However, Leaving like non authetification is not good. You will think the patch to be provisional action till then.
If you get the basic auth working correctly with RFB protocol 3.3, IMHO, that will be sufficient for an initial commit to xen-unstable because it is such a step forward over the current 'no auth' situation. We can consider extending it to cover protocol 3.8 at a later date when we decide which other auth meachanisms are particularly important.
Quoted 2 lines
Another.
ill the RFB protocol still keep evolving in the future?
Its been on 3.8 for a while & clients will negotiate a mutually supported protocol version with the server, so no need to worry about future protocol versions at this time.
Regards,
Dan
--
|=- 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 -=|
Quoted 8 lines · Masami Watanabe
Hi all,
My understanding of
main_loopofvl.cwas insufficient. I have improved the point to have set the handler doubly. The protocol of protocol 3.3 and (UltraVNC's ?)3.4 did not actually need the response of the authentification type from the client. Therefore,protocol_authtypeoperated without being called.
Yeah, I noticed that myself. That why your code was working. Your authtype (which would have been right for 3.7+) was not being invoked which happened to make it work for 3.3 :-)
Quoted 6 lines
I will post the take 4 patch after this.
The patch has limited RFB protocol to 3.3 and 3.4.
I also think that it should support 3.8 without being support 3.3 in the future.
There is no official RFB 3.4.
The only documented protocols are 3.3, 3.7, and 3.8. Leaving no authentication is definitely important. I can live with not having 3.8 support right away but I think it's key to allow for no authentication.
Regards,
Anthony Liguori
Quoted 70 lines
However, Leaving like non authetification is not good. You will think the patch to be provisional action till then.
Another.
ill the RFB protocol still keep evolving in the future?Best regards,
WatanabeQuoted 55 lines · Anthony Liguori
Quoted 33 lines · Daniel P. Berrange
Quoted 26 lines · Anthony Liguori
Quoted 10 lines · Masami Watanabe
(quoted diff) +7
-0+static int vnc_auth(VncState *vs) +{ + extern char vncpasswd[64]; + extern unsigned char challenge[AUTHCHALLENGESIZE]; + + if (*vncpasswd == '\0') { + /* AuthType is None */Review
Quoted 10 lines
(quoted diff) +10
-0+ vnc_write_u32(vs, 1); + vnc_flush(vs); + vnc_read_when(vs, protocol_client_init, 1); + } else { + /* AuthType is VncAuth */ + vnc_write_u32(vs, 2); + vnc_flush(vs); + + /* Read AuthType */ + vnc_read_when(vs, protocol_authtype, 1);As I mentioned before, you cannot have to vnc_read_when()'s execution path without returning the the mainloop.
Quoted 4 lines
protocol_authtype()cannot possibly be invoked. If the code is working now, it's pure luck.Quoted 7 lines
Yeah, the impl of
protocol_authtype()in there is a no-op too - it should be rejecting auth types which aren't supported, even if it was being invoked. With the code as it is,protocol_authtypenever runs & the server starts doing VNCAuth regardless of what the client says it wants to do, which is clearly not correct.Another thing to keep in mind, is that the reason I did 3.3 instead of 3.8 is that I knew there was only one auth type we would be supporting. If we do support multiple auth types, we really ought to move to using the 3.8 protocol since that provides a negotiation mechanism.
Regards,
Anthony Liguori
Quoted 3 lines
Dan.
PATCH 1/1 VNC authentification
Hi all,
This is take 4 on VNC authentification.
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.
Thanks all.
Best regards,
Watanabe
-----
tools/examples/xend-config.sxp +4 -0
@@ -130,3 +130,7 @@ # The tool used for initiating virtual TPM migration #(external-migration-tool '') + +# The default password for VNC console on HVM domain. +# Empty string is no authentication. +(vncpasswd '')
tools/examples/xmexample.hvm +5 -0
@@ -145,6 +145,11 @@ vnc=1 #vncconsole=0 #---------------------------------------------------------------------------- +# set password for domain's VNC console +# default is depents on vncpasswd in xend-config.sxp +vncpasswd='' + +#---------------------------------------------------------------------------- # no graphics, use serial port #nographic=0
tools/examples/xmexample.vti +5 -0
@@ -95,6 +95,11 @@ vnc=0 #vncconsole=0 #---------------------------------------------------------------------------- +# set password for domain's VNC console +# default is depents on vncpasswd in xend-config.sxp +vncpasswd='' + +#---------------------------------------------------------------------------- # no graphics, use serial port #nographic=0
tools/ioemu/Makefile.target +4 -0
@@ -398,6 +398,7 @@ VL_OBJS+=sdl.o VL_OBJS+=sdl.o endif VL_OBJS+=vnc.o +VL_OBJS+=d3des.o ifdef CONFIG_COCOA VL_OBJS+=cocoa.o COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
@@ -456,6 +457,9 @@ sdl.o: sdl.c keymaps.c sdl_keysym.h $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h + $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< + +d3des.o: d3des.c d3des.h $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< sdlaudio.o: sdlaudio.c
tools/ioemu/vl.c +8 -0
@@ -169,6 +169,9 @@ time_t timeoffset = 0;char domain_name[1024 ] = {'H' ,'V' ,'M' ,'X' ,'E' ,'N' ,'-' };extern int domid; + +char vncpasswd[64 ]; +unsigned char challenge[AUTHCHALLENGESIZE ];/***********************************************************/ /* x86 ISA bus support */
@@ -5901,6 +5904,7 @@ int main(int argc, char **argv) vncunused =0 ; kernel_filename =NULL ; kernel_cmdline ="" ; + *vncpasswd ='\0' ;#ifndef CONFIG_DM #ifdef TARGET_PPC cdrom_index =1 ;
@@ -6544,6 +6548,10 @@ int main(int argc, char **argv)init_ioports (); +/* read vncpasswd from xenstore */ +if (0 >xenstore_read_vncpasswd (domid)) +exit (1 ); +/* terminal init */ if (nographic) {dumb_display_init (ds);
tools/ioemu/vl.h +4 -0
@@ -1209,6 +1209,7 @@ void xenstore_process_event(void *opaquevoid xenstore_process_event (void *opaque);void xenstore_check_new_media_present (int timeout);void xenstore_write_vncport (int vnc_display); +int xenstore_read_vncpasswd (int domid);/* xen_platform.c */ void pci_xen_platform_init (PCIBus *bus);
@@ -1220,4 +1221,7 @@ extern char domain_name[];void destroy_hvm_domain (void ); +/* VNC Authentication */ +#define AUTHCHALLENGESIZE 16 +#endif /* VL_H */
tools/ioemu/vnc.c +107 -5
145 lines not on this page · raw message
tools/ioemu/xenstore.c +51 -0
54 lines not on this page · raw message
tools/python/xen/xend/XendRoot.py +6 -0
@@ -95,6 +95,8 @@ class XendRoot: dom0_min_mem_default = '0' dom0_vcpus_default = '0' + + vncpasswd_default = None components = {}
@@ -272,6 +274,10 @@ class XendRoot: def get_console_limit(self): return self.get_config_int('console-limit', 1024) + 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.
tools/python/xen/xend/image.py +22 -0
@@ -349,8 +349,16 @@ 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') + vncpasswd = vncpasswd_vmconfig + 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',
@@ -359,6 +367,20 @@ class HVMImageHandler(ImageHandler): vncunused = sxp.child_value(config, 'vncunused') if vncunused: ret += ['-vncunused'] + # get password from xend-config(if password omitted, None) + vncpasswd_default = xen.xend.XendRoot.instance().get_vncpasswd_default() + # password check + if vncpasswd is None: + if vncpasswd_default is None: + raise VmError('vncpasswd is not setuped in VMconfig and xend-config.') + else: + vncpasswd = vncpasswd_default + if vncpasswd!='': + self.vm.storeVm("vncpasswd", vncpasswd) + + # remove password + config.remove(['vncpasswd', vncpasswd_vmconfig]) + return ret def createDeviceModel(self):
tools/python/xen/xm/create.py +5 -0
@@ -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,
@@ -638,6 +642,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):
tools/ioemu/d3des.c new file +434 -0
434 lines not on this page · raw message
tools/ioemu/d3des.h new file +51 -0
51 lines not on this page · raw message
Quoted 4 lines · Masami Watanabe
Hi all,
This is take 4 on VNC authentification.
Quoted 8 lines
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.
The patch loooks good to me - unless Anthony spots any further issues in the VNC auth code, I'd say this is worth commiting to xen-unstable.hg whe 3.0.4 development opens up.
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 -=|
Quoted 16 lines · Daniel P. Berrange
Quoted 4 lines · Masami Watanabe
Hi all,
This is take 4 on VNC authentification.
Quoted 9 lines
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.
Quoted 4 lines
The patch loooks good to me - unless Anthony spots any further issues in the VNC auth code, I'd say this is worth commiting to xen-unstable.hg whe 3.0.4 development opens up.
Looks good to me too. Thanks Masami!
Regards,
Anthony Liguori
Quoted 3 lines
Regards,
Dan.
Hi Kier / Ewan,
Can we get Masami's VNC password patch into xen-unstable.
Regards,
Dan
Quoted 23 lines · Anthony Liguori
Quoted 16 lines · Daniel P. Berrange
Quoted 4 lines · Masami Watanabe
Hi all,
This is take 4 on VNC authentification.
Quoted 9 lines
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.Quoted 4 lines
The patch loooks good to me - unless Anthony spots any further issues in the VNC auth code, I'd say this is worth commiting to xen-unstable.hg whe 3.0.4 development opens up.
Looks good to me too. Thanks Masami!
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 -=|
The patch has been in for nearly a week, c/s 11840:02506a744315. Did you check before asking?
-- Keir
Quoted 31 lines · Daniel P. Berrange
Hi Kier / Ewan,
Can we get Masami's VNC password patch into xen-unstable.
Regards,
DanQuoted 23 lines · Anthony Liguori
Quoted 16 lines · Daniel P. Berrange
Quoted 4 lines · Masami Watanabe
Hi all,
This is take 4 on VNC authentification.
Quoted 9 lines
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.Quoted 4 lines
The patch loooks good to me - unless Anthony spots any further issues in the VNC auth code, I'd say this is worth commiting to xen-unstable.hg whe 3.0.4 development opens up.
Looks good to me too. Thanks Masami!
Quoted 2 lines · Keir Fraser
The patch has been in for nearly a week, c/s 11840:02506a744315. Did you check before asking?
Hmm, sorry - something went amiss with my script for syncing up with xen-devel & it wasn't seeing the updates.
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 -=|