old-www/HOWTO/Call-back-2.html

480 lines
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>call-back mini HOWTO: Procedure</TITLE>
<LINK HREF="Call-back-1.html" REL=previous>
<LINK HREF="Call-back.html#toc2" REL=contents>
</HEAD>
<BODY>
Next
<A HREF="Call-back-1.html">Previous</A>
<A HREF="Call-back.html#toc2">Contents</A>
<HR>
<H2><A NAME="s2">2. Procedure</A></H2>
<H2><A NAME="ss2.1">2.1 PART I: Net at home ?</A>
</H2>
<P>Most of us use the Internet in a place of work. However we offen need
the net at home or outside the place of work. It may be possible that
the work from home is cheaper then from a company building. I think
that the best solution is to install call-back software on the Linux
server. Call-back makes it possible to re-call index number at the
cost of the company. I'll try to present how it works. An entitled
person who calls the modem is varied for the first time in Linux server.
Then on the user's side the "hang up modem" is switched on. At the same
time Linux calls the user. User is verified again. We have connection
and the server is charged. The user pays only for the initiation of the
connection. The double verification and extra options in the call-back
program unable the unsuitable persons to charge our bill. We can
restrict the access to the connection only to corporation network or the
Internet. Call-back is very flexible. Below, I'll try to present the
configuration of a call-back server on Linux system and I'll show you
how to set up your computer for re-calling the connection. I don't
describe configuration of ISDN call-back because I don't use ISDN in
my connection to the Internet. If you set call-back on ISDN send me
your configuration.
I had some problem when I changed my kernel from 2.2.x to 2.4.x. I will
describe new option for a new kernel. Remember that if you change your
kernel for high version you will have to change pppd, too.
I don't create a new section for description of new possibility in kernels
2.4.x but I write a new configurations in old section.
I would like to apologise to people who asked me about options for new
kernels.
I didn't have time to write a new version of HOW-TO. I have changed my
job and place of liveing. Sorry.
<P>
<H2><A NAME="ss2.2">2.2 PART II: The first steps with modem.</A>
</H2>
<P>The administrators prefer different modem but while buying a modem
we should remember certain guidelines:
<P>
<UL>
<LI>If you have USR WinModems see Linmodem-HOWTO.
</LI>
<LI>The externale modem is moust flexible you have more place inste your computer.
</LI>
<LI>The internal modem with ISA slot is better then the are with PCI
slot (you can use your PCI slot for something different )
</LI>
<LI>Don't use Plug modem see Plag-and-Play-HOWTO.
</LI>
</UL>
<P>
<P>When we have the suitable modem we have to set it up in our system.
We have to check on which com our modem is. Then we have to make a
symbolic link to this hardware and /dev/modem. For example, if we have
the modem for the 2nd com we write:
<PRE>
ln -s /dev/cua1 /dev/modem
</PRE>
<P>We check it
<P>
<PRE>
lrwxrwxrwx 1 root uucp 9 Sep 19 19:10 /dev/modem -> /dev/cua1
</PRE>
<P>If we have the modem on different com we have to remember that
<P>
<PRE>
/dev/cua0 is com1
/dev/cua1 is com2
/dev/cua2 is com3
/dev/cua3 is com4
</PRE>
<P>For new kernels:
<P>
<PRE>
/dev/ttyS0 is com1
/dev/ttyS1 is com2
/dev/ttyS2 is com3
/dev/ttyS3 is com4
</PRE>
<P>Now, we check our configuration using the program minicom.
<H2><A NAME="ss2.3">2.3 PART III Call Linux</A>
</H2>
<P>The first step to make the call-back on Linux accessible is to set up
a suitable parameters in kernel. Then we check whether our kernel
serves the protocol ppp. If you don't have ppp in your kernel or in
module you will have to compile your kernel and add ppp. You will find
more information in Kernel-HOWTO.In the kernels 2.4.x series you have to
mark follow options:
<P>CONFIG_PPP=m
# CONFIG_PPP_MULTILINK is not set
CONFIG_PPP_ASYNC=m
CONFIG_PPP_SYNC_TTY=m
CONFIG_PPP_DEFLATE=m
CONFIG_PPP_BSDCOMP=m
<P>After compilation you have to add some lines for /etc/modules.conf
<P>
<P>alias /dev/ppp ppp_generic
alias char-major-108 ppp_generic
alias tty-ldisc-3 ppp_async
alias tty-ldisc-14 ppp_synctty
alias ppp-compress-21 bsd_comp
alias ppp-compress-24 ppp_deflate
alias ppp-compress-26 ppp_deflate
<P>You can't forget that you need new pppd demon for kernels 2.4.x (for me
it was ppp-2.4.0 this ppp has some mistake you have to get latest from ftp.samba.org in /pub/ppp
).
<P>
<P>OK. We have a good kernel. Now, we have to set up the software to our system.
The call-back program is a part of mgetty-sendfax and ppp. You will
find it all in your distribution.
Because the call-back system has double verification we create a
user who will be running ppp on the side of server.
In /etc/passwd you have new user and you have to change their shall.
<P>
<P>
<PRE>
pppuser:klkIOM89mn65H:230:PPP Dialin:/home/pppuser:/etc/ppp/ppplogin
</PRE>
<P>I changed the above line for kernel 2.4.x this line in /etc/passwd (I use shadow
and you don't see password)
<P>
<PRE>
pppuser:x:6778:44:PPP Dialin:/etc/ppp/:/usr/sbin/pppd
</PRE>
<P>I don't use a special script for the running of pppd but I run it directly
while login pppuser.
<P>Then change the password. We have to add information abut password in
the file <CODE>/etc/ppp/pap-secrets</CODE> (more in man pppd)
<P>
<P>
<PRE>
pppuser * password_for_pppuser *
</PRE>
<P>In the 2.4.x kernels you have to write in <CODE>/etc/ppp/pap-secrets</CODE>
<P>
<P>
<PRE>
* * "" *
</PRE>
<P>This user doesn't have a usual shell but a file <CODE>/etc/ppp/ppplogin</CODE>.
We have to make it ourselves. For example <CODE>vi /etc/ppp/ppplogin</CODE> and
we type:
<P>
<PRE>
#!/bin/sh
exec /usr/sbin/pppd -detach 192.168.1.1:192.168.1.2
</PRE>
<P>where the address 192.168.1.1 is the address of server with modem and
the address 192.168.1.2 is the address which we assigned to our modem.
We set up executable options for this file. Because we will use the
ppp demon we have to set up the options for this demon. We edit file
<CODE>/etc/ppp/options</CODE>:
<P>
<PRE>
proxyarp
lock
crtscts
modem
</PRE>
<P>If it's 2.4.x kernel you write in <CODE>/etc/ppp/options</CODE>
<P>
<PRE>
-detach
asyncmap 0
modem
crtscts
proxyarp
lock
require-pap
refuse-chap
ms-dns 192.168.1.1
usepeerdns
</PRE>
<P>The last 3rd option is very important. You use only PAP authentication
,require-pap. Don't use chap authentication, refuse-chap.
You can use ms-dns, If you have M$ Windows system clients you can send
them information about DNS server. If you wont to send IP of DNS server
for Linux/UNIX machine you use usepeerdns option, more in man pppd.
<P>
<P>Proxyarp is the most important from the above options, because you
can go to Internet by the modem in the server. The remaining options
are used to control your modem. You can only work on the server if you remove proxyarp option.
You have to see PPP-HOWTO and man pppd for more information. We will set up our modem now.
Our server must be ready to receive a connection after start.
We edit file <CODE>/etc/inittab</CODE>
and we add it's to modem on the 2en com.
<P>
<PRE>
s1:2345:respawn:/sbin/mgetty ttyS1 -D /dev/ttyS1 vt100
</PRE>
or
<PRE>
s1:2345:respawn:/sbin/mgetty ttyS1 -s 115200 -D /dev/ttyS1
</PRE>
<P>For the 1st com line looks as follows:
<P>
<PRE>
s0:2345:respawn:/sbin/mgetty ttyS1 -D /dev/ttyS1 vt100
</PRE>
or
<PRE>
s0:2345:respawn:/sbin/mgetty ttyS0 -s 115200 -D /dev/ttyS0
</PRE>
We make <CODE>init q</CODE>. If we don't have information about any mistakes in
logs we go to the next step. We come back to directory <CODE>/etc/ppp</CODE> and
create <CODE>options.ttyS1</CODE> (for modem com1 <CODE>options.ttyS0</CODE>)
<P>
<PRE>
IP_local: IP_remote
</PRE>
<P>for our net it will be
<P>
<PRE>
192.168.1.1:192.168.1.2
</PRE>
<P>We have done a lot work so far. Now, we check the file
<CODE>/etc/mgetty+sendfax/login.config</CODE>. The most important line is:
<P>
<PRE>
/AutoPPP/ - a_ppp /usr/sbin/pppd auth -chap +pap login detach 7 debug
</PRE>
<P>If you have 2.4.x kernel you have write in this file:
<PRE>
/AutoPPP/ - a_ppp /usr/sbin/pppd file /etc/ppp/options
</PRE>
The remaining lines can be marked <CODE>#</CODE>.
<P>
<P>We have to set up suid for ppp demon, because pppuser has to run pppd
and make interface work.
I insert have to insert opinion of Bill Staehle
"NOTE: Some distributions think they know better than you, and delete this
permission when their 'admin' tool (yast in SuSE, linuxconf in many others)
is used. Read the documentation of the "tool" to see how to stop this crap."
<P>
<PRE>
chmod u+s /usr/sbin/pppd
</PRE>
<P>and its effect is:
<P>
<PRE>
-rwsr-xr-x 1 root root 106892 Jan 11 1999 /usr/sbin/pppd
</PRE>
<P>I think that it is a good idea is to add it to cron becouse I had a
problem after restart of my server pppd changed preference. It's
normal situation in.
I add opinion of Bill Staehle
"COMMENT: This is what I was referring to. In Red Hat, look at
/usr/lib/linuxconf/redhat/perm/ppp (delete or rename the file)."
<P>Our server will work as router. We have to enable IP forwarding and
we add this line for the file <CODE>/etc/rc.d/rc.local</CODE> :
<P>
<PRE>
echo "1" > /proc/sys/net/ipv4/ip_forward
</PRE>
<P>If you are RedHat user you can change in <CODE>/etc/sysconfig/network</CODE> from
<CODE>FORWARD_IPV4=false</CODE> to <CODE>FORWARD_IPV4=true</CODE>.
<P>
<P>For verification we call to Linux. We use scripts for it. If we do this in
MS Windows we mark options <CODE>"call out a terminal after connection"</CODE>.
We login as pppuser with its password. I hope that all is OK.
<P>
<H2><A NAME="ss2.4">2.4 PART IV Linux calls us</A>
</H2>
<P>We can already call our Linux. Now it's time Linux called us. It's
not very diffucalt. We have to edit only two files. We create a file
<CODE>/etc/mgetty+sendfax/callback.conf</CODE> and we leave it empty.
<P>
<P>Then we have to ask our users for their phone number. It's time to
write the numbers we have connected earlier. In order to do it we
edit <CODE>/etc/mgetty+sendfax/login.conf</CODE> and add line:
<P>
<PRE>
call - - /usr/sbin/callback -S 123456
</PRE>
<P>where call is a pseudo-user needed to initiate the connection. The
line in the <CODE>/etc/mgetty+sendfax/login.conf</CODE> puts in motion the program
calling the given number (in this case it's 123456). The same procedures
can be applied to other users. I'll try to explain how it works. When
we call a server. It asks us to give verification. We login as pseudo-user,
in this case it calls. The script in our computer hangs up the modem.
We wait and the connection is cut off. The program call-back starts
working and recalls us. We verify ourselves again as pppuser with
password. We combine the connection and interface ppp. That's all. The
configuration of work-stations is very simple. When you have MS
Windows, you have to install dial-up for your number. In the modem
propriety we find " propriety---&gt;extended---&gt; extra options" where
we write.
<P>
<PRE>
&amp;c0s0=1
</PRE>
<P>We close the window and call. We log in according to the description
given above. If we want to use Linux, we must refer to the script.
It's difficult to give only one good script for our Linux. A good
configuration of ppp in the system is of primary importance. (You
can call it as pppuser through the scripts first).The scripts below
were whiten by A. Gozdz. I suggest putting everything to catalogue.
It is only my suggestion &amp; you don't have to start the scripts here.
Detailed information cocernig writing scripts on Linux can found in
PPP-HOWTO.
<P>
<P>The configuration file of daemon ppp (an example for modem on com2)
<B>THESE SCRIPTS WORK GOOD WITH LINUX RED HAT 6.x</B>
<P>
<UL>
<LI>/etc/ppp/options
<PRE>
lock
defaultroute
noipdefault
modem
115200
crtscts
debug
passive
asyncmap 0
</PRE>
</LI>
<LI>/etc/ppp/pppcallback
<PRE>
TIMEOUT 5
ABORT 'ERROR'
ABORT 'BUSY'
ABORT 'NO ANSWER'
ABORT 'NO DIALTONE'
ABORT '\nVOICE\r'
ABORT '\nRINGING\r\n\r\nRINGING\r'
'' AT&amp;FH0 'OK-+++\c-OK' 'AT&amp;C0S0=1'
TIMEOUT 40
OK ATDT5376443 CONNECT ''
ogin:-ogin: ppp-pseudo-user
'\nNO CARRIER\r' ''
TIMEOUT 180
'\nRING\r' AT&amp;C1A
CONNECT ''
TIMEOUT 20
ogin:-ogin: pppuser
sword:-sword password_for_ppuser
</PRE>
</LI>
<LI>/usr/bin/ppp-call
<PRE>
#!/bin/bash
teksta="Connection failed"
tekstb="Probably, You will be connect"
# /sbin/setserial /dev/ttyS1 spd_vhi
killall -INT pppd 2>/dev/null
rm -f /var/lock/LCK* /var/run/ppp*.pid
(/usr/sbin/pppd -detach call ppp_call &amp;) || \
(echo $teksta; ls marsss >/dev/null; exit 1)
echo $tekstb
exit 0
</PRE>
</LI>
<LI>You can run ppp-call, now. :)
</LI>
</UL>
<P>
<P>If you have M$ Windows you can use this script for conection. I don't
test it (I use terminal) you can ask some more Adrian Debkowski
(
<A HREF="mailto:adrian@cr-media.pl">adrian@cr-media.pl</A>).
<P>
<PRE>
proc main
delay 1
waitfor "ogin:"
transmit "call^M"
waitfor "RING"
transmit "ATA^M"
waitfor "CONNECT"
waitfor "ogin:"
transmit "pppuser^M"
waitfor "word:"
transmit "ppp^M"
endproc
</PRE>
<P>
<H2><A NAME="ss2.5">2.5 PART V Summary</A>
</H2>
<P>The Configuration of call-back is not complicated. The most important
thing is a proper arrangement of ppp server on Linux. I don't know a
better way of setting up an access - server. The configuration
presented above is a result of numerous attempts and it can be done in
a different way. That's way I suggest reading all the documents concerning
the issue man pppd, NET-HOWTO, PPP-HOWTO,ISP-Setup-RedHat-HOWTO,Modem-HOWTO .
A special thanks for Bill Staehle.
<HR>
Next
<A HREF="Call-back-1.html">Previous</A>
<A HREF="Call-back.html#toc2">Contents</A>
</BODY>
</HTML>