From owner-freebsd-isp Thu May 16 20:43:11 1996 Return-Path: owner-isp Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id UAA06124 for isp-outgoing; Thu, 16 May 1996 20:43:11 -0700 (PDT) Received: from lynx.its.unimelb.edu.au (lynx.its.unimelb.EDU.AU [128.250.20.151]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id UAA06113 for ; Thu, 16 May 1996 20:42:57 -0700 (PDT) Received: (from danny@localhost) by lynx.its.unimelb.edu.au (8.6.11/8.6.9) id NAA07342; Fri, 17 May 1996 13:40:54 +1000 Date: Fri, 17 May 1996 13:40:53 +1000 (EST) From: "Daniel O'Callaghan" To: Nate Williams cc: Steve Reid , isp@freebsd.org Subject: Re: Logging pppd connect & disconnect In-Reply-To: <199605160420.WAA21638@rocky.sri.MT.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-isp@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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