A dial-in callback server allows you to gain access to your system using the callback procedure.
The callback procedure allows you to establish the connection, invoke the authentication procedure and provide phone number where the dial-in server will call you back.
The description for setting up a dial-in callback server is based on How to Set Up a Dial-In Server and provides only changes.
The mgetty utility is responsible for the initialization of the TTY interface and for the answering of the incoming calls. Once the call establishment is complete, mgetty will start the modified pppd utility pppd.callback. The pppd.callback will establish the PPP link, invoke the authentication procedure and obtain callback parameters. Finally, pppd.callback will disconnect the link and execute the user-provided application (script) that will issue the call back.
Set up the dial-in server as described in How to Set Up a Dial-In Server. Finally, follow the described procedure below to configure a dial-in callback server.
Install the changed ppp.callback ppp application in the /usr/sbin directory.
Change the context of the /etc/mgetty+sendfax/login.config file as follows (it uses now the changed ppp application ppp.callback):
# Automatic PPP startup on receipt of LCP configure request (AutoPPP).
# mgetty has to be compiled with "-DAUTO_PPP" for this to work.
/AutoPPP/ - a_ppp /usr/sbin/pppd modem
#
# Disable login sessions
#
* - - /bin/false @
Change the context of the /etc/ppp/options file as follows:
#
# Common options for TTY interfaces
#
#
# Debug
#
#debug 9
#kdebug 9
#
#
# Allow callback operation and set-up callback script
#
callback 211
callbackscript /etc/ppp/callback.sh
modem
noipx
noccp
nodeflate
nobsdcomp
asyncmap 00000000
lcp-echo-interval 10
lcp-echo-failure 5
#
# Set the local system name
#
user roadrunner
#
# Provide the address of your DNS server
#
ms-dns 192.168.212.130
nodefaultroute
proxyarp
netmask 255.255.255.255
auth
#
# The two following lines will disable CHAP and allow PAP
#
#require-pap
#refuse-chap
#
# the following option disables the identification via "clear text"
# user name and password transmission and
# enable CHAP and derivates # refuse-pap +chap +chapms +chapms-v2
#
# Allows to set idle link timeout
#
#idle 900
Note: The "lock" option was removed and two new parameters were added: "callback", which activates callback and provides default callback number, and "callbackscript", which provides the name of a callback application.
Create a callback script /etc/ppp/callback.sh as follows:
#! /bin/sh
set -e
# Parameter 1 - Callback Address
# Parameter 2 - TTY device name
# Parameter 3 - peer auth name
if [ $(($#)) -lt $((3)) ]
then
logger -i -t callback.sh Parameter missing > /dev/null 2>&1
exit 1
fi
mantool="/usr/lib/eicon/divas/divactrl mantool -b -Exclusive -WDog -c 1001"
#
# Read the callback parameters from the management interface
# phone=$1 tty_dev=$2 tty_nr=$2 name=$3
# parameter is passed as "/dev/ttydsXX"
tty_nr=$(($(echo ${tty_nr} | sed -e "s/^.*ttyds//" -)))
if [ $((tty_nr)) -lt $((1)) ]
then
logger -i -t callback.sh Invalid tty name $1 > /dev/null 2>&1
exit 1
fi
#
# Set up the dial script file name
#
dial=/etc/ppp/diva_dial.$((tty_nr))
tty_nr=$(($tty_nr-1))
dir_start=$(($tty_nr/50))
dir_start=$(($dir_start*50))
dir_start=$(($dir_start))
dir_end=$(($dir_start+50))
offset=$(($tty_nr-$dir_start))
offset=$(($offset+1))
atinit=$(${mantool} -rTTY\\TTY$(($dir_start+1))-$((dir_end))\\T$((offset))\\AtInit | sed -e "/^$/d" - | sed -e "s/^.* = //" -)
protocol=$(${mantool} -rTTY\\TTY$(($dir_start+1))-$((dir_end))\\T$((offset))\\ProtocolName | sed -e "/^$/d" - | sed -e "s/^.* = //" -) txspeed=$(${mantool} -rTTY\\TTY$(($dir_start+1))-$((dir_end))\\T$((offset))\\TxSpeed | sed -e "/^$/d" - | sed -e "s/^.* = //" -)
if [ -z "$atinit" ]
then
atinit="AT&F9"
fi
atinit="${atinit}E1V1"
#
# Check for V.110 (GSM) callback and set the connection parameters
#
baud=""
if [ "$protocol" = "V.110" ]
then
if [ $((txspeed)) -eq $((38400)) ]
then
baud="+ib7+iu=<8890214d00bb>"
else
# Use 9600Bps as default bit rate
baud="+ib5+iu=<8890214800bb>"
fi
fi
if [ ! -z "$baud" ]
then
atinit="${atinit}${baud}"
fi
#
# Create the dial script now
#
echo "#! /bin/sh" > ${dial}
echo "" >> ${dial}
echo "chat -S -V -t 90 ABORT BUSY ABORT NO REPORT CONNECT '' \"${atinit}\" OK ATD${phone} CONNECT " >> ${dial}
chmod 700 ${dial}
logger -i -t callback.sh "Callback(${phone},${tty_dev},\"${atinit}\"${name})" > /dev/null 2>&1
#
# Start PPP
#
/usr/sbin/pppd.callback ${tty_dev} 115200 connect ${dial} modem user $user nocallback nodetach
exit $(($?))
Change the permissions of callback.sh file to "executable".
The callback script receives the callback number, the Diva TTY device name and the peer name from the command line, i.e., from pppd.callback instance that was responsible for the callback procedure and retrieves the information about used bearer protocol and framing from the management interface of Diva TTY driver. Finally, "callback.sh" uses the available information to construct dial script and to issue the callback.