[pptp-server] Logging actual remote ip addr
George Vieira
georgev at citadelcomputer.com.au
Mon Dec 18 13:48:29 CST 2000
Yes you can, everybody has to remember that pptp is really a PPP link. So
use the /etc/ppp/ip-up.local and /etc/ppp/ip-down.local to control your
links that come up and down.
Even pass the ipparam paramter into the pppd options so you can detect what
type of connection it is in your scripts... Like mine. Just add a line
somewhere and pass $1 $2 $3 $4 $5 $6 to get all information possible.
----------------------------
#!/bin/sh
LINK=$6
if [ ! $LINK ]; then
LINK="adsl" # Set linkname to ADSL coz theres a weird bug which
ipparam doesn't passed from rp-pppoe
echo "Setting LINK to ADSL" | logger -p local0.notice -t
"IP-UP.LOCAL"
fi
#
# Start fetchmail service for POP3 retrieval
#
/usr/bin/fetchmail -d 300
# These are the parameters passed to script by PPPD
# interface-name tty-device speed local-IP-address remote-IP-address ipparam
echo "Script Started for ($LINK) using $5" | logger -p local0.notice -t
"IP-UP.LOCAL"
case $LINK in
pptp)
echo "($LINK): PPTP connection started." | logger -p
local0.notice -t "IP-UP.LOCAL"
#
# Add route for Citadel private network
#
echo "($LINK): Adding routes for clients." | logger -p
local0.notice -t "IP-UP.LOCAL"
route add -net 192.168.194.0/24 gw $5 # Client1
route add -net 10.10.0.0/24 gw $5 # Client2
route add -net 10.10.10.0/24 gw $5 # Client3
route add -host 203.34.20.3 gw $5 # Client4
;;
adsl)
echo "$(LINK): ADSL connection up. Executing DDNS update to
$4" | logger -p local0.notice -t "IP-UP.LOCAL"
sleep 3
/usr/local/ddclient-2.3.6/ddclient -host
mydomainlocation.dyndns.org -ip $4
OLDPPTP=`tail -1 /var/run/ppp-pptp.pid`
kill `cat /var/run/$OLDPPTP.pid` # To kill old pptp
session if ADSL disconnects and reconnects.
;;
*)
echo "($LINK): Unknown PPP invocation" >>
/var/log/pppdial.log
echo "($LINK): Unknown PPP invocation" | logger -p
local0.notice -t "IP-UP.LOCAL"
STATUS=`/usr/local/ddclient-2.3.6/ddclient -host
newjackswing.dyndns.org -ip $4`
if [ ! $STATUS = 0 ]; then
echo "($LINK): Error updating DDNS" >>
/var/log/pppdial.log
fi
kill `cat /var/run/ppp-pptp.pid`
/bin/pptp-dev
;;
esac
#
# Reload firewall rules
#
[ -x /etc/rc.d/init.d/firewall ] && /etc/rc.d/init.d/firewall reload
-----Original Message-----
From: Giulio Orsero [mailto:giulioo at pobox.com]
Sent: Tuesday, December 19, 2000 5:38 AM
To: pptp-server at lists.schulte.org
Subject: [pptp-server] Logging actual remote ip addr
I'm using pptpd 1.1.2 on linux redhat 61, ppp 2.3.11, kernel 2.2.16.
1) pptpd issue
Is there a way to get the actual ip address of the remote end from pptpd
in order to send an email with it to someone?
Right now, I use pppd ip-up as the email trigger, and look for
REM_IP=`/bin/egrep "CTRL: Client .* control connection started"
/var/log/local2|/usr/bin/tail -1|/usr/bin/awk '{print $8}'`
I'd like a more deterministic way to do it.
2) pppd issue
Is there a way to get the chap login name used by the remote end (to
send an email...)
Thanks
--
giulioo at pobox.com
_______________________________________________
pptp-server maillist - pptp-server at lists.schulte.org
http://lists.schulte.org/mailman/listinfo/pptp-server
List services provided by www.schulteconsulting.com!
More information about the pptp-server
mailing list