From owner-freebsd-virtualization@freebsd.org Wed Jul 3 22:40:06 2019 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C735315E29FE for ; Wed, 3 Jul 2019 22:40:05 +0000 (UTC) (envelope-from paul@redbarn.org) Received: from family.redbarn.org (family.redbarn.org [IPv6:2001:559:8000:cd::5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13ECD6E132; Wed, 3 Jul 2019 22:40:05 +0000 (UTC) (envelope-from paul@redbarn.org) Received: from linux-9daj.localnet (50-255-33-26-static.hfc.comcastbusiness.net [50.255.33.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by family.redbarn.org (Postfix) with ESMTPSA id BE468892C6; Wed, 3 Jul 2019 22:40:02 +0000 (UTC) From: Paul Vixie To: freebsd-virtualization@freebsd.org Subject: Re: Bhyve serial terminal server Date: Wed, 03 Jul 2019 22:40:01 +0000 Message-ID: <2659111.BS0ceVt7k5@linux-9daj> Organization: none In-Reply-To: <61d16595-7327-77bb-6f96-63c1e40aa467@vangyzen.net> References: <61d16595-7327-77bb-6f96-63c1e40aa467@vangyzen.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jul 2019 22:40:06 -0000 On Wednesday, 3 July 2019 19:45:45 UTC Eric van Gyzen wrote: > I would like to expose bhyve serial consoles over TCP sockets, like many > terminal servers do for hardware serial ports. Is there any open-source > software to do this? as i said, "pkg install rtty" was created for this purpose and it's what i use. but then, i wrote it, in 1991 or so, while employed at d|i|g|i|t|a|l who gave me a room full of vaxes but no way to keep track of them all. a demo: > [mm1.redbarn:amd64] console > family guests pbx sleipnir util > [mm1.redbarn:amd64] console pbx > connected > (use (CR)~? for minimal help; also (CR)~q? and (CR)~s?) > [authorized] > [vixie@/dev/pts/0 connected] > FreeBSD/amd64 (pbx.redbarn.org) (ttyu0) > login: ~. > [rtty exiting] > [mm1.redbarn:amd64] ls -l /usr/local/rtty/dev > total 3 > lrwxr-xr-x 1 root wheel 11 May 18 2014 family@ -> /dev/nmdm2A > lrwxr-xr-x 1 root wheel 11 May 17 2014 guests@ -> /dev/nmdm0A > lrwxr-xr-x 1 root wheel 11 Nov 16 2014 pbx@ -> /dev/nmdm5A > lrwxr-xr-x 1 root wheel 11 Jun 1 2014 sleipnir@ -> /dev/nmdm3A > lrwxr-xr-x 1 root wheel 11 May 18 2014 util@ -> /dev/nmdm1A > [mm1.redbarn:amd64] ps auxwww|grep ttysrv|head -1 > root 1578 0.0 0.0 6440 2088 - I 17Jan19 0:00.03 > /usr/local/rtty/bin/ttysrv -b 9600 -w 8 -p none -t > /usr/local/rtty/dev/family -s /usr/local/rtty/sock/family -l > /usr/local/rtty/log/family -i /usr/local/rtty/pid/family root 1617 and: > [mm1.redbarn:amd64] tail /usr/local/rtty/log/pbx > Jul 3 22:04:01 pbx syslogd: last message repeated 1 times > FreeBSD/amd64 (pbx.redbarn.org) (ttyu0) > login: ~. > [mm1.redbarn:amd64] however, i'd like to add additional detail, below: > I found ports/comms/conserver-com, which is /almost/ what I want. I > want the client to simply connect to a TCP port and get direct, > immediate access to the guest console associated with that port. Can > conserver do this? We have lots of infrastructure and tooling built > around this model, and I'd rather avoid modifying it to support the > conserver model. as hinted by the name, rtty has a tcp listener/connection model in addition to the more common unix domain socket connection model i normally use: > [mm1.redbarn:amd64] ls -l /usr/local/rtty/sock > total 3 > srw-rw---- 1 root wheel 0 Jan 17 15:06 family= > srw-rw---- 1 root wheel 0 Jan 17 15:06 guests= > srw-rw---- 1 root wheel 0 Jan 17 15:06 pbx= > srw-rw---- 1 root sleipnir 0 Jan 17 15:06 sleipnir= > srw-rw---- 1 root wheel 0 Jan 17 15:06 util= however, the protocol is not "direct" or "immediate", and indeed cannot be so, because i have to be able to encode things like BREAK and seeing or changing the baud rate and word size and so on. i should have used telnet encoding, but that didn't have a location broker and i didn't want to have to assign or memorize port numbers, and the only authentication telnet had when i began this work was in-band or kerberos, neither of which fit my needs. my tcp listener and unix domain listener speak the same (stream) protocol. see https://github.com/gitGNU/gnu_rtty/blob/master/ttyprot.h for details. you could pretty easily use the supplied "rtty" client program for management, but, there is no authentication or encryption. when i want to give someone remote access to a guest VM, i do it with ssh, and i use rtty as their login shell. that's when unix domain sockets and their file modes and group and user ownership become important. -- Paul