From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M3UDW-0004WW-3a for qemu-devel@nongnu.org; Mon, 11 May 2009 08:02:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M3UDQ-0004UA-U6 for qemu-devel@nongnu.org; Mon, 11 May 2009 08:02:45 -0400 Received: from [199.232.76.173] (port=39124 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3UDQ-0004U2-ES for qemu-devel@nongnu.org; Mon, 11 May 2009 08:02:40 -0400 Received: from mail-gx0-f176.google.com ([209.85.217.176]:41952) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M3UDP-00077p-E9 for qemu-devel@nongnu.org; Mon, 11 May 2009 08:02:39 -0400 Received: by mail-gx0-f176.google.com with SMTP id 24so7809192gxk.10 for ; Mon, 11 May 2009 05:02:39 -0700 (PDT) Message-ID: <4A0813D6.3050609@codemonkey.ws> Date: Mon, 11 May 2009 07:02:30 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Transforming stdin and stdout pair into a socket References: <8e04b5820905101119u39ae84bfp1bae24be6e057086@mail.gmail.com> In-Reply-To: <8e04b5820905101119u39ae84bfp1bae24be6e057086@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Ciprian Dorin, Craciun" Cc: nbd-general@lists.sourceforge.net, linux-newbie@vger.kernel.org, qemu-devel@nongnu.org Ciprian Dorin, Craciun wrote: > Hello all! > > Today I've played around with NBD (Network Block Disk), and > qemu-nbd (a NBD client that exports QEMU disks as NBD's). > > My problem is the following: both NBD kernel module and qemu-nbd > implementation expect to use a socket in order to communicate. > This means that in order to securely tunnel the connection over > SSH (OpenSSH), I need an intermediary process that creates a socket > and forwards all input / output between this socket and stdin / stdout > (which are in fact pipes received from OpenSSH). > > My question is: can I somehow make the pair of stdin / stdout seem > as a socket to the Linux syscalls (read and write)? (I would have to > make stdin / stdout pair look like a single file descriptor.) (This > would eliminate the intermediate process that just pipes data, and > thus reduce the overhead.) > Something like socat should to do the trick. For instance, if you have qemu-nbd on localhost:1025: ssh -l user hostname.com socat stdio tcp:localhost:1025 Alternative, you could just do ssh based port forwarding. For instance: ssh -l user -L 1025:localhost:1025 hostname.com And then connect locally with nbd-client Regards, Anthony Liguori