[comp.unix.xenix] Xenix login source

trebor@biar.UUCP (Robert J Woodhead) (02/28/89)

I am running SCO Xenix 386 on Tandy 4000 and 4000lx boxes.  I am setting up
a special access system and want to bypass login; in other words, when 
activity is detected on a serial line, I want to spoof the login procedure,
log into a specific account, and start running my program.

Please tell me if there is an easy way to do this.  Once my user gets to
a shell, it's easy for me to set up his profile so he starts running my
program.  In fact, I can probably have my program as the shell.  The tricky
part (to my unenlightened eyes) is getting him to that point without him
having to see the login: and password: prompts.

If I had the source code to Xenix's login, this would be trivial as I could
just cut out the getting of the login name and password and simply assign
them to my defaults.

So, any suggestions?

+---------------------------------------------------------------------------+
| Robert J Woodhead      !uunet!cornell!biar!trebor     CompuServe 72447,37 |
| Biar Games, Inc., 10 Spruce Lane, Ithaca NY 14850  607-257-1708,3864(fax) |
+---------------------------------------------------------------------------+
| Games written, Viruses killed   "I'm the head honcho of this here spread; |
| While U Wait.  Take a number.    I don't need no stinking disclaimers!!!" |
+---------------------------------------------------------------------------+

frank@rsoft.UUCP (Frank I. Reiter) (02/28/89)

In article <168@biar.UUCP> trebor@biar.UUCP (Robert J Woodhead) writes:
>I want to spoof the login procedure,
>log into a specific account, and start running my program.

What we do at MIND LINK! is leave those ports disabled and run our own version
of init which spawns our own version of getty.  This custom getty would run
your program rather than running login.

In our case the program run by the  getty lookalike is our Bulletin Board
Software.  If you've played with fork(), exec, and ioctl() then you shouldn't
find any of this difficult.

-- 
_____________________________________________________________________________
Frank I. Reiter              UUCP:  {uunet,ubc-cs}!van-bc!rsoft!frank
Reiter Software Inc.                frank@rsoft.bc.ca,  a2@mindlink.UUCP
Langley, British Columbia     BBS:  Mind Link @ (604)533-2312, login as Guest

pcng@cad.jmrc.eecs.unsw.oz (Po Cheung Ng ) (03/01/89)

From article <168@biar.UUCP>, by trebor@biar.UUCP (Robert J Woodhead):
> I am running SCO Xenix 386 on Tandy 4000 and 4000lx boxes.  I am setting up
> a special access system and want to bypass login; in other words, when 
> activity is detected on a serial line, I want to spoof the login procedure,
> log into a specific account, and start running my program.
> 
> Please tell me if there is an easy way to do this.  Once my user gets to
> a shell, it's easy for me to set up his profile so he starts running my
> program.  In fact, I can probably have my program as the shell.  The tricky
> part (to my unenlightened eyes) is getting him to that point without him
> having to see the login: and password: prompts.
> 

On SCO Xenix V/286 or V/386:

Without doing much hacking, this may be a quick or temporary fix. Let say
the serial line is 'tty1a' and the acouunt you want to login in is 'acc'.

1. Disable the getty on the line

disable tty1a

2. Edit /etc/gettydefs to create a new entry with AUTO keyword in the six
   field. e.g.

X # B9600 ... # B9600 ... # \r\nlogin: # X # AUTO

3. Edit /etc/ttys so that you have an entry

1Xtty1a

4. Create an account named 'tty1a' so that in /etc/passwd you have an
   entry

tty1a:PASSWD:UID:GID:DESCRIPTION:PATH:YOUR-FAVOURITE-SHELL

5. Enable the line

enable tty1a

6. If you just want to run a program (executable, not shell script), you
   can simply replace your favourite shell to the program you want to run.
   OR change the keyword AUTO to the name of your program (That may be the
   best solution you want).

There may be minor variations to the above setup, but I know it is feasible
and does not require any hacks to existing Xenix utilities. Please refer
to gettydef(F) for more details.

       _   _. __   _,
---   /_)_(__/) )_(_)_		[ Also known as Andrew ]
     /              /|
    '              |/

----------------
Po Cheung NG                               ISD:  +61 2 697-4056
JMRC, School of Elec. Eng. and Comp. Sci., STD:  (02) 697-4056
The University of New South Wales,         FAX:  +61 2 662-2087
PO Box 1, Kensington,         ARPA: pcng%cad.jmrc.eecs.unsw.oz.au@uunet.uu.net
Sydney, NSW 2033,             JANET: cad.jmrc.eecs.unsw.oz!pcng@ukc
AUSTRALIA.                    ACSnet: pcng@cad.jmrc.eecs.unsw.oz

UUCP:  {enea,hplabs,mcvax,prlb2,uunet,ubc-vision,ukc}!munnari!cad.jmrc.eecs.unsw.oz!pcng

From vn Wed Mar  1 14:02:33 1989
Subject: Re: Xenix login source
Newsgroups: comp.unix.xenix
References: <168@biar.UUCP>

From article <168@biar.UUCP>, by trebor@biar.UUCP (Robert J Woodhead):
> I am running SCO Xenix 386 on Tandy 4000 and 4000lx boxes.  I am setting up
> a special access system and want to bypass login; in other words, when 
> activity is detected on a serial line, I want to spoof the login procedure,
> log into a specific account, and start running my program.
> 
> Please tell me if there is an easy way to do this.  Once my user gets to
> a shell, it's easy for me to set up his profile so he starts running my
> program.  In fact, I can probably have my program as the shell.  The tricky
> part (to my unenlightened eyes) is getting him to that point without him
> having to see the login: and password: prompts.
> 

On SCO Xenix V/286 or V/386:

Without doing much hacking, this may be a quick or temporary fix. Let say
the serial line is 'tty1a' and the acouunt you want to login in is 'acc'.

1. Disable the getty on the line

disable tty1a

2. Edit /etc/gettydefs to create a new entry with AUTO keyword in the six
   field. e.g.

X # B9600 ... # B9600 ... # \r\nlogin: # X # AUTO

3. Edit /etc/ttys so that you have an entry

1Xtty1a

4. Create an account named 'tty1a' so that in /etc/passwd you have an
   entry

tty1a:PASSWD:UID:GID:DESCRIPTION:PATH:YOUR-FAVOURITE-SHELL

5. Enable the line

enable tty1a

6. If you just want to run a program (executable, not shell script), you
   can simply replace your favourite shell to the program you want to run.
   OR change the keyword AUTO to the name of your program (That may be the
   best solution you want).

There may be minor variations to the above setup, but I know it is feasible
and does not require any hacks to existing Xenix utilities. Please refer
to gettydef(F) for more details.

       _   _. __   _,
---   /_)_(__/) )_(_)_		[ Also known as Andrew ]
     /              /|
    '              |/

----------------
Po Cheung NG                               ISD:  +61 2 697-4056
JMRC, School of Elec. Eng. and Comp. Sci., STD:  (02) 697-4056
The University of New South Wales,         FAX:  +61 2 662-2087
PO Box 1, Kensington,         ARPA: pcng%cad.jmrc.eecs.unsw.oz.au@uunet.uu.net
Sydney, NSW 2033,             JANET: cad.jmrc.eecs.unsw.oz!pcng@ukc
AUSTRALIA.                    ACSnet: pcng@cad.jmrc.eecs.unsw.oz

UUCP:  {enea,hplabs,mcvax,prlb2,uunet,ubc-vision,ukc}!munnari!cad.jmrc.eecs.unsw.oz!pcng

chip@vector.UUCP (Chip Rosenthal) (03/01/89)

In article <168@biar.UUCP> trebor@biar.UUCP (Robert J Woodhead) writes:
>I am running SCO Xenix 386 on Tandy 4000 and 4000lx boxes.  I am setting up
>a special access system and want to bypass login; in other words, when 
>activity is detected on a serial line, I want to spoof the login procedure,
>log into a specific account, and start running my program.

Two points:  first, the "login" sources won't help, and second, you don't
want to do this.

The reason "login" won't help is that the "login:" prompt doesn't come
from the login program, it comes from getty.  Once getty has successfully
read a login user name, it then calls the login program to get the
password.  Therefore, there is nothing you can do at the login level to
get rid of this prompt, short of trashing getty.

The reason why you don't want to do this is that you are going to have
big problems with noise on the serial line starting your program.  I
have experienced this with a printer server I wrote to which runs on a tty
line to a PC.  I need to specifically watch for isolated glitches on the
line, otherwise I'd be generating garbage printouts every time somebody
cycled power on the PC.

My suggestion is that you use the existing init/getty/login stuff, just
customize things appropriately.  First, setup a username with no
password which directly runs your program.  Second, you can customize
your /etc/gettydefs file to put a prompt other than "login:" on the
line.  For example, if you create the username "run", change the login
prompt from "login:" to "Type 'run' to begin the program > ".  Of
course, you will have to modify /etc/ttys to point to this gettydefs
entry.

By the way, if you still want to mess around with "login", jfh@rpp386
recently posted one to comp.sources.misc.  I am running it under SCO
XENIX 386 and am very happy with it.
-- 
Chip Rosenthal     chip@vector.UUCP    |      Choke me in the shallow water
Dallas Semiconductor   214-450-5337    |         before I get too deep.

frankb@usource.UUCP (Frank Bicknell) (03/01/89)

In article <168@biar.UUCP>, trebor@biar.UUCP (Robert J Woodhead) writes:
> I am setting up a special access system and want to bypass
> login; in other words, when activity is detected on a serial
> line, I want to spoof the login procedure, log into a
> specific account, and start running my program.  

I _think_ what you want to do is covered in an article in the
Mar/Apr '88 issue of DiSCOver.  To summarize, you put the AUTO
keyword in a new /etc/gettydefs entry.  The example given was:

p # B9600 CS8 SANE ICANON TAB3 IXANY #
	B9600 CS8 SANE TAB3 IXANY #\r\n@!login: #
	p # AUTO /etc/login
	
I tried that and it seems to work.  I'm not sure what the second
line is still around for: login doesn't use the prompt.  Oh,
well, excess baggage.  

You edit /etc/ttys to include 'p' in the second position for the
tty which will be used.  Unlike what it hints at in the article,
be sure the port is disabled when you edit its /etc/ttys entry.

Then you use mkuser to create a user with the same name as the
port the application will be run on.  Eg: tty1a is the user
name.  Forget the password: getty isn't going to run the part of
the program that asks for it anyway.

You should modify .profile to run the application you wish to
use.

Now enable the port in the usual way.  The terminal will come
right up without having to log in.

You'll find that you can't disable the port :) .  OOPS.  They
forgot to mention that.  Here's how:

	First send init a SIGQUIT signal: kill -3 1
	Then log off the port or kill all the processes associated
		with it.
	Disable the port as you normally would.
	Finally, send init a SIGINT signal: kill -2 1

Note that new logins will be disabled after you do the kill -3 1.

After you're through experimenting and have it right, reboot to cause
init to start respawning new logins.

Is there an easier way to break into such a loop to disable the terminal?
(be glad when SCO brings forth inittab: changing the machine state won't
be so kludgy.)
-- 
Frank Bicknell; 1405 Main St, Ste 709; Sarasota, FL 34236-5701
killer!usource!frankb

jbayer@ispi.UUCP (Jonathan Bayer) (03/01/89)

In article <168@biar.UUCP> trebor@biar.UUCP (Robert J Woodhead) writes:
>I am running SCO Xenix 386 on Tandy 4000 and 4000lx boxes.  I am setting up
>a special access system and want to bypass login; in other words, when 
>activity is detected on a serial line, I want to spoof the login procedure,
>log into a specific account, and start running my program.
>
>Please tell me if there is an easy way to do this.  Once my user gets to


I was about to say RTFM, but it took me a half an hour to find the
answer, and I knew it already!  You didn't say which version of Xenix
you are running, so I will address it for version 2.3.1 (which is what
I am running).  I believe that except for the manual references it is
also valid for 2.2.?.

In the Xenix System Administrators' Guide on page 14-10 through 14-11,
it talks about the gettydefs entry.  Quoting from the manual:
----------------------
The Gettydefs File

The file /etc/gettydefs contains the information that getty uses to
setup terminal line characteristics such as baud rate.  The file is in
the form of a table.  Each table entry is divided into five fields. 
These fields include:

label # initial-flags # final-flags # login-prompt # next-label [# login-program]

The fields are:

(we are concerned about the login-program, so I will skip to that)

login-program	The name of the program which actually logs users onto
		XENIX.  The default program is /etc/login.  This field
		is optional and is specific to XENIX.

		If preceded by the keyword "AUTO", getty does not prompt
		for a user name, but instead uses the device name (i.e.
		tty03) as the user name and immediately executes the
		login-program.

--------------------------------

I hope this helps.

JB

-- 
Jonathan Bayer			      Beware: The light at the end of the
Intelligent Software Products, Inc.	      tunnel may be an oncoming dragon
19 Virginia Ave.				...uunet!ispi!jbayer
Rockville Centre, NY 11570  (516) 766-2867    jbayer@ispi.UUCP

csch@netcs.UUCP (Clemens Schrimpe) (03/03/89)

trebor@biar.UUCP (Robert J Woodhead) writes:
<> I am running SCO Xenix 386 on Tandy 4000 and 4000lx boxes.  I am setting up
<> a special access system and want to bypass login; in other words, when 
<> activity is detected on a serial line, I want to spoof the login procedure,
<> log into a specific account, and start running my program.
Look up the gettydefs(F) manual page. Watch for the AUTO exec feature !

regards,

	Clemens Schrimpe, netCS GmbH Berlin
	(csch@garp.mit.edu)

rk@unify.UUCP (Ron Kuris) (03/04/89)

I'm reasonably sure that there is the name of a program to invoke instead
of "login" in gettydefs in SCO Xenix.  Check the "gettydefs" man page.

-- 
Ron Kuris		(916) 920-9092
rk@unify.UUCP
{{ucdavis,csun,lll-crg}!csusac,pyramid,sequent}!unify!rk