spice config options
cover spice config options
Hi,
This patch series adds a bunch of config options to spice, most notably it enables to configure TLS and thus using spice encrypted. The commit messages are not that verbose, but every patch comes with a patch chunk updating the spice section in the documentation. Please look there when reviewing the patches.
The patches are also available in the git repository at:
git://anongit.freedesktop.org/spice/qemu config.1
Gerd Hoffmann (4):
spice: tls support
spice: add config options for channel security.
spice: add config options for the listening address
spice: add misc config options
Yonit Halperin (1):
spice: make compression configurable.
qemu-config.c | 57 +++++++++++++++ qemu-options.hx | 51 +++++++++++++- ui/spice-core.c | 205 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 306 insertions(+), 7 deletions(-)
PATCH 1/5 spice: tls support
Add options to the -spice command line switch to setup tls.
--- qemu-config.c | 24 +++++++++++++++++++ qemu-options.hx | 18 ++++++++++++++- ui/spice-core.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 104 insertions(+), 5 deletions(-)
qemu-config.c +24 -0
@@ -362,11 +362,35 @@ QemuOptsList qemu_spice_opts = { .name = "port", .type = QEMU_OPT_NUMBER, },{ + .name = "tls-port", + .type = QEMU_OPT_NUMBER, + },{ .name = "password", .type = QEMU_OPT_STRING, },{ .name = "disable-ticketing", .type = QEMU_OPT_BOOL, + },{ + .name = "x509-dir", + .type = QEMU_OPT_STRING, + },{ + .name = "x509-key-file", + .type = QEMU_OPT_STRING, + },{ + .name = "x509-key-password", + .type = QEMU_OPT_STRING, + },{ + .name = "x509-cert-file", + .type = QEMU_OPT_STRING, + },{ + .name = "x509-cacert-file", + .type = QEMU_OPT_STRING, + },{ + .name = "x509-dh-key-file", + .type = QEMU_OPT_STRING, + },{ + .name = "tls-ciphers", + .type = QEMU_OPT_STRING, }, { /* end if list */ } },
qemu-options.hx +17 -1
@@ -680,7 +680,7 @@ Enable the spice remote desktop protocol. Valid options are @table @option @item port=<nr> -Set the TCP port spice is listening on. +Set the TCP port spice is listening on for plaintext channels. @item password=<secret> Set the password you need to authenticate.
@@ -688,6 +688,22 @@ Set the password you need to authenticate. @item disable-ticketing Allow client connects without authentication. +@item tls-port=<nr> +Set the TCP port spice is listening on for encrypted channels. + +@item x509-dir=<dir> +Set the x509 file directory. Expects same filenames as -vnc $display,x509=$dir + +@item x509-key-file=<file> +@item x509-key-password=<file> +@item x509-cert-file=<file> +@item x509-cacert-file=<file> +@item x509-dh-key-file=<file> +The x509 file names can also be configured individually. + +@item tls-ciphers=<list> +Specify which ciphers to use. + @end table ETEXI
ui/spice-core.c +63 -4
95 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 2/5 spice: make compression configurable.
In reply to Gerd HoffmannFrom: Yonit Halperin <[email protected]>
--- qemu-config.c | 9 ++++++ qemu-options.hx | 9 ++++++ ui/spice-core.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 93 insertions(+), 2 deletions(-)
qemu-config.c +9 -0
@@ -391,6 +391,15 @@ QemuOptsList qemu_spice_opts = { },{ .name = "tls-ciphers", .type = QEMU_OPT_STRING, + },{ + .name = "image-compression", + .type = QEMU_OPT_STRING, + },{ + .name = "jpeg-wan-compression", + .type = QEMU_OPT_STRING, + },{ + .name = "zlib-glz-wan-compression", + .type = QEMU_OPT_STRING, }, { /* end if list */ } },
qemu-options.hx +9 -0
@@ -704,6 +704,15 @@ The x509 file names can also be configured individually. @item tls-ciphers=<list> Specify which ciphers to use. +@item image-compression=[auto_glz|auto_lz|quic|glz|lz|off] +Configure image compression (lossless). +Default is auto_glz. + +@item jpeg-wan-compression=[auto|never|allways] +@item zlib-glz-wan-compression=[auto|never|allways] +Configure wan image compression (lossy for slow links). +Default is auto. + @end table ETEXI
ui/spice-core.c +75 -2
95 lines not on this page · raw message
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 2/5] spice: make compression configurable.
Quoted 2 lines · Gerd Hoffmann
From: Yonit Halperin <[email protected]>
No description?
Quoted 35 lines
---
qemu-config.c | 9 ++++++
qemu-options.hx | 9 ++++++
ui/spice-core.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++-3 files changed, 93 insertions(+), 2 deletions(-)qemu-config.c +9
-0@@ -391,6 +391,15 @@ QemuOptsList qemu_spice_opts = { },{ .name = "tls-ciphers", .type = QEMU_OPT_STRING, + },{ + .name = "image-compression", + .type = QEMU_OPT_STRING, + },{ + .name = "jpeg-wan-compression", + .type = QEMU_OPT_STRING, + },{ + .name = "zlib-glz-wan-compression", + .type = QEMU_OPT_STRING, }, { /* end if list */ } },qemu-options.hx +0
-0@@ -704,6 +704,15 @@ The x509 file names can also be configured individually.@item tls-ciphers=<list>
Specify which ciphers to use.+@item image-compression=[auto_glz|auto_lz|quic|glz|lz|off]
qemu-options.hx The x509 file names can also be configured individually. · line 712
Quoted 5 lines
qemu-options.hx +5
-0+Configure image compression (lossless). +Default is auto_glz. + +@item jpeg-wan-compression=[auto|never|allways] +@item zlib-glz-wan-compression=[auto|never|allways]
'allways' does not match what the code uses:
Quoted 1 line
+ [
SPICE_WAN_COMPRESSION_ALWAYS] = "always",
Re: [Qemu-devel] [PATCH 2/5] spice: make compression configurable.
Quoted 5 lines · Blue Swirl
Quoted 2 lines · Gerd Hoffmann
From: Yonit Halperin<[email protected]>
No description?
Detailed description comes here:
Quoted 6 lines
Quoted 6 lines
qemu-options.hx +0
-0@@ -704,6 +704,15 @@ The x509 file names can also be configured individually. @item tls-ciphers=<list> Specify which ciphers to use.
Quoted 10 lines
qemu-options.hx The x509 file names can also be configured individually. · line 712
Quoted 6 lines
qemu-options.hx +6
-0+@item image-compression=[auto_glz|auto_lz|quic|glz|lz|off] +Configure image compression (lossless). +Default is auto_glz. + +@item jpeg-wan-compression=[auto|never|allways] +@item zlib-glz-wan-compression=[auto|never|allways]'allways' does not match what the code uses:
Quoted 1 line
qemu-options.hx +1
-0+ [ SPICE_WAN_COMPRESSION_ALWAYS ] = "always",
Good catch, will fix.
thanks,
Gerd
PATCH 3/5 spice: add config options for channel security.
In reply to Gerd HoffmannThis allows to enforce tls or plaintext usage for certain spice channels.
--- qemu-config.c | 6 ++++++ qemu-options.hx | 8 ++++++++ ui/spice-core.c | 25 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 0 deletions(-)
qemu-config.c +6 -0
@@ -392,6 +392,12 @@ QemuOptsList qemu_spice_opts = { .name = "tls-ciphers", .type = QEMU_OPT_STRING, },{ + .name = "tls-channel", + .type = QEMU_OPT_STRING, + },{ + .name = "plaintext-channel", + .type = QEMU_OPT_STRING, + },{ .name = "image-compression", .type = QEMU_OPT_STRING, },{
qemu-options.hx +8 -0
@@ -704,6 +704,14 @@ The x509 file names can also be configured individually. @item tls-ciphers=<list> Specify which ciphers to use. +@item tls-channel=[main|display|inputs|record|playback|tunnel] +@item plaintext-channel=[main|display|inputs|record|playback|tunnel] +Force specific channel to be used with or without TLS encryption. The +options can be specified multiple times to configure multiple +channels. The special name "default" can be used to set the default +mode. For channels which are not explicitly forced into one mode the +spice client is allowed to pick tls/plaintext as he pleases. + @item image-compression=[auto_glz|auto_lz|quic|glz|lz|off] Configure image compression (lossless). Default is auto_glz.
ui/spice-core.c +25 -0
@@ -192,6 +192,29 @@ static const char *wan_compression_names[] = {/* functions for the rest of qemu */ +static int add_channel (const char *name,const char *value,void *opaque) +{ +int security =0 ; +int rc; + +if (strcmp (name,"tls-channel" ) ==0 ) + security =SPICE_CHANNEL_SECURITY_SSL ; +if (strcmp (name,"plaintext-channel" ) ==0 ) + security =SPICE_CHANNEL_SECURITY_NONE ; +if (security ==0 ) +return 0 ; +if (strcmp (value,"default" ) ==0 ) { + rc =spice_server_set_channel_security (spice_server,NULL , security); + }else { + rc =spice_server_set_channel_security (spice_server, value, security); + } +if (rc !=0 ) { +fprintf (stderr,"spice: failed to set channel security for %s\n" , value); +exit (1 ); + } +return 0 ; +} +void qemu_spice_init (void ) {QemuOpts *opts =QTAILQ_FIRST (&qemu_spice_opts.head);
@@ -293,6 +316,8 @@ void qemu_spice_init(void) }spice_server_set_zlib_glz_compression (spice_server, wan_compr); +qemu_opt_foreach (opts, add_channel,NULL ,0 ); +spice_server_init (spice_server, &core_interface); using_spice =1 ;
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 3/5] spice: add config options for channel security.
Am 07.10.2010 09:55, schrieb Gerd Hoffmann:
Quoted 50 lines
This allows to enforce tls or plaintext usage for certain spice channels.
--- qemu-config.c | 6 ++++++ qemu-options.hx | 8 ++++++++ ui/spice-core.c | 25 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 0 deletions(-)qemu-config.c +6
-0@@ -392,6 +392,12 @@ QemuOptsList qemu_spice_opts = { .name = "tls-ciphers", .type = QEMU_OPT_STRING, },{ + .name = "tls-channel", + .type = QEMU_OPT_STRING, + },{ + .name = "plaintext-channel", + .type = QEMU_OPT_STRING, + },{ .name = "image-compression", .type = QEMU_OPT_STRING, },{qemu-options.hx +8
-0@@ -704,6 +704,14 @@ The x509 file names can also be configured individually. @item tls-ciphers=<list> Specify which ciphers to use. +@item tls-channel=[main|display|inputs|record|playback|tunnel] +@item plaintext-channel=[main|display|inputs|record|playback|tunnel] +Force specific channel to be used with or without TLS encryption. The +options can be specified multiple times to configure multiple +channels. The special name "default" can be used to set the default +mode. For channels which are not explicitly forced into one mode the +spice client is allowed to pick tls/plaintext as he pleases. + @item image-compression=[auto_glz|auto_lz|quic|glz|lz|off] Configure image compression (lossless). Default is auto_glz.ui/spice-core.c +0
-0@@ -192,6 +192,29 @@ static const char *wan_compression_names[] = {
ui/spice-core.c static const char *wan_compression_names[] = { · line 202
Quoted 10 lines
ui/spice-core.c +7
-0/* functions for the rest of qemu */ +static int add_channel (const char *name,const char *value,void *opaque) +{ +int security =0 ; +int rc; + +if (strcmp (name,"tls-channel" ) ==0 ) + security =SPICE_CHANNEL_SECURITY_SSL ;
CODING_STYLE (if (...) { ... })? Same in next lines.
Quoted 29 lines
ui/spice-core.c +16
-0+if (strcmp (name,"plaintext-channel" ) ==0 ) + security =SPICE_CHANNEL_SECURITY_NONE ; +if (security ==0 ) +return 0 ; +if (strcmp (value,"default" ) ==0 ) { + rc =spice_server_set_channel_security (spice_server,NULL , security); + }else { + rc =spice_server_set_channel_security (spice_server, value, security); + } +if (rc !=0 ) { +fprintf (stderr,"spice: failed to set channel security for %s\n" , value); +exit (1 ); + } +return 0 ; +} +void qemu_spice_init (void ) {QemuOpts *opts = QTAILQ_FIRST(&qemu_spice_opts.head);ui/spice-core.c +2
-0@@ -293,6 +316,8 @@ void qemu_spice_init(void) }spice_server_set_zlib_glz_compression (spice_server, wan_compr); +qemu_opt_foreach (opts, add_channel,NULL ,0 ); +spice_server_init (spice_server,&core_interface); using_spice =1 ;
Re: [Qemu-devel] [PATCH 3/5] spice: add config options for channel security.
Quoted 4 lines
Quoted 2 lines
+ if (
strcmp(name, "tls-channel")== 0)
+ security =SPICE_CHANNEL_SECURITY_SSL;
CODING_STYLE(if (...) { ... })? Same in next lines.
Oops. Slipped through, will fix.
thanks,
Gerd
PATCH 4/5 spice: add config options for the listening address
In reply to Gerd HoffmannMake listening address configurable. Also add options to force using IPv4 or IPv6.
--- qemu-config.c | 9 +++++++++ qemu-options.hx | 7 +++++++ ui/spice-core.c | 13 +++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-)
qemu-config.c +9 -0
@@ -365,6 +365,15 @@ QemuOptsList qemu_spice_opts = { .name = "tls-port", .type = QEMU_OPT_NUMBER, },{ + .name = "addr", + .type = QEMU_OPT_STRING, + },{ + .name = "ipv4", + .type = QEMU_OPT_BOOL, + },{ + .name = "ipv6", + .type = QEMU_OPT_BOOL, + },{ .name = "password", .type = QEMU_OPT_STRING, },{
qemu-options.hx +7 -0
@@ -682,6 +682,13 @@ Enable the spice remote desktop protocol. Valid options are @item port=<nr> Set the TCP port spice is listening on for plaintext channels. +@item addr=<addr> +Set the IP address spice is listening on. Default is any address. + +@item ipv4 +@item ipv6 +Force using the specified IP version. + @item password=<secret> Set the password you need to authenticate.
ui/spice-core.c +11 -2
@@ -218,14 +218,14 @@ static int add_channel(const char *name, const char *value, void *opaque)void qemu_spice_init (void ) {QemuOpts *opts =QTAILQ_FIRST (&qemu_spice_opts.head); -const char *password, *str, *x509_dir, +const char *password, *str, *x509_dir, *addr, *x509_key_password =NULL , *x509_dh_file =NULL , *tls_ciphers =NULL ;char *x509_key_file =NULL , *x509_cert_file =NULL , *x509_cacert_file =NULL ; -int port, tls_port, len; +int port, tls_port, len, addr_flags;spice_image_compression_t compression;spice_wan_compression_t wan_compr;
@@ -275,7 +275,16 @@ void qemu_spice_init(void) tls_ciphers =qemu_opt_get (opts,"tls-ciphers" ); } + addr =qemu_opt_get (opts,"addr" ); + addr_flags =0 ; +if (qemu_opt_get_bool (opts,"ipv4" ,0 )) { + addr_flags |=SPICE_ADDR_FLAG_IPV4_ONLY ; + }else if (qemu_opt_get_bool (opts,"ipv6" ,0 )) { + addr_flags |=SPICE_ADDR_FLAG_IPV6_ONLY ; + } + spice_server =spice_server_new (); +spice_server_set_addr (spice_server, addr ? addr :"" , addr_flags);if (port) {spice_server_set_port (spice_server, port); }
Signature · 1 line
1.7.1
PATCH 5/5 spice: add misc config options
In reply to Gerd HoffmannThis patch adds a few more options to tweak spice server behavior. The documentation update chunk has the details ;)
--- qemu-config.c | 9 +++++++++ qemu-options.hx | 9 +++++++++ ui/spice-core.c | 29 ++++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 1 deletions(-)
qemu-config.c +9 -0
@@ -415,6 +415,15 @@ QemuOptsList qemu_spice_opts = { },{ .name = "zlib-glz-wan-compression", .type = QEMU_OPT_STRING, + },{ + .name = "streaming-video", + .type = QEMU_OPT_STRING, + },{ + .name = "agent-mouse", + .type = QEMU_OPT_BOOL, + },{ + .name = "playback-compression", + .type = QEMU_OPT_BOOL, }, { /* end if list */ } },
qemu-options.hx +9 -0
@@ -728,6 +728,15 @@ Default is auto_glz. Configure wan image compression (lossy for slow links). Default is auto. +@item streaming-video=[off|all|filter] +Configure video stream detection. Default is filter. + +@item agent-mouse=[on|off] +Enable/disable passing mouse events via vdagent. Default is on. + +@item playback-compression=[on|off] +Enable/disable audio stream compression (using celt 0.5.1). Default is on. + @end table ETEXI
ui/spice-core.c +28 -1
@@ -169,6 +169,18 @@ static int parse_name(const char *string, const char *optname,exit (1 ); } +#if SPICE_SERVER_VERSION >=0x000600 /* 0.6.0 */ + +static const char *stream_video_names[] = { + [SPICE_STREAM_VIDEO_OFF ] ="off" , + [SPICE_STREAM_VIDEO_ALL ] ="all" , + [SPICE_STREAM_VIDEO_FILTER ] ="filter" , +}; +#define parse_stream_video (_name) \ + name2enum(_name, stream_video_names, ARRAY_SIZE(stream_video_names)) + +#endif /* >= 0.6.0 */ +static const char *compression_names[] = { [SPICE_IMAGE_COMPRESS_OFF ] ="off" , [SPICE_IMAGE_COMPRESS_AUTO_GLZ ] ="auto_glz" ,
@@ -225,7 +237,7 @@ void qemu_spice_init(void)char *x509_key_file =NULL , *x509_cert_file =NULL , *x509_cacert_file =NULL ; -int port, tls_port, len, addr_flags; +int port, tls_port, len, addr_flags, streaming_video;spice_image_compression_t compression;spice_wan_compression_t wan_compr;
@@ -325,6 +337,21 @@ void qemu_spice_init(void) }spice_server_set_zlib_glz_compression (spice_server, wan_compr); +#if SPICE_SERVER_VERSION >=0x000600 /* 0.6.0 */ + + str =qemu_opt_get (opts,"streaming-video" ); +if (str) { + streaming_video =parse_stream_video (str); +spice_server_set_streaming_video (spice_server, streaming_video); + } + +spice_server_set_agent_mouse + (spice_server,qemu_opt_get_bool (opts,"agent-mouse" ,1 )); +spice_server_set_playback_compression + (spice_server,qemu_opt_get_bool (opts,"playback-compression" ,1 )); + +#endif /* >= 0.6.0 */ +qemu_opt_foreach (opts, add_channel,NULL ,0 );spice_server_init (spice_server, &core_interface);
Signature · 1 line
1.7.1