# Chapter 9. Configuring kppp for callback

The following section was provided by Martin Häfner.

This chapter descibes the configuration of kppp for callback. The following servers are supported:

# 9.1. Unix (Linux) callback server

This section introduces in Unix (Linux) callback proceeding and how kppp can be configured to connect to a Unix callback server, especially to a scripting based Linux callback server.

If you have any questions or problems please feel free to contact the author of this section.

## 9.1.1. Introduction in callback

To increase the security of your local network or to reduce the expenses of your external co-workers, setting up a callback server could be your first choice. Think about someone calling the number of your dial-in server and cracking a password? Why do you maintain a firewall for your internet connection then? Callback software generally asks you for your name and looks up the number to call back from a database. Therefore, the number should be stored on the server. After authentication the server will hang up the line and call you back immediately on the number chosen. The client picks up the phone line and continues the dial-in as if nothing happened. The server will ask for username and password, then the connection is established and the pppd could be started. Now, how can I tell the client to pick up the phone? Do I need a program like mgetty? Well, the answer is "NO"! You do not need a special client program. Generally spoken, all clients can be used for callback connections. You can even use an ordinary terminal program like minicom to connect to a callback server. The only thing you have to do is to tell your modem to `AutoAnswer` the phone when a `RING` is detected by the modem. This is done by using a certain modem command:

     AT&S0=1

This means that the modem will pick up the phone after one `RING`. Remember, this is done without any client software interaction. Like a lot of other client programs kppp checks if the connection is closed by the server and stops the current session if a `NO CARRIER` is detected. And this it the next problem: `NO CARRIER` is detected when the callback server hangs up the line after he knows on which number to call the client back. Some servers use a special login program therefore. How can you solve that problem? Tell your modem to show carrier up all the time (which makes no problems if the client hangs up the line) by using the modem command:

     AT&C0

If you want to test this you can first use an ordinary terminal program like minicom and call your callback server.

## 9.1.2. The kppp setup

Setting up kppp to connect to a Linux callback server is quite straight forward.

1. You only have to tell the modem to accept connections (see above) and not to stop the dialing when the callback server hangs up the line for the first time to initialize for the callback attempt. Both are modem settings which have to be configured in the "Modem" tab of the configuration. Make sure your setup looks like the following:

        Dial String:   AT&C0S0=1DT

   All the other configuration issues will remain as-is. kppp has some problems with modem init and reset. See the troubleshooting section if you are confronted with trouble.

2. Think about your server a moment. Remember that Unix and Windows operating systems have a different opinion about how to make line termination in text files (and in login procedures): simple CR or CR/LF or LF if you want to connect to a Macintosh server. Use CR as your line termination.

3. The next sections describes the callback setup of kppp on base of the Linux callback package (see below) which uses an ordinary user login (no PAP or whatever). Therefore you have to set up the following authentication style within the "Dial" tab of the account configuration:

        Authentication:   Script-based

   Of course, you can first choose "Terminal based" and test your connection. Have a look on what the server asks you so you can write your login script afterwards.

4. Now you have to build the login script. This is a quite cool feature of kppp. Just click around a little in the "Login Script" tab of your Account setup. For my server, the user "xyz" needs the following script to be called back at home (the callback server knows a table of names and numbers, so that you will select your phonenumber by an alias (security!)):

        Expect      ogin:       # remember, we do ordinary terminal login
        ID          ""          # kppp sends the id you have configured in the main dialog
        Expect      for xyz:    # a list of avaiable numbers is shown. The user must select one
        Send        xyz-home    # the user wants to be called back at home
        Expect      ogin:       # the callback process is running, a new connect, a new login
        ID
        Expect      assword:
        Password                # now your password authentication
        Expect      >           # wait for the command prompt (this may vary)
        Send        start_ppp   # start_ppp starts the pppd

   Just ignore the comments beginning with "#". After waiting for the login request he sends his user ID and waits for the list of available connections for his user ID. Then he tells the server on which number he wants to be called back. kppp can open a dialog for that (very nice feature) if your domicile changes rapidely (e.g. you are a representative and you are travelling from hotel to hotel). Now the server expects the login and Password authentication. In the meanwhile the server hangs up the line and calls the user back. kppp expects the commandline prompt and starts a small script which fires up the pppd on the server. The script may look like the following:

          #!/bin/sh

          stty -echo

          exec /usr/sbin/pppd -detach silent modem

   Of course, setting up a PPP-server is not within the scope of this document. For detailed information see the pppd man pages. An example callback server is described here.

All the other configuration issues (e.g. pppd config or IP settings) work as usual. Remember, no special software is needed to pick up the line.

Notice: kppp callback and other programs like mgetty or any other faxgetty can be run on the same serial port. There are no problems with the dial-in as kppp creates a Lock-file which will indicate the getty program that another program (kppp) is using the line at the moment. See problems with mgetty in the general troubleshooting below.

## 9.1.3. Troubleshooting

There are some known problems with kppp in callback mode:

- As you initialize the modem with AutoAnswer you would need to reset the modem after your connection closed. Otherwise your modem will continue to pick up the line for you.

- As already described in the setup section you will have to initialize the modem with the dial string. The normal kppp "initialization string" does not take more complex init strings needed for a callback setup.

- The next topic is more general and not related with callback: kppp has some slight problems when sharing the modem line with another program like mgetty. If mgetty is running on the same modem line, kppp is not able to initialize the modem correctly. This only happens on the second attempt.

- kppp is able to prompt for certain user input during a scripting based connetion. Unfortunately kppp also asks me for my user ID the second time the user ID will be asked for by the server (see the login script section above). If you want to get rid of that you will have to hardcode your user ID within your login script (not very nice, but it helps).

## 9.1.4. Internet Resources for server software

Linux callback server software bundles are available throughout the internet. Of course, the all known mgetty is a very powerful program which is also able to handle callback connections. There is a description for how to set up mgetty for that purpose here. The site is maintained by Colin Mc Kinnon, so please don't ask me if you have any problems. But there is also a ready-to-use package for a Linux callback server available here. The package is maintained by Frank B. Brokken. As the package is not very easy to set up (although the setup is straight forward), I have written a short introduction for it. Also have a look in it if you need further general introduction to callback.