[lug] ppp over ssh won't return

Hugh Brown hugh at math.byu.edu
Thu Sep 7 18:23:31 MDT 2000


Nothing like a cryptic subject.

I have a script that I got from the O'Reilly VPN book that I am trying to
use to set up a vpn over ssh.  Last time I was writing wondering why the
route wouldn't work the way it was supposed to.  I found out why today.
The line that invokes pppd over the ssh tunnel never returns so that the
two lines following it (which set up the routes on the master and slave)
can do their thing.  Can anyone tell me why it isn't returning?

Included below is the script

Hugh




#! /bin/sh
# skeleton      example file to build /etc/init.d/ scripts.
#               This file should be used to construct scripts for /etc/init.d.
#
#               Written by Miquel van Smoorenburg <miquels at cistron.nl>.
#               Modified for Debian GNU/Linux
#               by Ian Murdock <imurdock at gnu.ai.mit.edu>.
#
# Version:      @(#)skeleton  1.6  11-Nov-1996  miquels at cistron.nl
#

PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11/:
PPPAPP=/usr/sbin/pppd
ROUTEAPP=/home/vpn1/route
PPPD=/usr/sbin/pppd
NAME=VPN
REDIR=/usr/local/bin/pty-redir
SSH=/usr/local/bin/ssh
MYPPPIP=192.168.1.1
TARGETIP=192.168.1.2
TARGETNET=192.168.4.0
MYNET=192.168.3.0
SLAVEWALL=slave-gw.ora-vpn.com
SLAVEACC=vpn1

test -f $PPPD || exit 0

set -e

case "$1" in
  start)
        echo setting up vpn
        $REDIR $SSH -o 'Batchmode yes' -t -l $SLAVEACC $SLAVEWALL sudo $PPPAPP 2>/tmp/device
        TTYNAME=`cat /tmp/device`
echo tty is $TTYNAME
        sleep 10s
        if [ ! -z $TTYNAME ]
        then


############  This next line is the offending line ################################################
        $PPPD $TTYNAME ${MYPPPIP}:${TARGETIP}
###################################################################################################


        else
                echo FAILED!
                logger "vpn setup failed"
        fi
        sleep 5s
	route add -net $TARGETNET gw $TARGETIP
	$SSH -o 'Batchmode yes' -l $SLAVEACC $SLAVEWALL sudo $ROUTEAPP
    ;;
  stop)
        ps -ax | grep "ssh -t -l $SLAVEACC " | grep -v grep | awk '{print $1}' | xargs kill
    ;;
  *)
    # echo "Usage: /etc/init.d/$NAME {start|stop|reload}"
    echo "Usage: /etc/init.d/$NAME {start|stop}"
    exit 1
    ;;
esac

exit 0
 




More information about the LUG mailing list