Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Oct 1995 12:21:30 +0930 (CST)
From:      newton@communica.com.au (Mark Newton)
To:        lenzi@cwbone.bsi.com.br (Sergio Lenzi)
Cc:        hackers@FreeBSD.org
Subject:   Re: A few questions..
Message-ID:  <9510280251.AA29408@communica.com.au>
In-Reply-To: <Pine.BSF.3.91.951026132224.194C-101000@cwbone.bsi.com.br> from "Sergio Lenzi" at Oct 26, 95 01:24:02 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Sergio Lenzi wrote:

 >  I use this kind of thing (ppp and slip) here.

I have a solution using user-mode PPP here.  cleese.apana.org.au is a 
public access UNIX which offers dialup PPP to its subscribers.  Some
PPP accounts have their addresses dynamically assigned for each dialup 
session, some of them have static addresses which they always get
(so that, for example, the PPP user can have MX records and the like
pointing directly at him).

 >  I put "options GATEWAY" in the conf file

Blurgh;  "sysctl -w net.inet.ip.forwarding=1" at boot time.

 >  run routed with options -s

Don't need that;  just a static default route to my IP provider.

 >  When a user logs_in it starts an awk program
 >  that given a tty it returns an ip.

Novel.  I have a PPP login shell that I'll include at the end of
this message.  Basically, the hostname of the dialing-in site
is coded into argv[0], unless argv[0] is "ppp-dialup", in which 
case the script works out which tty you're on (ie: behaves as if it
was called as "ppp-ttyd1" if a user logs in on ttyd1).  Each PPP
user has a logni shell of the form "ppp-token", which is a symlink
back to ppp-shell.  ppp-shell is where all the smart stuff is.

The login shell script ends up calling "/usr/sbin/ppp -direct token",
where "token" is the bit after the hyphen in $0, or the tty name
if $0 is ppp-dialup.

My /etc/ppp/ppp.conf file has entries like this:

ttyd4:
 set ifaddr 203.14.159.10 203.14.159.161
 set debug phase
 enable proxy
 set timeout 900

smokey:
 set ifaddr 203.14.159.10 203.14.159.148
 set debug phase
 enable proxy
 set timeout 900

The first one would be used if a PPP user was on ttyd4;  it assigns 
203.14.159.161 as the address for the remote end.  The "enable proxy"
command turns on proxy ARP, so routed is unnecessary.

The second entry is used for when smokey.apana.org.au dials in;
it gives him his own IP address, so he doesn't get it dynamically
assigned to him.

Result:  My ppp.conf has four "tty" entries for dynamic IPs (one
for each dialup modem) and a collection of hostname entries.  I get
to use the same login shell for all of them regardless of whether
they're static or dynamic.

My PPP users have accounts like this:

newton@cleese> finger Psmokey
Login: Psmokey                          Name: smokey.apana.org.au
Directory: /u/noacct                    Shell: /etc/ppp/ppp-smokey
Last login Sat Oct 28 10:07 (CST) on ttyd2
No Mail.
No Plan.

... with /etc/ppp/ppp-smokey being a symlink to /etc/ppp/ppp-shell
(included at the end of this message).  Dynamic PPP accounts are
the same, 'cept they use /etc/ppp/ppp-dialup as a shell (which is,
again, a symlink to /etc/ppp/ppp-shell).

    - mark

---
Mark Newton                               Email: newton@communica.com.au
Systems Engineer                          Phone: +61-8-373-2523
Communica Systems                         WWW:   http://www.communica.com.au






#!/bin/sh -
## 
## Copyright (c) 1995 Mark Newton
## All rights reserved.
## 
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions
## are met:
## 1. Redistributions of source code must retain the above copyright
##    notice, this list of conditions and the following disclaimer.
## 2. Redistributions in binary form must reproduce the above copyright
##    notice, this list of conditions and the following disclaimer in the
##    documentation and/or other materials provided with the distribution.
## 
## THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
## ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
## 
##       @(#)ppp-shell.sh       1.03 951019	newton@cleese.apana.org.au
## 

IDENT=`echo $0 | sed -e 's/^.*-\(.*\)$/\1/'`
CALLEDAS="$IDENT"
TTY=`tty`

if [ x$IDENT = xdialup ]; then
    IDENT=`basename $TTY`
fi

echo "PPP for $CALLEDAS on $TTY"
echo "Starting PPP for $IDENT"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~"

exec /usr/sbin/ppp -direct $IDENT




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9510280251.AA29408>