[comp.dcom.modems] call back

wyle@solaris.UUCP (Mitchell Wyle) (07/13/88)

How do I tell my machine to call me back?  I would prefer if my company
paid for the phone calls :-).  I want to be able to login, issue a
command, and have the machine call me back, with a csh or init running
on the line.  I could tell uucico to call me, but I would have to talk
uucp g protocol after my modem answered :-).  I want a shell or a login
prompt.

I'm sure it's been done...  Thanks for your help.  -Mitch

-- 
-Mitchell F. Wyle            wyle@ethz.uucp
Institut fuer Informatik     wyle%ifi.ethz.ch@relay.cs.net
ETH Zentrum                  
8092 Zuerich, Switzerland    +41 1 256-5237

lubich@ethz.UUCP (Hannes Lubich) (07/14/88)

Mitch, at ETH, at least, this has got nothing to do with the machine,
you want to talk to. Just use the callback facility on KOMETH (our local
broadband network). If you're called back, you get a KOMETH session and
just dial in to any machine you want.
Yes Sir, it's that easy this time :-)
Cheers
	--HaL
-- 
~ UUCP/Usenet 	       : {known world}!mcvax!cernvax!ethz!lubich
~ or                   : lubich@ethz.uucp
~ CSNET/ARPA/BITNET    : lubich@ifi.ethz.ch / lubich%ifi.ethz.ch@relay.cs.net
~ The usual disclaimer : No, it wasn't me, somebody must have used my account.

evas@eurtrx.UUCP (Eelco van Asperen) (07/15/88)

in article <428@solaris.UUCP>, wyle@solaris.UUCP (Mitchell Wyle) says:
> How do I tell my machine to call me back?  I would prefer if my company
> paid for the phone calls :-).  I want to be able to login, issue a
> command, and have the machine call me back, with a csh or init running
> on the line.  

If your machine has 'cu' (call Unix), then it's simple; I've got a 
small script that looks up users in a callback-database, locates a 
free dialer and starts the dial-back. Shout if you want it.

Eelco van Asperen
------------------------------
Erasmus Universiteit Rotterdam
T H E    N E T H E R L A N D S
------------------------------
uucp:              evas@eurtrx
          ..!mcvax!eurtrx!evas
earn/bitnet:   asperen@hroeur5
------------------------------

steve@edm.UUCP (Stephen Samuel) (07/16/88)

From article <428@solaris.UUCP>, by wyle@solaris.UUCP (Mitchell Wyle):
> How do I tell my machine to call me back?  I would prefer if my company
> paid for the phone calls :-).  I want to be able to login, issue a
> command, and have the machine call me back, with a csh or init running
> on the line.  I could tell uucico to call me, but I would have to talk
> uucp g protocol after my modem answered :-).  I want a shell or a login
> prompt.

There are a couple of ways to do this: 

1) if you have the 'ct' command, you can use it to dial out and start
up a gety task, you would then need a command like;
 (sleep 40 ; ct mynumber ) & 
 exit

40 seconds later, a ct run is started up..

2) write something like the following

	stty -hupcl -echo
	sleep 2
	echo  '+++\c' 
	sleep 2
	echo  'ATDT5551234\r\c'
	sleep 60
	stty echo
 It's possible to improve it by adding things like making it into
 a C program that can recognize a CONNECT/NO CARRIER etc. message
 and react appropriately, but I think the general Idea gets across.

 One serious problem with the shell script is that it leaves your
 system vulnerable to someone who manages to dial in between your
 hanging up and the system dialing out (you'd have a shell running
 at that point).
-- 
-------------
 Stephen Samuel 			Disclaimer: You betcha!
  {ihnp4,ubc-vision,mnetor,vax135}!alberta!edm!steve
  BITNET: USERZXCV@UOFAMTS

tony_mak_makonnen@cup.portal.com (07/17/88)

message for Eeelco : I would really like to get a copy of the script
for call back:
      Tony Fiorentino P.O Box 170392 SAn Francisco CA Usa 94117

evas@euraiv1.UUCP (Eelco van Asperen) (07/19/88)

in article <301@eurtrx.UUCP>, evas@eurtrx.UUCP (Eelco van Asperen) says:
> 
> If your machine has 'cu' (call Unix), then it's simple; I've got a 
> small script that looks up users in a callback-database, locates a 
> free dialer and starts the dial-back. Shout if you want it.
> 

Since I made this offer, my mailbox has been flooded with requests for
this script so I've decided to post it. I don't consider this a very 
elegant script but then it does what it's supposed to do.

Eelco van Asperen.		
-------------------------------------------------------------------------
uucp:        evas@eurtrx / mcvax!eurtrx!evas	#include <inews/filler.h>
earn/bitnet: asperen@hroeur5			#include <stdjunk.h>
-------------------------------------------------------------------------

# This is a shar archive.  Extract with sh, not csh.
# This archive ends with exit, so do not worry about trailing junk.
# --------------------------- cut here --------------------------
PATH=/bin:/usr/bin
echo Extracting callback
sed 's/^X//' > callback << '+ END-OF-FILE 'callback
X#! /bin/sh
X#
X# callback -- a call-back facility for aiv-staff members.
X#
X# usage:	callback [baud [waittime] ]
X#
X# v1 03-10-86  Eelco van Asperen
X# v2 06-07-88  Cleaning-up
X#
X# this is the file where user/telno data are stored:
X#
XCALLDBS="/usr2/aiv/admi/callback.dbs"
X#
X# first get callers name:
X#
XHISNAME=`who am i | cut -f1 -d" " -s`
X#
X# now see if he/she is in the callback-database:
X#
XHISENTRY=`grep ^$HISNAME: $CALLDBS`
XPHONENUM=`echo $HISENTRY | cut -d":" -f2 -s`
X#
Xif [ -z "$PHONENUM" ]
Xthen
X	echo "Your name is not in the call-back database; contact your sysop."
X	exit 1
Xelse
X	echo "Your phone-number: "$PHONENUM
Xfi
Xif [ -n "$1" ]
Xthen
X	BAUD=$1
Xelse
X	BAUD=`echo $HISENTRY | cut -d":" -f3 -s`
Xfi
Xif [ -z "$BAUD" ]
Xthen
X	# system default baudrate:
X	BAUD=1200
Xfi
XWAIT=15
Xif [ "$2" != "" ]
Xthen 
X	#
X	# how long should 'cu' wait for a free dialer ?
X	# (in minutes)
X	#
X	WAIT=$2
Xfi
X#
X# Parse the /usr/lib/uucp/Devices-file to find list of dialers;
X#
XTMPFILE=/tmp/cback.$$
Xtrap 'rm $TMPFILE' 0 1 15 
XDEBUG=9
X
Xawk -F" " '
XBEGIN	{ dialers=""; 
X	  speeds="";
X	}
X/^ACU/	{ if ($4 == reqspeed)
X		dialers = dialers " " $2;
X	  else	if (speeds == "" || index(speeds,$4) == 0) {
X			speeds = speeds " " $4;
X		}
X	}
XEND	{ if (dialers == "") {
X		print "echo \"Sorry, there are no dialers at",reqspeed,\
X			"baud available on this system.\"";
X		print "echo \"Dialers are available at the following speeds:\""
X		print "echo \"	",speeds,"\""
X		print "exit 1";
X	  }
X	  else {
X		print	"for i in",dialers
X		print	"do"
X		print	"	if [ ! -f /usr/spool/locks/LCK..$i ]"
X		print	"	then"
X		print	"		echo \"Found free dialer $i\""
X		print	"		exit 0\n"\
X			"	fi\n";
X		print	"done"
X
X		print	"echo \"Sorry, all dialers are currently locked\"";
X		print	"echo \"Start callback anyway (y,n) ? \\c\"";
X		print	"read answer";
X		print	"if [ \"$answer\" != \"y\" ]";
X		print	"then";
X		print	"	exit 1";
X		print	"fi";
X		print	"exit 0";
X	  }
X	}
X' reqspeed=$BAUD /usr/lib/uucp/Devices >$TMPFILE
X
Xsh $TMPFILE
Xif [ $? != 0 ]
Xthen
X	exit 1
Xfi
Xtrap "" 0 1 15 
Xrm -f $TMPFILE
X#
X# start dialing:
X#
X(nohup ct -w${WAIT} -s${BAUD} -x${DEBUG} 0-${PHONENUM})&
Xecho "Dial-back started..."
Xexit 0
+ END-OF-FILE callback
chmod 'u=rwx,g=rx,o=rx' callback
set `sum callback`
sum=$1
case $sum in
28879)	:;;
*)	echo 'Bad sum in 'callback >&2
esac
echo Extracting callback.dbs
sed 's/^X//' > callback.dbs << '+ END-OF-FILE 'callback.dbs
X#
X# format:
X#	loginname:phonenumber[:baudrate]
X#
Xevas:01234-87654:1200
Xdumbuser:123456
+ END-OF-FILE callback.dbs
chmod 'u=rw,g=r,o=' callback.dbs
set `sum callback.dbs`
sum=$1
case $sum in
6774)	:;;
*)	echo 'Bad sum in 'callback.dbs >&2
esac
exit 0

jbn@glacier.STANFORD.EDU (John B. Nagle) (07/19/88)

In article <3208@edm.UUCP> steve@edm.UUCP (Stephen Samuel) writes:
> One serious problem with the shell script is that it leaves your
> system vulnerable to someone who manages to dial in between your
> hanging up and the system dialing out (you'd have a shell running
> at that point).

      Telephone people call this "glare".  There's a basic problem with
using the same phone line for originating and receiving calls.  There's
a risk that when the phone goes off-hook to originate a call, it is actually
answering a call for which ringing has not yet started.  Depending upon the
utilization of the line involved, this may happen very seldom or quite
frequently.  It happens constantly with PBX trunks, since one normally
orders enough outside lines for your PBX to meet the peak hour load.
So there's a solution.

      The trouble comes from the convention that the station equipment
(the phone) requests dial tone from the central office with the same
signal (placing a resistance of about 600 ohms between "tip" and "ring",
the two wires of the phone line) that it uses for answering after a ring.
These functions really should be performed with separate signals.  It
is possible to order trunks with "ground start", where they are.  On
a ground start trunk, it is necessary to ground one wire of the line
to get dial tone.  This also makes the line busy with regard to receiving
calls, eliminating the ambiguity.

      Are there commercial modems available that can utilize ground-start
trunks properly?  Sites that do heavy dial-out on dial-in lines, and 
anybody who uses "security call-back" systems, should have ground start
lines and suitable hardware.

      Some low-rent PBXs don't use ground-start lines.  The next time
you call a company with a PBX, and find yourself connected to someone
trying to place an outgoing call, you've found one.

      					John Nagle

karl@sugar.uu.net (Karl Lehenbauer) (07/23/88)

In article <17569@glacier.STANFORD.EDU>, jbn@glacier.STANFORD.EDU (John B. Nagle) writes:
>       Telephone people call this "glare".  There's a basic problem with
> using the same phone line for originating and receiving calls.  There's
> a risk that when the phone goes off-hook to originate a call, it is actually
> answering a call for which ringing has not yet started.  Depending upon the
> utilization of the line involved, this may happen very seldom or quite
> frequently.  ...

Yes.  This is a security hole for uucp, as a guy could possibly get your
line right as your modem picked it up to dial out, then spoof a login 
and get your machine's uucp logon and password for the remote machine.

I get a lot of incoming modem calls on my system, and, annoyingly often
when dialing out via cu or kermit, the modem picks up to dial and instead 
picks up an incoming call.

Many Hayes-compatible modems (including some Hayes ones, I think) can be
configured to listen for a dial tone and not dial out if they don't
hear one, which helps in some ways, but doesn't improve security a 
whole lot because the dedicated cracker can easily play a dialtone to trick
your modem.
-- 
-- backups:  always in season; never out of style.
-- karl@sugar.uu.net aka uunet!sugar!karl

evas@euraiv1.UUCP (Eelco van Asperen) (07/24/88)

in article <3208@edm.UUCP>, steve@edm.UUCP (Stephen Samuel) says:
> 1) if you have the 'ct' command, you can use it to dial out and start
> up a gety task, you would then need a command like;

This is what I *intended* to mention in my previous posting; unforunately,
my brain was disconnected from my fingers for a few seconds and I typed
'cu (call Unix)'. Oops.

>  One serious problem with the shell script is that it leaves your
>  system vulnerable to someone who manages to dial in between your
>  hanging up and the system dialing out (you'd have a shell running
>  at that point).

If you invoke the standard getty from a shell that checks for a lock-
file, you could dial-in, give the command to call back, which creates
the lock, and logout.
After the logout, the getty-shell notices the lock and starts to dial
the number you requested. When a connection has been established,
it forks off a getty to enable you to login.
If this getty terminates, ie. you have logged out, it removes the
lockfile, terminates the connection and restarts a getty to enable
future logins.
By taking the tty- and locking-routines from C-kermit, it should not
be too hard to produce such a program. If I feel like it, I might
even give it a go someday.


-- 
Eelco van Asperen.		
uucp:        evas@eurtrx / mcvax!eurtrx!evas	#include <inews/filler.h>
earn/bitnet: asperen@hroeur5			#include <stdjunk.h>
"We'ld like to know a little bit about you for our files" - Mrs.Robinson,	 Simon & Garfunkel

dank@cerebus.UUCP (Daniel P. Kionka) (07/25/88)

In article <717@euraiv1.UUCP> evas@euraiv1.UUCP (Eelco van Asperen) writes:
>in article <301@eurtrx.UUCP>, evas@eurtrx.UUCP (Eelco van Asperen) says:
>> 
>> If your machine has 'cu' (call Unix), then it's simple; I've got a 
>> small script that looks up users in a callback-database, locates a 
>> free dialer and starts the dial-back. Shout if you want it.
>
>Since I made this offer, my mailbox has been flooded with requests for
>this script so I've decided to post it. I don't consider this a very 
>elegant script but then it does what it's supposed to do.
>...
>X(nohup ct -w${WAIT} -s${BAUD} -x${DEBUG} 0-${PHONENUM})&
         ^^
	 Oh no, call terminal!!!

This is a very useful script, but it is based on "ct", not "cu".  I
think the original poster and I have the same problem -- we can't find a
copy of "ct".  I heard that it is a SysV utility, and we have BSD.
Since there were many requests for the script using it, I am sure it
would be worth posting a "ct" program, if anyone has one.  Thanks.

-- 
Dan Kionka			{amdahl,unisoft,uunet}!cerebus!dank
Fujitsu America Inc., San Jose, CA, (408) 432-1300 x5205