[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mgetty "auto-telnet" ??



Tim Sailer wrote:
> 
> In your email to me, Jens B. Jorgensen, you wrote:
> 
> > > Do you have any idea on how to setup mgetty to automatically telnet an
> > > incoming connection to another system.  (i.e. anyone connecting to ttyS31
> > > should be automatically telnetted to aaa.bbb.ccc.ddd.)
> > >
> >
> > Yes. mgetty will still prompt them for a login, but after that it will
> > run telnet to the remote machine and as long as the remote telnetd
> > supports the ENVIRON option the user will not have to type their
> > login twice. You need to edit the file /etc/mgetty/login.config.
> > This file controls what program is launched by getty (usually
> > /bin/login). The first field in each (non-comment) line matches the
> > user name and the use of '*' for a wildcard is allowed. Ordinarily
> > there's a line at the end (the first matching line in the file is
> > used) like this:
> >
> > *       -       -       /bin/login @
> >
> > Which means that any user logging in which doesn't match a previous
> > entry will have /bin/login started for them. The '@' just passes
> > the user name. You should replace this line with:
> >
> > *     -       -       /usr/bin/telnet -8 -E -a -l @ target-machine
> >
> > Actually you may want to consider (for extra security)
> >
> > *     nobody  nobody  /usr/bin/telnet -8 -E -a -l @ target-machine
> >
> > Since otherwise telnet will run as root (although -E prevents the
> > telnet "escape" which would allow a user to run a program).
> 
> This works as you state. However, he wants per port control to where
> ther telnet. I don't think this is possible.
> 

              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Come on, we're talking about *Linux* here, not Winbloze95 or NT.
No problema. Instead of

*     -       -       /usr/bin/telnet -8 -E -a -l @ target-machine

You use

*     -       -       /etc/mytelnetshim.sh @

And here's what /etc/mytelnetshim.sh looks like:

#!/bin/bash
case `/usr/bin/tty` in
  /dev/ttyS0) exec /usr/bin/telnet -8 -E -a -l $1 target-machine-1;;
  /dev/ttyS1) exec /usr/bin/telnet -8 -E -a -l $1 target-machine-2;;
  /dev/ttyS2) exec /usr/bin/telnet -8 -E -a -l $1 target-machine-3;;
  /dev/ttyS3) exec /usr/bin/telnet -8 -E -a -l $1 target-machine-4;;
  /dev/ttyS4) exec /usr/bin/telnet -8 -E -a -l $1 target-machine-5;;
esac

Bada-bing, bada-boom.

-- 
Jens B. Jorgensen
jjorgens@bdsinc.com


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: