[comp.unix.questions] Auto-logout.

raanan@bc-cis.UUCP (03/19/87)

	We have a Vax 780/11 running 4.2BSD. Few of the tty lines are 
connected to Hayes modems fopr users to dail-in.

	We have a problem of users calling in, then disconnecting without
the logout command. So, the system thinks that they are still logged-in and
it is also a security problem because if somebody dials-in to the same tty
line, he can continue the shell of another user.

	What do I have to do so that such a user will be logged-out if he
disconnect the line?
-- 
------------------------------------------------------------------------
Raanan Herrmann  (...!delftcc,phri!bc-cis!raanan)

jerry@oliveb.UUCP (03/27/87)

In article <868@bc-cis.UUCP> raanan@bc-cis.UUCP (Raanan Herrmann) writes:
>	We have a problem of users calling in, then disconnecting without
>the logout command. So, the system thinks that they are still logged-in and
>it is also a security problem because if somebody dials-in to the same tty
>line, he can continue the shell of another user.
>
>	What do I have to do so that such a user will be logged-out if he
>disconnect the line?

Unix will send a HANGUP signal to the user's processes if the carrier
detect (CD) line from the modem drops.  The CD line will drop when the
modem can no longer "hear" the carrier from the remote modem.  This is
the normal and intended method for handling this kind of situation.

I am posting this rather than mailing it because it seems to be a common
problem.  A large number of systems do NOT log out when I break the
connection.

For this to work several things have to be true:

    1 - The modem has to be configured to give true carrier to the
	host.  Due to brain-damaged people and systems, many of which
	require that CD be true at all time, some modems are shipped
	configured with CD true.  You want this OFF.  Check the manual
	for your modem.
    
    2 - CD (pin 8) must be connected from the modem to the host.  If you
	use 3 wire connections, with jumpers on each end to simulate the
	modem control signals, then you lose.  (This is frequently
	called a "NO-HUP" cable for obvious reasons.)
    
    3 - Your serial line hardware (tty port) must support modem control,
	at least for CD an preferably for Data Terminal Ready (DTR)
	also.  Some do not have modem support and a few only have it on
	some of the ports.  Again, check your manual, and move the
	dialin lines to the ports with modem control.
    
    4 - Your software must use the modem control.  To simplify
	connections the software allows declaring a port to be without
	modem control.  In that case there would be no recognition of
	the CD signal.

If all this is set up correctly, then hanging up the phone will
automatically log the user out.  It is also desirable to have DTR
connected from the port to the modem and have the modem jumpered to NOT
answer the phone unless DTR is true.  This means users get a
ring-no-answer when the port is disabled rather than paying for a phone
call and finding out they can't log in.

It will also hang up your end of the phone after a UUCP connection
terminates, important if the other system doesn't have CD connected and
won't hang up itself.  Believe it or not, some systems out there run
without DTR control of the modem.  They depend on the other end of the
connection hanging up the phone to break the connection.  When two such
systems call each other for UUCP the connection never is broken.  I have
seen reports of the net of 48hour+ calls and associated flak about the
phone bills.

					Jerry Aguirre
					Systems Administration
					Olivetti ATC

jwg@galbp.UUCP (04/03/87)

Did you know that when a process group leader exit()'s, all of the members
of that group get SIGHUP's?  I found this in the Xenix 3.0 kernel.  Is it
standard UNIX?  I don't recall it documented anywhere.

The result is that a process group member may get TWO SIGHUP's when the phone
hangs up: one from the tty code, and the other IF the process group leader
exit()'s first.  Anyone else run into that one?

guy@gorodish.UUCP (04/05/87)

>Did you know that when a process group leader exit()'s, all of the members
>of that group get SIGHUP's?

Yup.

>I found this in the Xenix 3.0 kernel.  Is it standard UNIX?

It's not universal, but it's pretty standard.  System III and System
V do this; I think 4BSD does it as well, as long as "init" does a
"vhangup" call on the line.

>I don't recall it documented anywhere.

From the System V manual page EXIT(2):

	"Exit" terminates the calling process with the following
	consequences:

		...

		If the process ID, tty group ID, and process group
		ID of the calling process are equal, the SIGHUP
		signal is sent to each process that has a process group
		ID equal to that of the calling process.

davidsen@steinmetz.UUCP (04/06/87)

Under the three versons of SysV I have used, the stty flag HUPCL
controls hangup termination, and is not an implicit part of modem
control on a port. I don't think it works without modem control, but
need not work with it, either.
-- 
bill davidsen			sixhub \
      ihnp4!seismo!rochester!steinmetz ->  crdos1!davidsen
				chinet /
ARPA: davidsen%crdos1.uucp@ge-crd.ARPA (or davidsen@ge-crd.ARPA)