qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Who / what uses QMP command add_client?


From: Daniel P . Berrangé
Subject: Re: Who / what uses QMP command add_client?
Date: Tue, 29 Nov 2022 15:07:43 +0000
User-agent: Mutt/2.2.7 (2022-08-07)

On Tue, Nov 29, 2022 at 03:54:56PM +0100, Markus Armbruster wrote:
> QMP command add_client's schema:
> 
>     ##
>     # @add_client:
>     #
>     # Allow client connections for VNC, Spice and socket based
>     # character devices to be passed in to QEMU via SCM_RIGHTS.
>     #
>     # @protocol: protocol name. Valid names are "vnc", "spice", 
> "@dbus-display" or
>     #            the name of a character device (eg. from -chardev id=XXXX)
>     #
>     # @fdname: file descriptor name previously passed via 'getfd' command
>     #
>     # @skipauth: whether to skip authentication. Only applies
>     #            to "vnc" and "spice" protocols
>     #
>     # @tls: whether to perform TLS. Only applies to the "spice"
>     #       protocol
>     #
>     # Returns: nothing on success.
>     #
>     # Since: 0.14
>     #
>     # Example:
>     #
>     # -> { "execute": "add_client", "arguments": { "protocol": "vnc",
>     #                                              "fdname": "myclient" } }
>     # <- { "return": {} }
>     #
>     ##
>     { 'command': 'add_client',
>       'data': { 'protocol': 'str', 'fdname': 'str', '*skipauth': 'bool',
>                 '*tls': 'bool' } }
> 
> Spot the design flaw!
> 
> It's overloaded @protocol.  Two issues.

My bad. Can't imagine why I called its impl add_graphics_client
but then made it work for graphics clients and chardevs all
the way back in day 1.

> 
> One, character device IDs "vnc", "spice", "@dbus-display" don't work
> here.  If we ever add another protocol, we make another device ID not
> work.  Perhaps this is why Marc-André chose "@dbus-display", which
> otherwise looks like a typo :)
> 
> Two, introspection can't tell us what protocols are supported.
> 
> As far as I can tell, libvirt does not use this with character devices.
> It does use the other three protocols.
> 
> Are there any known uses with character devices?
> 
> If not, any ideas why one would want to use the command with character
> devices?

Ordinarily a client will directly connect() to QEMU to setup the
socket connection. Depending on the protocol this may involve both
TLS negotiation and authentication. This is a good thing when exposed
over a public IP address. It is tedious when connecting from a local
client though.

The idea behind the 'add_client' method was to enable short circuiting
of encryption and authentication, for local only clients. For example,
virt-viewer/virt-manager can do socketpair() and pass one of the FDs
across to QEMU, and bypass any VNC authentication. This is still secure,
as FD passing is mediated by libvirt which the app has already
authenticated against.

This is conceptually useful for any backend exposed as a network
socket, accepting ad-hoc client connections. So it is in scope for
chardevs, nbd, vnc, spice.

I notice another flaw for chardevs though - we're ignoring thue
'skipauth' parameter, so we're failing to skip TLS on chardevs
should anyone try to use this.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]