qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] PATCH 4/8: VeNCrypt basic TLS support
Date: Tue, 31 Jul 2007 20:50:29 -0500	[thread overview]
Message-ID: <46AFE6E5.8060401@codemonkey.ws> (raw)
In-Reply-To: <20070731192737.GM18730@redhat.com>

Daniel P. Berrange wrote:
> This patch introduces minimal support for the VeNCrypt protocol
> extension. This layers use of TLS (aka SSL) into the VNC data stream,
> providing session encryption. This patch is the bare minimum protocol
> support. It is enabled by using the 'tls' option flag eg "-vnc :1,tls'
> This is not secure on its own since it uses anonymous credentials.
> The next patches will introduce x509 certificate credentials.
>
> The configure script is setup to that TLS is only compiled in if the
> --enable-vnc-tls flag is provided. This should avoid any breakage on
> platforms without the GNU TLS libraries.
>
> diff -r a1fa771c6cf9 Makefile.target
> --- a/Makefile.target	Tue Jul 31 14:50:01 2007 -0400
> +++ b/Makefile.target	Tue Jul 31 14:50:03 2007 -0400
> @@ -402,6 +402,11 @@ endif
>  endif
>  AUDIODRV+= wavcapture.o
>  
> +ifdef CONFIG_VNC_TLS
> +CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
> +LIBS += $(CONFIG_VNC_TLS_LIBS)
> +endif
> +
>  VL_OBJS += i2c.o smbus.o
>  
>  # SCSI layer
> diff -r a1fa771c6cf9 configure
> --- a/configure	Tue Jul 31 14:50:01 2007 -0400
> +++ b/configure	Tue Jul 31 14:50:03 2007 -0400
> @@ -89,6 +89,7 @@ fmod="no"
>  fmod="no"
>  fmod_lib=""
>  fmod_inc=""
> +vnc_tls="no"
>  bsd="no"
>  linux="no"
>  kqemu="no"
> @@ -252,6 +253,8 @@ for opt do
>    ;;
>    --fmod-inc=*) fmod_inc="$optarg"
>    ;;
> +  --enable-vnc-tls) vnc_tls="yes"
> +  ;;
>    --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
>    ;;
>    --disable-slirp) slirp="no"
> @@ -362,6 +365,7 @@ echo "  --enable-alsa            enable 
>  echo "  --enable-alsa            enable ALSA audio driver"
>  echo "  --enable-fmod            enable FMOD audio driver"
>  echo "  --enable-dsound          enable DirectSound audio driver"
> +echo "  --enable-vnc-tls         enable TLS encryption for VNC server"
>  echo "  --enable-system          enable all system emulation targets"
>  echo "  --disable-system         disable all system emulation targets"
>  echo "  --enable-linux-user      enable all linux usermode emulation targets"
> @@ -589,6 +593,16 @@ fi # -z $sdl
>  fi # -z $sdl
>  
>  ##########################################
> +# VNC TLS detection
> +if test "$vnc_tls" = "yes" ; then
> +  `pkg-config gnutls` || vnc_tls="no"
> +fi
> +if test "$vnc_tls" = "yes" ; then
> +  vnc_tls_cflags=`pkg-config --cflags gnutls`
> +  vnc_tls_libs=`pkg-config --libs gnutls`
> +fi
> +
> +##########################################
>  # alsa sound support libraries

Since it's possible to probe for gnutls support, why not just enable it 
by default and disable it if it's not available?

> diff -r a1fa771c6cf9 vl.c
> --- a/vl.c	Tue Jul 31 14:50:01 2007 -0400
> +++ b/vl.c	Tue Jul 31 14:50:03 2007 -0400
> @@ -6458,7 +6458,7 @@ void main_loop_wait(int timeout)
>              if (FD_ISSET(ioh->fd, &rfds)) {
>                  ioh->fd_read(ioh->opaque);
>              }
> -            if (FD_ISSET(ioh->fd, &wfds)) {
> +            if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) {
>                  ioh->fd_write(ioh->opaque);
>              }
>          }
>   

I thought this was fixed already.  At any rate, it should be a separate 
patch.

> +#if CONFIG_VNC_TLS
> +ssize_t vnc_tls_push(gnutls_transport_ptr_t transport,
> +		     const void *data,
> +		     size_t len) {
> +    struct VncState *vs = (struct VncState *)transport;
> +    int ret, lastErrno;
>   

s/lastErrno/last_errno/g

> + retry:
> +    ret = send(vs->csock, data, len, 0);
> +    lastErrno = errno;
> +    VNC_DEBUG("Send %d errno %d\n", ret, ret < 0 ? lastErrno : 0);
> +    if (ret < 0) {
> +	if (lastErrno == EINTR)
> +	    goto retry;
> +	errno = lastErrno;
> +	return -1;
> +    }
> +    return ret;
> +}
>   

Regards,

Anthony Liguor

  reply	other threads:[~2007-08-01  1:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31 19:23 [Qemu-devel] PATCH 0/8: Authentication support for the VNC server Daniel P. Berrange
2007-07-31 19:25 ` [Qemu-devel] PATCH 1/8: Refactor VNC server setup API Daniel P. Berrange
2007-07-31 19:25 ` [Qemu-devel] PATCH 2/8: Extend monitor 'change' command for VNC Daniel P. Berrange
2007-08-01  1:43   ` Anthony Liguori
2007-07-31 19:26 ` [Qemu-devel] PATCH 3/8: VNC password authentication Daniel P. Berrange
2007-08-01  1:46   ` Anthony Liguori
2007-08-01 16:26     ` Daniel P. Berrange
2007-08-02 14:35       ` Anthony Liguori
2007-07-31 19:27 ` [Qemu-devel] PATCH 4/8: VeNCrypt basic TLS support Daniel P. Berrange
2007-08-01  1:50   ` Anthony Liguori [this message]
2007-08-01 16:28     ` Daniel P. Berrange
2007-07-31 19:28 ` [Qemu-devel] PATCH 5/8: x509 certificate for server Daniel P. Berrange
2007-07-31 19:28 ` [Qemu-devel] PATCH 6/8: x509 client certificate verification Daniel P. Berrange
2007-07-31 19:29 ` [Qemu-devel] PATCH 7/8: command line args for x509 cert paths Daniel P. Berrange
2007-08-01  1:54   ` Anthony Liguori
2007-08-01 16:31     ` Daniel P. Berrange
2007-07-31 19:30 ` [Qemu-devel] PATCH 8/8: document all VNC authentication options Daniel P. Berrange
2007-08-01  1:55 ` [Qemu-devel] PATCH 0/8: Authentication support for the VNC server Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2007-08-13 19:25 Daniel P. Berrange
2007-08-13 19:46 ` [Qemu-devel] PATCH 4/8: VeNCrypt basic TLS support Daniel P. Berrange

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=46AFE6E5.8060401@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).