--- remote-tty-4.0.orig/Makefile +++ remote-tty-4.0/Makefile @@ -20,8 +20,10 @@ VPATH = ../src DESTROOT = -DESTPATH = $(DESTROOT)/usr/local/rtty -DESTBIN = $(DESTPATH)/bin +DESTPATH = $(DESTROOT)/usr +DESTBIN = $(DESTPATH)/bin +DESTSBIN = $(DESTPATH)/sbin +DESTETC = /etc #CC = cc CDEBUG = -O @@ -34,10 +36,10 @@ # NO_SOCKADDR_LEN if your "struct sockaddr_in" lacks a sin_len field # NO_HSTRERROR if your C library has no hstrerror() function # -CDEFS = -DDEBUG -UWANT_TCPIP -UNEED_BITYPES_H -UNEED_INET_ATON \ +CDEFS = -UDEBUG -UWANT_TCPIP -UNEED_BITYPES_H -UNEED_INET_ATON \ -UNO_SOCKADDR_LEN -UNO_HSTRERROR # -CFLAGS = $(CDEBUG) $(CDEFS) -I/usr/local/include +CFLAGS += $(CDEBUG) $(CDEFS) -I/usr/local/include LIBS = -lcrypt #(if WANT_TCPIP defined and this isn't in your libc) # -lresolv --- remote-tty-4.0.orig/addrconsole +++ remote-tty-4.0/addrconsole @@ -0,0 +1,21 @@ +#!/bin/sh + +echo -n "Username : " +read USERNAME + +echo -n "Serial port (no need for /dev/): " +read PORT + +ln -s /dev/$PORT /etc/remote-tty/dev/$USERNAME + +echo "rttymgr:$USERNAME" > /etc/remote-tty/owner/$USERNAME.sock + +adduser --home /var/log/remote-tty/$USERNAME \ + --gecos "$USERNAME Serial Console" $USERNAME +chsh -s /usr/bin/rconsole-user $USERNAME +addgroup rttymgr $USERNAME +chown $USERNAME:rttymgr /var/log/remote-tty/$USERNAME +chmod 775 /var/log/remote-tty/$USERNAME + +cd /etc/remote-tty/dev +su - rttymgr -c "/usr/sbin/startsrv $USERNAME" --- remote-tty-4.0.orig/console.sh +++ remote-tty-4.0/console.sh @@ -31,16 +31,16 @@ host=$1 [ -z "$host" ] && { - ls DESTPATH/sock + ls /var/run/remote-tty/sock exit } -if [ -s DESTPATH/opt/${host}.cons ]; then - options=`cat DESTPATH/opt/${host}.cons` -elif [ -s DESTPATH/opt/DEFAULT.cons ]; then - options=`cat DESTPATH/opt/DEFAULT.cons` +if [ -s /etc/remote-tty/opt/${host}.cons ]; then + options=`cat /etc/remote-tty/opt/${host}.cons` +elif [ -s /etc/remote-tty/opt/DEFAULT.cons ]; then + options=`cat /etc/remote-tty/opt/DEFAULT.cons` else options="$default_options" fi -exec DESTPATH/bin/rtty $options $cmdopts DESTPATH/sock/$host +exec /usr/bin/remote-tty $options $cmdopts /var/run/remote-tty/sock/$host --- remote-tty-4.0.orig/debian/README.Debian +++ remote-tty-4.0/debian/README.Debian @@ -0,0 +1,13 @@ +This Debian package of remote-tty expects the creation of symlinks in +/etc/remote-tty/dev/ to the appropriate device file for that console. For +example: + +ln -s /dev/ttyS0 /etc/remote-tty/dev/myconsole + +would enable the use of: + +rconsole myconsole + +to connect to the device that was on ttyS0. The addrconsole script will create +a suitable user account and the appropriate symlink for you, such that the +user can only get access to the serial console when they log in. --- remote-tty-4.0.orig/debian/addrconsole.8 +++ remote-tty-4.0/debian/addrconsole.8 @@ -0,0 +1,41 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH ADDRCONSOLE 8 "October 12, 2004" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +addrconsole \- Setup a new remote console user +.SH SYNOPSIS +.B addrconsole +.SH DESCRIPTION +This manual page documents briefly the +.B addrconsole +command. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBaddrconsole\fP sets up a new remote console user; it creates the user +account, sets up the rconsole configuration links and starts up the server +for that port. It runs as an interactive script and requests a username, +serial port and password. +.SH SEE ALSO +.BR rconsole (1), +.BR ttysrv (8), +.BR delrconsole (8). +.SH AUTHOR +rtty was written by Paul Vixie . The addrconsole script +and this manual page were written by Jonathan McDowell +for the Debian project (but may be used by others). --- remote-tty-4.0.orig/debian/changelog +++ remote-tty-4.0/debian/changelog @@ -0,0 +1,119 @@ +remote-tty (4.0-13.1) unstable; urgency=medium + + * Non-maintainer upload. + * Apply a patch by Vagrant Cascadian to make the build reproducible. + (Closes: #829721) + * Apply a patch by Helmut Grohne to correctly pass cross-building to + upstream's build system. (Closes: #977280) + + -- Chris Lamb Thu, 06 Oct 2022 10:19:32 -0700 + +remote-tty (4.0-13) unstable; urgency=low + + * Fold in Ubuntu changes for tmpfs /var/run (closes: #587107) + * Fix remote-tty help output to not include -s or -x options; we + don't compile in TCPIP or DEBUG support (closes: #518555) + * Add basic README.Debian with details on how to configure. + * Lintian/updated policy inspired cleanups: + * Add ${misc:Depends} to binary deps. + * Add build-arch + build-indep targets. + * Don't ignore errors in postinst/postrm. + * Bump debhelper compat level to 8. + * Bump policy version to 3.9.2 + + -- Jonathan McDowell Sun, 27 Nov 2011 12:28:44 -0800 + +remote-tty (4.0-12ubuntu1) maverick; urgency=low + + [ Jean-Baptiste Lallement ] + * Create /var/run/remote-tty/{sock,pid} in init script (LP: #409805) + + [ Stefano Rivera ] + * Depend on $remote_fs in init script + + -- Jean-Baptiste Lallement Wed, 23 Jun 2010 20:09:50 +0200 + +remote-tty (4.0-12) unstable; urgency=low + + * Fixed typo/bashism in init script (=, not ==, bah) (closes: #477730) + + -- Jonathan McDowell Sat, 26 Apr 2008 12:04:45 +0100 + +remote-tty (4.0-11) unstable; urgency=low + + * Remove bashism from delrconsole (closes: #465023) + * Check for device config directory before rotating logs (closes: #436016) + * Update to Standards-Version 3.7.3.0 (no changes) + + -- Jonathan McDowell Wed, 20 Feb 2008 17:02:28 +0000 + +remote-tty (4.0-10) unstable; urgency=low + + * Add LSB section to init script. + + -- Jonathan McDowell Mon, 21 May 2007 17:20:56 +0100 + +remote-tty (4.0-9) unstable; urgency=medium + + * Fix typo leading to creation of /share directory (closes: #400211) + + -- Jonathan McDowell Sun, 26 Nov 2006 20:52:54 +0000 + +remote-tty (4.0-8) unstable; urgency=low + + * Fix getopt variables to be ints, not chars in rtty.c & ttysrv.c + * Remove bashism from debian/rules (closes: #374549) + + -- Jonathan McDowell Tue, 20 Jun 2006 09:49:00 +0100 + +remote-tty (4.0-7) unstable; urgency=low + + * Initial Debian upload. Closes: #365167 + * Add man pages for remote-tty, delrconsole, ttysrv and startsrv. + + -- Jonathan McDowell Tue, 23 May 2006 12:20:32 +0100 + +remote-tty (4.0-6) unstable; urgency=low + + * Add delrconsole (from Simon Huggins). + * Set restricted mode by default in rconsole-user. + * Fix up insecure tmpfile usage in startsrv. + + -- Jonathan McDowell Wed, 10 Aug 2005 13:02:17 +0100 + +remote-tty (4.0-5) unstable; urgency=low + + * Make adduser quiet about adding rttymgr to dialout group. + * Remove -q from savelog as woody's version doesn't support this. + + -- Jonathan McDowell Mon, 15 Nov 2004 13:00:31 +0000 + +remote-tty (4.0-4) unstable; urgency=low + + * Fix typo of group name in cron.daily rotation. + + -- Jonathan McDowell Thu, 14 Oct 2004 09:41:35 +0100 + +remote-tty (4.0-3) unstable; urgency=low + + * Fix silly bug with printing incorrect baud rates. + * Make sure we return the right new baud rate. + * Add support for higher baudrates (57600, 115200, 230400, 460800). + + -- Jonathan McDowell Wed, 13 Oct 2004 11:16:58 +0100 + +remote-tty (4.0-2) unstable; urgency=low + + * Don't try to start/stop anything if nothing's configured. + * Don't use logrotate, instead add a cron.daily which can check which + files we need to rotate. + * Fix baudrate setting to work (previously geared up for BSD). + * Add man pages for rconsole, rconsole-user and addrconsole. + + -- Jonathan McDowell Tue, 12 Oct 2004 11:16:25 +0100 + +remote-tty (4.0-1) unstable; urgency=low + + * Initial debianization. + + -- Jonathan McDowell Thu, 11 Mar 2004 13:06:30 +0000 --- remote-tty-4.0.orig/debian/compat +++ remote-tty-4.0/debian/compat @@ -0,0 +1 @@ +8 --- remote-tty-4.0.orig/debian/control +++ remote-tty-4.0/debian/control @@ -0,0 +1,16 @@ +Source: remote-tty +Section: admin +Priority: optional +Maintainer: Jonathan McDowell +Standards-Version: 3.9.2 +Build-Depends: debhelper (>= 8) + +Package: remote-tty +Architecture: any +Depends: ${shlibs:Depends}, adduser, ${misc:Depends} +Description: multiuser "tip"/"cu" replacement with logging + This is Paul Vixie's rtty serial console tool. It allows runs a server + per port which then support multiple connections at time from + "tip"/"cu"-like clients. It also supports logging of output from the + port, even when no client is connected. This can be invaluable for post + mortem diagnosis of crashes of serial consoled machines. --- remote-tty-4.0.orig/debian/copyright +++ remote-tty-4.0/debian/copyright @@ -0,0 +1,21 @@ +remote-tty was packaged for Debian by Jonathan McDowell . + +Author: Paul Vixie + +Copyright: + +/* Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ --- remote-tty-4.0.orig/debian/cron.daily +++ remote-tty-4.0/debian/cron.daily @@ -0,0 +1,19 @@ +#!/bin/sh +# +# Rotate remote-tty log files daily, but only if they've had something +# written to them. +# + +# Check our device configuration directory actually exists. +if [ ! -d /etc/remote-tty/dev ]; then + exit 0 +fi + +cd /etc/remote-tty/dev +for tty in *; do + if [ -s /var/log/remote-tty/$tty/$tty ]; then + savelog -t -u rttymgr -g rttymgr -m 644 \ + /var/log/remote-tty/$tty/$tty > /dev/null + kill -HUP `cat /var/run/remote-tty/pid/$tty` + fi +done --- remote-tty-4.0.orig/debian/delrconsole.8 +++ remote-tty-4.0/debian/delrconsole.8 @@ -0,0 +1,42 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH ADDRCONSOLE 8 "May 23, 2006" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +delrconsole \- Delete a remote console user +.SH SYNOPSIS +.B delrconsole +.SH DESCRIPTION +This manual page documents briefly the +.B delrconsole +command. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBdelrconsole\fP removes a remote console user; it kills any remote console +instance running for the user, deletes the configuration and logs for the +user and then finally removes the user account. It runs as an interactive +script and requests a username. +.SH SEE ALSO +.BR rconsole (1), +.BR ttysrv (8), +.BR addrconsole (8). +.SH AUTHOR +rtty was written by Paul Vixie and the delrconsole script +was written by Simon Huggins . This manual page was +written by Jonathan McDowell for the Debian project +(but may be used by others). --- remote-tty-4.0.orig/debian/init +++ remote-tty-4.0/debian/init @@ -0,0 +1,63 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: remote-tty +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Should-Start: $local_fs +# Should-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start the remote-tty serial console manager +# Description: This starts remote-tty listening and logging +# on all of its configured serial ports. +### END INIT INFO + +set -e + +test -x /usr/sbin/ttysrv || exit 0 + +case "$1" in + start) + echo "Starting remote-tty console manager:" + mkdir -p /var/run/remote-tty/sock + mkdir -p /var/run/remote-tty/pid + chmod -R 775 /var/run/remote-tty + chown -R rttymgr:rttymgr /var/run/remote-tty >/dev/null 2>&1 || true + + cd /etc/remote-tty/dev + if [ ! "x`ls`" = x ]; then + su rttymgr -c "/usr/sbin/startsrv *" + else + echo " no consoles configured" + fi + ;; + stop) + echo -n "Stopping remote-tty console manager:" + cd /var/run/remote-tty/pid + for i in *; do + if [ -f $i ]; then + echo -n " $i" + if start-stop-daemon --stop --quiet --oknodo \ + --pidfile /var/run/remote-tty/pid/$i; + then + rm -f $i + rm -f /var/run/remote-tty/sock/$i + fi + else + echo -n " nothing running" + fi + done + echo "." + ;; + restart|force-reload) + sh $0 stop + sleep 5 + sh $0 start + ;; + *) + echo "Usage: /etc/init.d/$(basename $0) {start|stop}" + exit 1 +esac + +exit 0 --- remote-tty-4.0.orig/debian/postinst +++ remote-tty-4.0/debian/postinst @@ -0,0 +1,31 @@ +#!/bin/sh + +set -e + +case "$1" in + configure) + # Add the user we want to run as and join the dialout group. + adduser --quiet --system --group --home /var/log/remote-tty \ + --shell /bin/sh --gecos "Remote TTY" --disabled-login \ + rttymgr + adduser --quiet rttymgr dialout + + # We want to own our /var/run and /var/log dirs. + chown -R rttymgr:rttymgr /var/log/remote-tty + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \'$1\'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 --- remote-tty-4.0.orig/debian/postrm +++ remote-tty-4.0/debian/postrm @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +case "$1" in + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + purge) + userdel rttymgr 2> /dev/null || true + groupdel rttymgr 2> /dev/null || true + ;; + + *) + echo "postrm called with unknown argument '$1'" >&2 + exit 1 +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 --- remote-tty-4.0.orig/debian/rconsole-user.1 +++ remote-tty-4.0/debian/rconsole-user.1 @@ -0,0 +1,41 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH RCONSOLE-USER 1 "October 12, 2004" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +rconsole-user \- attach to the remote-tty console equal to the current username +.SH SYNOPSIS +.B rconsole-user +.SH DESCRIPTION +This manual page documents briefly the +.B rconsole-user +command. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBrconsole-user\fP attaches to the \fBremote-tty\fP console that has the +same name as the current user. It takes no options and invokes +\fBrconsole\fP. It's intended to be used as the shell for users who should +only have remote console access and not shell access to the machine providing +the remote console service. +.SH SEE ALSO +.BR rconsole (1), +.BR ttysrv (8). +.SH AUTHOR +rtty was written by Paul Vixie . The rconsole-user script +and this manual page were written by Jonathan McDowell +for the Debian project (but may be used by others). --- remote-tty-4.0.orig/debian/rconsole.1 +++ remote-tty-4.0/debian/rconsole.1 @@ -0,0 +1,39 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH RCONSOLE 1 "October 12, 2004" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +rconsole \- attach to a specified remote-tty console +.SH SYNOPSIS +.B rconsole +.RI host +.SH DESCRIPTION +This manual page documents briefly the +.B rconsole +command. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBrconsole\fP attaches to the specified \fBremote-tty\fP console. +If invoked with no options it lists all the available consoles. +.SH SEE ALSO +.BR remote-tty (1), +.BR ttysrv (8). +.SH AUTHOR +rtty was written by Paul Vixie . This manual page was written +by Jonathan McDowell for the Debian project (but may be +used by others). --- remote-tty-4.0.orig/debian/remote-tty.1 +++ remote-tty-4.0/debian/remote-tty.1 @@ -0,0 +1,49 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH REMOTE-TTY 1 "May 23, 2006" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +remote-tty \- connect to a ttysrv serial console instance +.SH SYNOPSIS +.BR remote-tty " [\-l LoginName] [\-7] [\-r] socket" +.SH DESCRIPTION +.B remote-tty +is the frontend for the remote-tty daemon. It is normally invoked using +.B rconsole. +It connects to the backend ttysrv process over a Unix socket and allows +the user to view what's happening on the serial console and interact with it. +.SH OPTIONS +.TP +.B socket +The full path to the Unix socket for the ttysrv instance to connect to. +.TP +.B \-l loginname +Specify the login name to use. Defaults to the username if not specified. +.TP +.B \-r +Set restricted mode; don't allow changing of logging status, suspending of +remote-tty or setting of line options. +.TP +.B \-7 +Set 7bit mode. +.SH SEE ALSO +.BR rconsole (1), +.BR remote-tty (1), +.BR ttysrv (8). +.SH AUTHOR +rtty was written by Paul Vixie . This manual page was written +by Jonathan McDowell for the Debian project (but may be +used by others). --- remote-tty-4.0.orig/debian/remote-tty.manpages +++ remote-tty-4.0/debian/remote-tty.manpages @@ -0,0 +1,7 @@ +debian/addrconsole.8 +debian/delrconsole.8 +debian/rconsole.1 +debian/rconsole-user.1 +debian/remote-tty.1 +debian/startsrv.8 +debian/ttysrv.8 --- remote-tty-4.0.orig/debian/rules +++ remote-tty-4.0/debian/rules @@ -0,0 +1,72 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +package = remote-tty +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + + +build: build-arch build-indep +build-arch: build-stamp +build-indep: build-stamp +build-stamp: + dh_testdir + dh_auto_build + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + $(MAKE) clean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + install -d debian/$(package)/usr/bin \ + debian/$(package)/usr/sbin + install -d debian/$(package)/var/log/remote-tty/out + install -d debian/$(package)/etc/remote-tty/dev \ + debian/$(package)/etc/remote-tty/opt \ + debian/$(package)/etc/remote-tty/owner \ + debian/$(package)/etc/remote-tty/prot + install -d debian/$(package)/etc/init.d + install -m 755 ttysrv debian/$(package)/usr/sbin + install -m 755 rtty debian/$(package)/usr/bin/remote-tty + install -m 755 startsrv debian/$(package)/usr/sbin + install -m 755 addrconsole debian/$(package)/usr/sbin + install -m 755 delrconsole debian/$(package)/usr/sbin + install -m 755 console debian/$(package)/usr/bin/rconsole + install -m 755 rconsole-user debian/$(package)/usr/bin/rconsole-user + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs README + dh_installinit -- defaults 95 05 + dh_installcron + dh_installchangelogs + dh_installman + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch + +.PHONY: binary binary-arch binary-indep clean checkroot --- remote-tty-4.0.orig/debian/startsrv.8 +++ remote-tty-4.0/debian/startsrv.8 @@ -0,0 +1,47 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH STARTSRV 8 "May 23, 2006" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +startsrv \- invoke ttysrv for a particular host. +.SH SYNOPSIS +.B startsrv +.RI host +.SH DESCRIPTION +.PP +\fBstartsrv\fP fires up \fBttysrv\fP for a given host. It will kill any +already running instance for that host, then read +\fB/etc/remote-tty/opt/.srv\fP for any options to pass to ttysrv +(defaulting to those that set 9600,8n1), +\fB/etc/remote-tty/prot/.sock\fP for the permissions the socket should +be set to (default 660), +\fB/etc/remote-tty/owner/.sock\fP for the owner of the socket +(default rttymgr:dialout) and \fB/etc/remote-tty/prot/.log\fP for the +permissions of the logfile (default 640). +.PP +The device node used is \fB/etc/remote-tty/dev/\fP. This will normally +be a symlink to the correct file in \fB/dev\fP. +.PP +\fBttysrv\fP is configured to log to \fB/var/log/remote-tty//\fP, +with a pidfile at \fB/var/run/remote-tty/pid/\fP and the socket at +\fB/var/run/remote-tty/sock/\fP. +.SH SEE ALSO +.BR remote-tty (1), +.BR ttysrv (8). +.SH AUTHOR +rtty was written by Paul Vixie . This manual page was written +by Jonathan McDowell for the Debian project (but may be +used by others). --- remote-tty-4.0.orig/debian/ttysrv.8 +++ remote-tty-4.0/debian/ttysrv.8 @@ -0,0 +1,62 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH TTYSRV 8 "May 23, 2006" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +ttysrv \- connect to a serial port and log output +.SH SYNOPSIS +.BR ttysrv " [\-o option] [\-s sock] [\-l log] \-t tty [\-b baud] [\-p parity] [\-w wordsize] [\-i pidfile]" +.SH DESCRIPTION +.B ttysrv +is the backend for +.B rconsole. +It connects to the serial port, handles the log file and waits for connections +from rconsole to view what's happening on the serial console. +.SH OPTIONS +.TP +.B \-t tty +Specify which device to connect to. +.TP +.B \-s sock +The name of the socket to listen for connections from rconsole on. +.TP +.B \-o option +Specify any ttyios options to open the port with. Currently only +.I nolocal +is supported. +.TP +.B \-l log +The logfile to write to. If not set then no log is kept. +.TP +.B \-b baud +Set the baud rate to talk to the port at. Defaults to 9600. +.TP +.B \-p parity +Set the parity for the serial port. Defaults to none. +.TP +.B \-w wordsize +Set the word size for the serial port. Defaults to 8 bits. +.TP +.B \-i pidfile +The file to write the pid of ttysrv to. If not specified no such file is +written. +.SH SEE ALSO +.BR rconsole (1), +.BR remote-tty (1). +.SH AUTHOR +rtty was written by Paul Vixie . This manual page was written +by Jonathan McDowell for the Debian project (but may be +used by others). --- remote-tty-4.0.orig/delrconsole +++ remote-tty-4.0/delrconsole @@ -0,0 +1,32 @@ +#!/bin/sh + +echo -n "Username : " +read USERNAME + +# +# Kill any running rtty for that username. +# +if [ -f /var/run/remote-tty/pid/$USERNAME ]; then + echo -n "Killing running ttysrv: " + pid=`cat /var/run/remote-tty/pid/$USERNAME` + tmpfile=`mktemp -t` + while ps w$pid >$tmpfile 2>&1 + do + grep -q ttysrv $tmpfile && { + echo -n " $pid killed" + kill $pid + sleep 1 + } || { + break + } + done + rm /var/run/remote-tty/pid/$USERNAME $tmpfile + echo +fi + +rm -f /etc/remote-tty/dev/$USERNAME +rm -f /etc/remote-tty/owner/$USERNAME.sock +rm -f /etc/remote-tty/opt/$USERNAME.srv +userdel -r $USERNAME +groupdel $USERNAME +rm -rf /var/log/remote-tty/$USERNAME --- remote-tty-4.0.orig/rconsole-user +++ remote-tty-4.0/rconsole-user @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/rconsole -r `whoami` --- remote-tty-4.0.orig/rtty.c +++ remote-tty-4.0/rtty.c @@ -46,8 +46,13 @@ #define LOCAL_DEBUG 0 +#if (!defined(WANT_TCPIP)) && (!defined(DEBUG)) +#define USAGE_STR \ + "[-l LoginName] [-7] [-r] Serv" +#else #define USAGE_STR \ "[-s ServSpec] [-l LoginName] [-7] [-r] [-x DebugLevel] Serv" +#endif #define Tty STDIN_FILENO @@ -89,7 +94,7 @@ int main(int argc, char *argv[]) { - char ch; + int ch; ProgName = argv[0]; --- remote-tty-4.0.orig/startsrv.sh +++ remote-tty-4.0/startsrv.sh @@ -19,7 +19,7 @@ default_options='-b 9600 -w 8 -p none' default_sock_prot='ug=rw,o=' -default_sock_owner='root.wheel' +default_sock_owner='rttymgr:dialout' default_log_prot='u=rw,g=r,o=' for host @@ -28,11 +28,12 @@ # # kill any existing ttysrv on this port # - if [ -f DESTPATH/pid/$host ]; then - pid=`cat DESTPATH/pid/$host` - while ps w$pid >/tmp/startsrv$$ 2>&1 + if [ -f /var/run/remote-tty/pid/$host ]; then + pid=`cat /var/run/remote-tty/pid/$host` + tmpfile=`mktemp -t` + while ps w$pid >$tmpfile 2>&1 do - grep -q ttysrv /tmp/startsrv$$ && { + grep -q ttysrv $tmpfile && { echo -n " $pid killed" kill $pid sleep 1 @@ -40,64 +41,64 @@ break } done - rm DESTPATH/pid/$host /tmp/startsrv$$ + rm /var/run/remote-tty/pid/$host $tmpfile fi # # start up a new one # - if [ -s DESTPATH/opt/${host}.srv ]; then - options=`cat DESTPATH/opt/${host}.srv` - elif [ -s DESTPATH/opt/DEFAULT.srv ]; then - options=`cat DESTPATH/opt/DEFAULT.srv` + if [ -s /etc/remote-tty/opt/${host}.srv ]; then + options=`cat /etc/remote-tty/opt/${host}.srv` + elif [ -s /etc/remote-tty/opt/DEFAULT.srv ]; then + options=`cat /etc/remote-tty/opt/DEFAULT.srv` else options="$default_options" fi - if [ -s DESTPATH/prot/${host}.sock ]; then - sock_prot=`cat DESTPATH/prot/${host}.sock` - elif [ -s DESTPATH/prot/DEFAULT.sock ]; then - sock_prot=`cat DESTPATH/prot/DEFAULT.sock` + if [ -s /etc/remote-tty/prot/${host}.sock ]; then + sock_prot=`cat /etc/remote-tty/prot/${host}.sock` + elif [ -s /etc/remote-tty/prot/DEFAULT.sock ]; then + sock_prot=`cat /etc/remote-tty/prot/DEFAULT.sock` else sock_prot="$default_sock_prot" fi - if [ -s DESTPATH/owner/${host}.sock ]; then - sock_owner=`cat DESTPATH/owner/${host}.sock` - elif [ -s DESTPATH/owner/DEFAULT.sock ]; then - sock_owner=`cat DESTPATH/owner/DEFAULT.sock` + if [ -s /etc/remote-tty/owner/${host}.sock ]; then + sock_owner=`cat /etc/remote-tty/owner/${host}.sock` + elif [ -s /etc/remote-tty/owner/DEFAULT.sock ]; then + sock_owner=`cat /etc/remote-tty/owner/DEFAULT.sock` else sock_owner="$default_sock_owner" fi - if [ -s DESTPATH/prot/${host}.log ]; then - log_prot=`cat DESTPATH/prot/${host}.log` - elif [ -s DESTPATH/prot/DEFAULT.log ]; then - log_prot=`cat DESTPATH/prot/DEFAULT.log` + if [ -s /etc/remote-tty/prot/${host}.log ]; then + log_prot=`cat /etc/remote-tty/prot/${host}.log` + elif [ -s /etc/remote-tty/prot/DEFAULT.log ]; then + log_prot=`cat /etc/remote-tty/prot/DEFAULT.log` else log_prot="$default_log_prot" fi - rm -f DESTPATH/sock/$host DESTPATH/pid/$host - DESTPATH/bin/ttysrv $options \ - -t DESTPATH/dev/$host \ - -s DESTPATH/sock/$host \ - -l DESTPATH/log/$host \ - -i DESTPATH/pid/$host \ - > DESTPATH/out/$host 2>&1 & + rm -f /var/run/remote-tty/sock/$host /var/run/remote-tty/pid/$host + /usr/sbin/ttysrv $options \ + -t /etc/remote-tty/dev/$host \ + -s /var/run/remote-tty/sock/$host \ + -l /var/log/remote-tty/$host/$host \ + -i /var/run/remote-tty/pid/$host \ + > /var/log/remote-tty/out/$host 2>&1 & echo -n " " tries=5 - while [ $tries -gt 0 -a ! -f DESTPATH/pid/$host ]; do + while [ $tries -gt 0 -a ! -f /var/run/remote-tty/pid/$host ]; do echo -n "." sleep 1 tries=`expr $tries - 1` done - if [ ! -f DESTPATH/pid/$host ]; then + if [ ! -f /var/run/remote-tty/pid/$host ]; then echo " [startup failed]" else - newpid=`cat DESTPATH/pid/$host` - chmod $sock_prot DESTPATH/sock/$host - chown $sock_owner DESTPATH/sock/$host - chmod $log_prot DESTPATH/log/$host + newpid=`cat /var/run/remote-tty/pid/$host` + chmod $sock_prot /var/run/remote-tty/sock/$host + chown $sock_owner /var/run/remote-tty/sock/$host + chmod $log_prot /var/log/remote-tty/$host/$host echo " $newpid started" fi done --- remote-tty-4.0.orig/ttysrv.c +++ remote-tty-4.0/ttysrv.c @@ -132,12 +132,13 @@ static int set_baud(int), find_parity(char *), - find_wordsize(int); + find_wordsize(int), + find_baud(int); int main(int argc, char *argv[]) { - int i; - char ch, *msg; + int i, ch; + char *msg; gethostname(Hostname, sizeof Hostname); ProgName = argv[0]; @@ -201,7 +202,13 @@ tcgetattr(Tty, &Ttyios); Ttyios_orig = Ttyios; prepare_term(&Ttyios, 0); - set_baud(Baud); + + if ((i = find_baud(Baud)) == -1) { + USAGE((stderr, "%s: baud %d ?\n", ProgName, Baud)); + } + if (set_baud(i) == -1) { + USAGE((stderr, "%s: baud %d ?\n", ProgName, Baud)); + } if ((i = find_parity(Parity)) == -1) { USAGE((stderr, "%s: parity %s ?\n", ProgName, Parity)); @@ -564,14 +571,20 @@ tp_sendctl(fd, TP_BAUD|TP_QUERY, Baud, NULL); break; } - if ((set_baud(i) >= 0) && - (install_ttyios(Tty, &Ttyios) >= 0)) { - Baud = i; - if (LogF) - fprintf(LogF, "[baud now %d]", i); - tp_sendctl(fd, TP_BAUD, 1, NULL); - } else { + + if (-1 == (new = find_baud(i))) { tp_sendctl(fd, TP_BAUD, 0, NULL); + } else { + if (set_baud(new) != -1) { + Baud = i; + install_ttyios(Tty, &Ttyios); + if (LogF) { + fprintf(LogF, "[baud now %d]", i); + } + tp_sendctl(fd, TP_BAUD, 1, NULL); + } else { + tp_sendctl(fd, TP_BAUD, 0, NULL); + } } break; case TP_PARITY: @@ -797,6 +810,50 @@ { 0, -1 } }; +struct baudtab { int baud, sysbaud; } baudtab[] = { + { 50, B50 }, + { 75, B75 }, + { 110, B110 }, + { 134, B134 }, + { 150, B150 }, + { 200, B200 }, + { 300, B300 }, + { 600, B600 }, + { 1200, B1200 }, + { 1800, B1800 }, + { 2400, B2400 }, + { 4800, B4800 }, + { 9600, B9600 }, + { 19200, B19200 }, + { 38400, B38400 }, +#ifdef B57600 + { 57600, B57600 }, +#endif +#ifdef B115200 + { 115200, B115200 }, +#endif +#ifdef B230400 + { 230400, B230400 }, +#endif +#ifdef B460800 + { 460800, B460800 }, +#endif + { 0, -1 } +}; + +static int +find_baud(int baud) { + struct baudtab *baudp; + int sysbaud = -1; + + for (baudp = baudtab; baudp->baud; baudp++) { + if (baudp->baud == baud) { + sysbaud = baudp->sysbaud; + } + } + return (sysbaud); +} + static int set_baud(int baud) { if (cfsetispeed(&Ttyios, baud) < 0)