[H-GEN] Linux Dialup Configuration

Ben Carlyle carlyle at tabq.com.au
Wed Feb 10 18:07:59 EST 1999


* fuzzy enters the conversation late, as per usual.

> On Thu, 11 Feb 1999, Doug Young wrote:
> > Is it possible to just use a terminal window to login and if so
> > how to make it popup after dialling ??
> I may have missed this, but why do you want this? I ask because if you
> just want to see what the modem bank is spitting back at you, 
> then this
> could be done without a "terminal window".

> The other thing to look at would be "expect". I seem to 
> recall that it was
> possible to get expect to return control to the user after 
> some event. So
> you could write an expect script to do all the dialing stuff, and then
> have it give you back control of the terminal once a connection is
> established.

Ahh, expect.  A lovely beast.  Expect is extremely powerful,
and is wasted most dialup situations.  Chat is usually
sufficient.
Chat is based on a challenge/response system, so if you know
precisely what you'll recieve and you know precisely what
you'll send, then it's easy to configure.
Redhat includes a helper program for writing chat scripts in
the main control panel.

An example of chat follows:

<login protocol>

CONNECT 1200

Unauthorised access to this system is an evil, evil thing
that will cause you to burn in hell for all eternity.
Not only will god strike you down, but our personal muscle-
men will be on call day and night to ruin your pitiful
life and woeful remaining years.

Please log in.

username: fuzzy
password: _

You are now authenticated.  Don't break anything.

bambi% ppp
~~~weirdpppcharacters

</login protocol>

<chatscript>
"name:"		fuzzy
"word:"		\qthisismypassword\q
"ambi%"		ppp
</chatscript>


This is a pretty standard example.  The chatscript scans the input until
it gets "name:", then replies with "fuzzy".  It scans further until it
gets "word:" then replies with my real password (the \qs make sure the
actual password isn't written into any log files).  It scans again to
find "ambi%", replies with ppp, then exits to let ppp take over.


If you'd rather use the full peer-to-peer authentication of ppp, and
the machine can automatically start ppp before you log in (using a
program such as mgetty), then your chatscript could be as simple as:
"~"		""
(ie, wait for PPP garbage to start, then hand over to ppp).
This usually takes a little bit of fiddling to ensure that your password
is stored in the correct file (/etc/ppp/papsecrets, usually), and that
your computer will send the right username to authenticate with (it defaults
to your actual computer's name... you must override this default with your
true username in a file like /etc/ppp/options/provider.  Just do a man
pppd.)

In both examples there is a little more standard connection stuff
above what I've written in the chatscripts, and that will be in
the exmples already on your machine.


If you don't know exactly what the server will tell you to try
and authenticate you, then expect would give you a more flexible
login, eg:

expect
{
    "username:"		send "fuzzy"
    "login:"			send "fuzzy"
}
expect "password:"      send "thisismypassword"

(the syntax of this example is probably dodgy, but this is basically
 how it goes :)

Both chat and expect can be started by ppp, and have control returned
to ppp at the end of execution.  I don't have the exact command on me,
but there will already be an example in your system's scripts.



Finally...
if you -really- want to have a terminal window...
there are probably a thousand ways to do it.
I used to use dip to connect, which provides a more
powerful scripting language than expect, then spawns
ppp before exiting.  You can use dip in terminal mode
if you like.

If you want it to dial automatically, but let you
then create a terminal window to type in, you'll have
to run something other than the default "chat" script.
I suggest (as someone before me has) that you use a
standard termy program such as minicom to connect and
start ppp, then exit without hanging up to start ppp
without a chatscript.


Anyway.
I'd best get back to work.




More information about the General mailing list