All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Masami Watanabe <masami.watanabe@jp.fujitsu.com>
Cc: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>,
	Anthony Liguori <aliguori@us.ibm.com>,
	xen-devel@lists.xensource.com
Subject: Re: [PATCH][Take 2] VNC authentification
Date: Mon, 2 Oct 2006 17:22:32 +0100	[thread overview]
Message-ID: <20061002162232.GB1730@redhat.com> (raw)
In-Reply-To: <JH200610010353334.2150046@jp.fujitsu.com>

On Sun, Oct 01, 2006 at 03:53:33AM +0900, Masami Watanabe wrote:
> Hi Dan,
> 
> I post patch that reflects your point.
> However, Now, I can not use standard VNC clients to server.
> therefore, I cannot do final test. It becomes possible on next Tuesday.
> Please forgive my post, it is current update.

The Python XenD bits of your latest patch all look good to me now - thanks 
for taking time to address the issues.

I've compiled the patches against latest Xen going into Fedora Core 6, 
and the password authentication does appear to be working as expected.
Only issue was that I forgot the password in the VM config file needed
to be the base64 encoded, DES-encrypted format - once I sorted that
out it worked fine. 

> --- a/tools/examples/xend-config.sxp	Wed Sep 27 17:49:22 2006 +0100
> +++ b/tools/examples/xend-config.sxp	Sun Oct 01 02:13:06 2006 +0900
> @@ -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 '')

We should add a note about this needing to be the base-64 encoded, 
DES encrypted password, rather than plain text.

> diff -r 1d0e75523636 tools/examples/xmexample.hvm
> --- a/tools/examples/xmexample.hvm	Wed Sep 27 17:49:22 2006 +0100
> +++ b/tools/examples/xmexample.hvm	Sun Oct 01 02:13:06 2006 +0900
> @@ -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=''

Again add a comment about the format.

> +static int make_challenge(char *random, int size)
> +{
> +    FILE *fp;
> +    int readsize;
> +
> +    fp = fopen("/dev/random", "r");
> +    if (!fp) {
> +	fprintf(stderr, "make_challenge: no OS supplied /dev/random\n");
> +	exit(1);
> +    }
> +    readsize = fread(random, size, 1, fp);
> +    fclose(fp);
> +
> +    return 0;
> +}

Using /dev/random for this is rather overkill for VNC. I very quickly 
exhausted my machine's entropy pool after connecting & disconnecting
a couple of times over.  The regular VNC server sources just call the
standard C 'random()'  function CHALLENGESIZE times over to get some
random bytes  (and seed the random pool at startup based on time & pid). 

> +
> +int xenstore_read_vncpasswd(int domid)
> +{
> +    extern char vncpasswd[64];
> +    char *buf = NULL, *path, *uuid = NULL, *passwd = NULL;
> +    unsigned int i, len, rc = 0;
> +
> +    if (xsh == NULL) {
> +	return -1;
> +    }
> +
> +    path = xs_get_domain_path(xsh, domid);
> +    if (path == NULL) {
> +        fprintf(logfile, "xs_get_domain_path() error\n");
> +        return -1;
> +    }
> +
> +    pasprintf(&buf, "%s/vm", path);
> +    uuid = xs_read(xsh, XBT_NULL, buf, &len);
> +    if (uuid == NULL) {
> +        fprintf(logfile, "xs_read(): uuid get error\n");
> +	free(path);
> +	return -1;
> +    }
> +
> +    pasprintf(&buf, "%s/vncpasswd", uuid);
> +    passwd = xs_read(xsh, XBT_NULL, buf, &len);
> +    if (passwd == NULL) {
> +        free(uuid);
> +	free(path);
> +	return rc;
> +    }
> +
> +    for (i=0; i<len; i++) {
> +        vncpasswd[i] = passwd[i];
> +        passwd[i] = '\0';
> +    }
> +    vncpasswd[len] = '\0';

Should check for buffer overflow since 'vncpasswd' is only 64 bytes
long.

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  -=| 

  reply	other threads:[~2006-10-02 16:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-26 18:23 Individual passwords for guest VNC servers ? Ian Pratt
2006-09-28  1:01 ` Masami Watanabe
2006-09-29  8:47 ` [PATCH][Take 2] VNC authentification Masami Watanabe
2006-09-29 14:01   ` Anthony Liguori
2006-09-30 18:47     ` masami.watanabe
2006-09-29 22:11   ` Daniel P. Berrange
2006-09-30 18:53     ` Masami Watanabe
2006-10-02 16:22       ` Daniel P. Berrange [this message]
2006-10-02 17:24         ` Anthony Liguori
2006-10-02 18:12           ` Daniel P. Berrange
2006-10-02 19:15             ` Ian Pratt
2006-10-03  2:04               ` Masami Watanabe
2006-10-03 16:08               ` [PATCH][Take 3] " Masami Watanabe
2006-10-03 17:56                 ` Anthony Liguori
2006-10-03 18:06                   ` Daniel P. Berrange
2006-10-03 18:49                     ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061002162232.GB1730@redhat.com \
    --to=berrange@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=m+Ian.Pratt@cl.cam.ac.uk \
    --cc=masami.watanabe@jp.fujitsu.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.