Mgetty's 'login.config' enhancement proposal

"Maciej W. Rozycki" (macro@ds2.pg.gda.pl)
Wed, 8 Apr 1998 22:53:10 +0200


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--0-411304963-892068022=:19264
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.GSO.3.96.980408224944.19342I@delta.ds2.pg.gda.pl>

Hi,

 Recently, I started setting up a Linux-based terminal server (TS).  As a
TS needs to be as transparent to the user as possible, I thought it would
be best if just a standard login + password sequence allowed logging in to
a remote server.  I needed a special getty replacement for the TS that
would allow to configure a `/bin/login' replacement out of the box.  With
security in mind I chose `slogin' (from the SSH package) to be the program
used for connections between the TS and the server and thus the `login'
replacement.  After finding out what getty packages are available I
considered mgetty to be the one which suits me best.

 The 'login.config' flexibility allows almost any `login' command lines
and what I needed for `slogin' is: `/usr/bin/slogin -q -l <username>
<hostname>'.  I was able to set up this easily using "@" for <username>
and hardcoding <hostname>.

 Then I thought that most TSs have the ability to perform some tasks
locally (usually some kind of setup) or connect to hosts other than the
default (using the telnet protocol, unfortunately) using the same terminal
connection (with some escape sequence, such as <Break>, usually).  I
thought that for local logins, a "~<username>" sequence would be
appropriate (as the tilde is a "well known" escape character) and for
non-default remote logins, a "<username>@<hostname>" seems to be a good
candidate.

 Unfortunately, the current 'login.config' syntax does not allow
extracting parts of the login response string which is required for the
mentioned tasks.  So I invented syntax extensions that allow extracting
parts of the user name matched by the special "*" character used in
'login.config'.  Two such characters are introduced: "^" that matches the
starting "*" and "$" that matches the trailing one.  The characters were
chosen so they remind some used in regular expressions (though they are
not mandatory).

 Using these characters I was able to construct the following
'login.config' file which allows default logins for normal user names,
local login for those prefixed by a tilde ("~") or suffixed by an at ("@")
and remote logins for those using the "user@host" form: 

~*      ts      -       /bin/login $
*@      ts      -       /bin/login ^
*@*     ts      -       /usr/bin/slogin -q -l ^ $
*       ts      -       /usr/bin/slogin -q -l @ default.host.domain

 I am going to use the patch in all my TS installations.  With a proper
setup, `slogin' allows limiting the list of remote hosts that may be
accessed from a given TS.  Together with Linux's flexibility, it results
in a superior TS installation that hardly any dedicated product may
compete with.  As I found this feature very useful, I propose the attached
patch to be included in the official mgetty release. 

 Technical details.  I tried to make the patch as portable as possible;
especially I did not use any library calls that would not be referenced
elsewhere in mgetty sources.  The prefix and suffix strings are set only
when they match an appropriate star ("*") special character, otherwise
they are null strings.  For the ambiguous case of a single "*" string,
both of them are empty (but one can use "@" in this case anyway).  All
strings are 'strdup'ed to the built command line as it prevents problems
with possible future manipulations with original strings.

 The patch was prepared against the 1.1.12 release of mgetty but it
cleanly applies to version 1.1.14 which is, I believe, the most current
one.  If you accept the patch in this form or another (to be discussed), I
may prepare appropriate documentation updates.

 Comments are welcomed.

 Best regards,

  Maciej

PS. Please Cc me as I am not on the list.

--
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

--0-411304963-892068022=:19264
Content-Type: APPLICATION/OCTET-STREAM; NAME="mgetty-1.1.12-pref_suff.patch.gz"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.OSF.3.96.980408224022.19264D@amedec.amg.gda.pl>
Content-Description: 

H4sIAAAAAAACA51YbW/TSBD+7PyKIUBix3Ybp29pQqEIioSuglNLxYeWixxn
nVp1bMsvzVXV/febmV2/haYcl4p4vTsvz8zOPLthEfg+2AXYdiq8Is2Ce4Hj
SKxtPwgFrJYizx9sZwf/Rjsr10vj3TBeBtGO114rZzu2bT+npX0rBHwUHjiH
4Iwme8eTvT1wjo+POqZpPm1S+y4W8D5JAcbgHEycoVIZd05PwT6yDsE8so7g
9LQDMNjtQAdeBpEXFgsBb7J8EcQ7t287ZmsuDOY02RAsogDnNyazPA2i5cZk
smYx8r0/RL/mvmONlXdYubl3C90iE2kX3KUbRFkO3Tvx0OVlHKDIA2S5m+YQ
pyCiBayDHFUGXdD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