pppsvrd / pppsvr / kpppsvr (Second Release)

OVERVIEW (bear with me)
I have the following machine setup at home. A 486SX (8MB ram, 400MB HD , PnP
modem and DE100 netword card) that I use as a firewall with the wwwoffled
proxy server running on it, and a P200MMX (80MB ram, 2.1GB HD, 5--MB HD,
ne2000 network card) which I use as my main applications machine. Each
machine runs S.u.S.E 5.3 (the P200 has Linux 2.0.36 and also has a small
FreeDOS partition, the 486 runs Linux 2.0.35).
Whenever I wanted to dial my ISP (Demon Internet) I had to telnet to my
firewall machine and then issue commands to start pppd.
A first attempt to get round this was to use rsh to remotely start ppp, but
of course is not very secure.
The second attempt to get round this was to use the Connect program from
Nicolas Chauvat, which allowed remote dialup and kept session statistics. I
usually worked, but it did not allow me to remotely issue commands to
wwwoffle.
So, pppsvrd is my own attempt to enable remote ppp / wwwoffle / mail handling.

THE CODE
The file pppsvr.h contains definitions of the server IP address & port
number, as well as program locations for pppd, wwwoffle, wwwoffled and
sendmail. Edit to taste.

The pppsvrd daemon program is run on the machine with the modem attached to
it, and can be run thusly,

# ./pppsvrd

it forks into the background once a socket and port have been setup.
It currently executes pppd directly, but it should be possible for it to
execute a shell script which exec's pppd. I don't need to do this as I have
by pppd connect and disconnect scripts setup in such a way that they do
everything for me (place wwwoffle online/offline, send queued mail, etc...).
What is important is that pppsvrd can detect when it dies (so that if
keepalive is enabled, it can be restarted).

The pppsvr program is run on the remote machines, and is used to issue
commands to pppsvrd. For a list of commands, run the program with no
parameters.

# ./pppsvr

You can override the server IP and port address by specifying :-

# ./pppsvr -p 0 -s "0.0.0.0"

set port and server to taste, but if you compile the programs you can set
these values in the header file anyway.

For those of use who use KDE (like me), the kpppsvr program is a _very_
simple KDE version of pppsvr. It consists of a number of buttons, allowing
you to issue any of the commands that pppsvr can. I have used the QtEZ
program to write this, so it's more of an experiment with QtEZ that a real
KDE application, but it follows the KDE guidelines.

Unlike Connect, pppsvr maintains no real session information (only a
reference count) so it is primarily of use in the sort of setup i've
described above, but it could be used thoughtout a small network
environment.


COMPILING
Edit the pppsvr.h file to taste (set paths, server IP and port number).
to compile the pppsvrd and ppsvr programs

# cc -o pppsvrd pppsvrd.c
# cc -o pppsvr pppsvr.c

to compile the kpppsvr program

# make

or just execute

# ./build


INSTALLING
I have no clever installation scripts :-
1. place pppsvrd on the required machine in whichever directly you desire,
/usr/local/sbin for example.
2. execute it manually [just this once] and have
your system startup execute it for future boots. 
3. place pppsvr into the directory of choice on you other machine(s). 
4. place kpppsvr in $KDEDIR/bin and kpppsvr.kdelnk into $KDEDIR/share/applnk/Internet/
5. place the kpppsvrrc file into ~/.kde/share/config (after editing to set the 
correct port number and host address).


NOTES
I have addressed the issue with the previous release concerning the system()
call by forking a process to explicitly handle proxy & mail commands.
The main process will now always be notified when [if] the pppd program dies.
I have also added a new timer option to kpppsvr. In the rc file if Timer=? is
set to a non-zero number then a timer will be fired every ? seconds to update
the second and third boxes in the message line to reflect the status of the
link [DOWN or UP] and the number of references. One day I may even create a
dialog to set these values.


TODO
For kpppsvr to have a dialog to set config file params, and possibly a timer
stop/start button.


BINARIES
I am using S.u.S.E 5.3 with the new 2.0.36 kernel, so the binaries are
libc5 rather than glibc2. The KDE libraries are 1.0 compiled and linked against QT 1.41.

Links:-

S.u.S.E cal be found at http://www.suse.de/e/
The K Desktop Environment is at http://www.kde.org/
The wwwoffle proxy server (great for dialup users) is at
http://www.gdanken.demon.co.uk/wwwoffle/
The Connect program is at http://www.caesium.fr/freeware/connect/


The pppsvr program may compile and run on windoze (or M$-DOS) but frankly I
don't care if it does or does not.

Mark W J Redding
<mark@grawlfang.demon.co.uk>

