Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 May 1996 13:40:53 +1000 (EST)
From:      "Daniel O'Callaghan" <danny@lynx.its.unimelb.edu.au>
To:        Nate Williams <nate@sri.MT.net>
Cc:        Steve Reid <root@edmweb.com>, isp@freebsd.org
Subject:   Re: Logging pppd connect & disconnect
Message-ID:  <Pine.BSI.3.91.960517133352.7039D-100000@lynx.its.unimelb.edu.au>
In-Reply-To: <199605160420.WAA21638@rocky.sri.MT.net>

next in thread | previous in thread | raw e-mail | index | archive | help


On Wed, 15 May 1996, Nate Williams wrote:

> > Is there any way to log when users connect and disconnect with pppd?
> 
> Sure, it's a piece of cake.  How do your users startup PPP?  On my box
> they run a little shell script which is customized for each system, so
> it would be trivial to have it append start/stop entries to a file.

What about a generic solution?  The problem with the Nate's suggestion is 
that one ends up with a sh process for every pppd, while someone is 
logged in.  I exec pppd, on my own ISP TS, but that prevents the logout 
message from being run.  The mods below read the ip address data from
/etc/sliphome/slip.hosts, so the same data file can be used for sliplogin.

 Ptrout:*:812:800:PPP Login for trout:/etc/ppp:/etc/pppsh
 
 And /etc/pppsh
 #!/bin/sh
 #
 # Specific login file for machines who want their stuff hard-coded
 #
 MATCHLINE=`cat /etc/sliphome/slip.hosts | grep '^'$USER'[[:space:]]'`
 localaddr=`echo $MATCHLINE | awk '{print $2 }'`
 remoteaddr=`echo $MATCHLINE | awk '{print $3 }'`
 netmask=`echo $MATCHLINE | awk '{print $4 }'`
 slipmode=`echo $MATCHLINE | awk '{print $5}' `

 PATH=:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
 export PATH
 
 ACCOUNT_FILE=/var/log/ppp.log
 mesg n
 stty -tostop
 echo "Start" $USER `date` >> $ACCOUNT_FILE
 /usr/sbin/pppd crtscts  modem $localaddr:$remoteaddr debug
 echo "Stop" `date` >> $ACCOUNT_FILE



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.91.960517133352.7039D-100000>