From: lindner@mudhoney.micro.umn.edu (Paul Lindner)
Subject: Re: Unix client to auto-load after login: gopher (how?)
Organization: University of Minnesota, Minneapolis
Distribution: comp
Date: Wed, 2 Sep 1992 14:18:26 GMT

In <Pine.3.03.9209011005.D5209-b100000@muser> P.C.Sutton@bradford.ac.uk (Paul Sutton) writes:

>On Fri, 21 Aug 1992, Dave Garaffa wrote:
>> Paul Lindner & The Gopher News Group,
>> Sorry if this is a dumb question (I am still very new to unix)... anyway I
>> would like to setup the unix gopher client in a similar fashion to the
>> client you have setup @ umn (ie: login: gopher will bring you directly
>> into the client) I know all unix's are *NOT* the same (I am running A/UX)
>> but could you point me in the right/general direction as to how to get my
>> system setup the same way? 

>In a similar vein, does anyone have a `wrapper' for gopher for anonymous
>logins on a Unix (Sun) system? 

>I what to set up an entry for gopher in our password file so that
>it can be used by anonymous telnet (and JANET X.25) callers; something
>like:

>gopher::99:99:Anonymous:/gopher/anonbin/gopher/anonbin/gopherwrapper

>where gopherwrapper is a program which:
>  - detects the terminal type of the called (if available) or
>    asks for a terminal type and sets it up
>  - Sets up the environment for a secure gopher session (ie
>    sets the PAGER environment variable to be a secure version
>    of more, such as comes with gopher_tools)
>  - Sets up signals etc to make it secure
>  - Invokes gopher -s
>  - After gopher finishes, cleans up (specifically, if gopher fails
>    for any reason, the wrapper should ensure that the connection is
>    terminated securely)

>Is this all a reasonable thing to want to do? How have other sites which
>have set up anonymous gophers done it? Thanks for any help. 

We have our gopher login running underneath a restricted shell, thus:

>gopher::99:99:Anonymous:/bin/Rsh

The .profile for Rsh follows.  Note that we're using AIX's ability to
run multiple "login" type programs when a user logs in.  One of these
is a script that dumps the hostname into a file with the same name as
the pty.  Keep this in mind as you read the following.

Note that we keep restricted versions of less/telnet/etc. in the
$GHOME/bin directory.  If you don't do this then Rsh isn't secure. 

------------------snip-----------------snip-----------------
#!/bin/rsh
#
# look at the file the login process left in the directory
# to see where this session came from. The login process leaves
# a file that's name is the same as the /dev/pty number of this
# session

LESS='-E -r -f -m -P --Less-- (%pb\%) [Press space bar to continue, 'q' to quit.]'
export LESS

PAGER=less
export PAGER

PORTNUM=`tty|sed s/.dev.pts.//`
FROMHOST=`cat $PORTNUM`
ISUMN=`echo $FROMHOST | egrep '.umn.edu|128.101.|192.35.|131.212.|137.66.' | egrep -v 'access.telecomm.|x53-1.telecomm.'|wc -l`
 
if [ $ISUMN -eq 1 ]
then
        ACCESSPORT=70
else
        ACCESSPORT=151
fi
#
# full access is at port 70, limited access is at port 151
#
#
GHOME=/home/hafnhaf/gopher

eval `tset - -s -m "network:?vt100" -m "unknown:?vt100" -m "dumb:?vt100" -m ":?vt100"`
echo "I think you're on a $TERM terminal"
sleep 3
PATH=$GHOME/bin
export PATH

USER=`/usr/ucb/whoami`
export $USER

if [ "$USER" = "gopher" ]
then
	exec $GHOME/gopher -s gopher.micro.umn.edu $ACCESSPORT
else
	exec $GHOME/gopher.anet -s  gopher.micro.umn.edu $ACCESSPORT
fi




--
 | Paul Lindner | lindner@boombox.micro.umn.edu   | Slipping into madness
 |              | Computer & Information Services | is good for the sake
 | GopherMaster | University of Minnesota         | of comparision.
///// / / /    /////// / / / /  /  /  /   /      //// / / / /  /  /  /   /
Newsgroups: comp.infosystems.gopher