From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPf73-0000GX-Vk for qemu-devel@nongnu.org; Thu, 04 Sep 2014 18:02:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPf6w-0003W0-Fo for qemu-devel@nongnu.org; Thu, 04 Sep 2014 18:02:41 -0400 Received: from barbershop.grep.be ([89.106.240.122]:51933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPf6w-0003VP-A2 for qemu-devel@nongnu.org; Thu, 04 Sep 2014 18:02:34 -0400 Date: Fri, 5 Sep 2014 00:02:18 +0200 From: Wouter Verhelst Message-ID: <20140904220218.GA25871@grep.be> References: <20140903164417.GA32748@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140903164417.GA32748@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] NBD TLS support in QEMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: libvir-list@redhat.com, nbd-general@lists.sf.net, qemu-devel@nongnu.org, Max Reitz , Hani Benhabiles , nick@bytemark.co.uk, Paolo Bonzini [Cc: to nbd-general list added] On Wed, Sep 03, 2014 at 05:44:17PM +0100, Stefan Hajnoczi wrote: > Hi, > QEMU offers both NBD client and server functionality. The NBD protocol > runs unencrypted, which is a problem when the client and server > communicate over an untrusted network. > > The particular use case that prompted this mail is storage migration in > OpenStack. The goal is to encrypt the NBD connection between source and > destination hosts during storage migration. I've never given encrypted NBD high priority, since I don't think encryption without authentication serves much purpose -- and I haven't gotten around to adding authentication yet (for which I have plans; but other things have priority). > I think we can integrate TLS into the NBD protocol as an optional flag. > A quick web search does not reveal existing open source SSL/TLS NBD > implementations. I do see a VMware NBDSSL protocol but there is no > specification so I guess it is proprietary. > > The NBD protocol starts with a negotiation phase. This would be the > appropriate place to indicate that TLS will be used. After client and > server complete TLS setup the connection can continue as normal. > > Besides QEMU, the userspace NBD tools (http://nbd.sf.net/) can also be > extended to support TLS. In this case the kernel needs a localhost > socket and userspace handles TLS. That introduces a possibility for a deadlock, since now your network socket isn't on the PF_MEMALLOC-protected socket anymore, which will cause the kernel to throw away packets which are needed for your nbd connection, in hopes of clearing some memory. I suppose you could theoretically do the encryption in kernel space. Not convinced that trying TLS in kernel space is a good idea, though. I have heard of people using stunnel or the likes to pipe the NBD protocol over a secure channel, with various levels of success. -- It is easy to love a country that is famous for chocolate and beer -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26