From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMiN7-0001UX-Be for qemu-devel@nongnu.org; Wed, 18 May 2011 11:09:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMiN6-0003vm-7z for qemu-devel@nongnu.org; Wed, 18 May 2011 11:09:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMiN6-0003vU-0e for qemu-devel@nongnu.org; Wed, 18 May 2011 11:09:12 -0400 From: Gerd Hoffmann Date: Wed, 18 May 2011 17:09:01 +0200 Message-Id: <1305731343-27110-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1305731343-27110-1-git-send-email-kraxel@redhat.com> References: <1305731343-27110-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 4/6] spice: add SASL support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann From: Marc-Andr=C3=A9 Lureau Turn on SASL support by appending "sasl" to the spice arguments, which requires that the client use SASL to authenticate with the spice. The exact choice of authentication method used is controlled from the system / user's SASL configuration file for the 'qemu' service. This is typically found in /etc/sasl2/qemu.conf. If running QEMU as an unprivileged user, an environment variable SASL_CONF_PATH can be used to make it search alternate locations for the service config. While some SASL auth methods can also provide data encryption (eg GSSAPI), it is recommended that SASL always be combined with the 'tls' and 'x509' settings to enable use of SSL and server certificates. This ensures a data encryption preventing compromise of authentication credentials. It requires support from spice 0.8.1. [ kraxel: moved spell fix to separate commit ] Signed-off-by: Gerd Hoffmann --- qemu-config.c | 3 +++ qemu-options.hx | 13 +++++++++++++ ui/spice-core.c | 12 ++++++++++++ 3 files changed, 28 insertions(+), 0 deletions(-) diff --git a/qemu-config.c b/qemu-config.c index 04c97e5..b00aa3a 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -388,6 +388,9 @@ QemuOptsList qemu_spice_opts =3D { .name =3D "disable-copy-paste", .type =3D QEMU_OPT_BOOL, },{ + .name =3D "sasl", + .type =3D QEMU_OPT_BOOL, + },{ .name =3D "x509-dir", .type =3D QEMU_OPT_STRING, },{ diff --git a/qemu-options.hx b/qemu-options.hx index 63e8cb0..d9edff7 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -714,6 +714,19 @@ Force using the specified IP version. @item password=3D Set the password you need to authenticate. =20 +@item sasl +Require that the client use SASL to authenticate with the spice. +The exact choice of authentication method used is controlled from the +system / user's SASL configuration file for the 'qemu' service. This +is typically found in /etc/sasl2/qemu.conf. If running QEMU as an +unprivileged user, an environment variable SASL_CONF_PATH can be used +to make it search alternate locations for the service config. +While some SASL auth methods can also provide data encryption (eg GSSAPI= ), +it is recommended that SASL always be combined with the 'tls' and +'x509' settings to enable use of SSL and server certificates. This +ensures a data encryption preventing compromise of authentication +credentials. + @item disable-ticketing Allow client connects without authentication. =20 diff --git a/ui/spice-core.c b/ui/spice-core.c index a3351f3..457d34d 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -549,6 +549,18 @@ void qemu_spice_init(void) if (password) { spice_server_set_ticket(spice_server, password, 0, 0, 0); } + if (qemu_opt_get_bool(opts, "sasl", 0)) { +#if SPICE_SERVER_VERSION >=3D 0x000900 /* 0.9.0 */ + if (spice_server_set_sasl_appname(spice_server, "qemu") =3D=3D -= 1 || + spice_server_set_sasl(spice_server, 1) =3D=3D -1) { + fprintf(stderr, "spice: failed to enable sasl\n"); + exit(1); + } +#else + fprintf(stderr, "spice: sasl is not available (spice >=3D 0.9 re= quired)\n"); + exit(1); +#endif + } if (qemu_opt_get_bool(opts, "disable-ticketing", 0)) { auth =3D "none"; spice_server_set_noauth(spice_server); --=20 1.7.1