]> git.proxmox.com Git - qemu.git/commitdiff
spice: add SASL support
authorMarc-André Lureau <marcandre.lureau@gmail.com>
Tue, 17 May 2011 08:40:33 +0000 (10:40 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 6 Jun 2011 07:14:42 +0000 (09:14 +0200)
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 <kraxel@redhat.com>
qemu-config.c
qemu-options.hx
ui/spice-core.c

index 04c97e52c27588faff0cfe5d473c85fbcb5ca48b..b00aa3ae893b31c00178211a8afb44ed9d274ee6 100644 (file)
@@ -387,6 +387,9 @@ QemuOptsList qemu_spice_opts = {
         },{
             .name = "disable-copy-paste",
             .type = QEMU_OPT_BOOL,
+        },{
+            .name = "sasl",
+            .type = QEMU_OPT_BOOL,
         },{
             .name = "x509-dir",
             .type = QEMU_OPT_STRING,
index 63e8cb0a1b8db1860fcc9dfa4012028e001405b7..d9edff7d35f50795e732551515630c5c34578398 100644 (file)
@@ -714,6 +714,19 @@ Force using the specified IP version.
 @item password=<secret>
 Set the password you need to authenticate.
 
+@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.
 
index a3351f39b576abc5782673c50679b40367938c90..457d34d8bd647ac92233476008f8973be1ef6b52 100644 (file)
@@ -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 >= 0x000900 /* 0.9.0 */
+        if (spice_server_set_sasl_appname(spice_server, "qemu") == -1 ||
+            spice_server_set_sasl(spice_server, 1) == -1) {
+            fprintf(stderr, "spice: failed to enable sasl\n");
+            exit(1);
+        }
+#else
+        fprintf(stderr, "spice: sasl is not available (spice >= 0.9 required)\n");
+        exit(1);
+#endif
+    }
     if (qemu_opt_get_bool(opts, "disable-ticketing", 0)) {
         auth = "none";
         spice_server_set_noauth(spice_server);