qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org,
	"open list:Network Block Dev..." <qemu-block@nongnu.org>,
	rjones@redhat.com
Subject: Re: [Qemu-devel] [PATCH] qemu-nbd: Permit TLS with Unix sockets
Date: Thu, 27 Jun 2019 10:37:52 -0500	[thread overview]
Message-ID: <fd45bfbe-f8a3-afd9-1230-798f4c647d30@redhat.com> (raw)
In-Reply-To: <20190627145850.GN12358@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 2336 bytes --]

On 6/27/19 9:58 AM, Daniel P. Berrangé wrote:

>>>
>>> Do you need something on the client side too ?
>>
>> The proposal that Rich is working on for standardized NBD URIs [1] says
>> that we need a patch to support nbds://host/export and
>> nbds+unix://export?socket=/path as ways to request an encrypted client
>> connection with default encryption parameters. For anything more
>> complex, we have to use --imageopts and request an encrypted connection
>> by parts - but the QAPI schema already permits us to pass in an
>> 'tls-creds' parameter for both TCP and Unix sockets, so no, I don't
>> think we need any client side changes at this point.

Okay, I just tested that pre-patch, qemu-nbd --list refuses to connect,
but post-patch it works:

$ ./qemu-nbd -r -k /tmp/nbdsock --object \
  tls-creds-psk,id=tls0,endpoint=server,dir=/home/eblake/libnbd/tests \
  --tls-creds tls0 -f raw -x / ./file
$ qemu-nbd --list -k /tmp/nbdsock --object \

tls-creds-psk,id=tls0,endpoint=client,dir=/home/eblake/libnbd/tests,username=eblake
\
  --tls-creds tls0
qemu-nbd: TLS is only supported with IPv4/IPv6
$ ./qemu-nbd --list -k /tmp/nbdsock --object \

tls-creds-psk,id=tls0,endpoint=client,dir=/home/eblake/libnbd/tests,username=eblake
\
  --tls-creds tls0
exports available: 1
...

> 
> The QAPI schema isn't what I was thinking about....  in block/nbd.c
> we have the same restriction you lifted here
> 
>         tlscreds = nbd_get_tls_creds(s->tlscredsid, errp);
>         if (!tlscreds) {
>             goto error;
>         }
> 
>         /* TODO SOCKET_ADDRESS_KIND_FD where fd has AF_INET or AF_INET6 */
>         if (s->saddr->type != SOCKET_ADDRESS_TYPE_INET) {
>             error_setg(errp, "TLS only supported over IP sockets");
>             goto error;
>         }

Oh. Yeah, I'll have to fix that; it's different than qemu-nbd --list.

> 
> For client side we would also need to allow a 'tls-hostname' parameter
> in BlockdevOptionsNbd, so that the client can pass a hostname to use
> for validating the x509 certificate, the same way we allow for live
> migration.

Okay, v2 coming up later, once I've done more integration testing.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-06-27 16:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26  2:49 [Qemu-devel] [PATCH] qemu-nbd: Permit TLS with Unix sockets Eric Blake
2019-06-26  8:22 ` Daniel P. Berrangé
2019-06-27 14:49   ` Eric Blake
2019-06-27 14:58     ` Daniel P. Berrangé
2019-06-27 15:37       ` Eric Blake [this message]
2019-06-26  8:52 ` Richard W.M. Jones

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=fd45bfbe-f8a3-afd9-1230-798f4c647d30@redhat.com \
    --to=eblake@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /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).