wok-6.x rev 15886

dropbear/pppssh: add routes support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 08 16:59:03 2014 +0000 (2014-02-08)
parents 7710488e9e49
children eab35a9f8d16
files dropbear/stuff/sshx ppp/receipt
line diff
     1.1 --- a/dropbear/stuff/sshx	Sat Feb 08 13:29:05 2014 +0000
     1.2 +++ b/dropbear/stuff/sshx	Sat Feb 08 16:59:03 2014 +0000
     1.3 @@ -16,7 +16,7 @@
     1.4  		*)		break ;;
     1.5  		esac
     1.6  	done
     1.7 -	[ -n "$1" ] || set -- "${TERM:-false} || xterm -ls"
     1.8 +	[ -n "$1" ] || set -- "${TERM:-xterm} -ls || ${TERM:-sakura} -l || xterm -ls"
     1.9  	exec dbclient -f -R $((6000+$n)):localhost:$((6000+${svr%.*})) $r \
    1.10  	   "xauth add $dpy $data; export DISPLAY=$scr; $@ ; xauth remove $dpy" \
    1.11  	   </dev/null >/dev/null
    1.12 @@ -26,19 +26,24 @@
    1.13  {
    1.14  	[ -z "$DROPBEAR_PASSWORD" ] && echo -n "ssh password: " &&
    1.15  	read -s -t 30 DROPBEAR_PASSWORD && export DROPBEAR_PASSWORD
    1.16 -	dbclient -y $1 true || exit 1
    1.17 -	ff=/tmp/pppssh$$
    1.18 +	for i in $4 ; do
    1.19 +		echo "route add -net $i dev \$1"
    1.20 +	done > /etc/ppp/ip-up.d/pppssh$$
    1.21 +	chmod +x /etc/ppp/ip-up.d/pppssh$$
    1.22 +	ssh="dbclient -y"
    1.23 +	$ssh $1 true || exit 1
    1.24  	n=10.$(($$%256)).$(($$/256))
    1.25 -	ppp="/usr/sbin/pppd local lock notty"
    1.26 -	mkfifo $ff
    1.27 -	dbclient -y $1 "$ppp ${3:-proxyarp}" <$ff | $ppp ${2:-$n.1:$n.2} >$ff
    1.28 -	rm -f $ff
    1.29 +	ppp="/usr/sbin/pppd local noauth nodetach"
    1.30 +	$ppp ${2:-$n.1:$n.2} passive pty "$ssh $1 $ppp ${3:-proxyarp} notty" \
    1.31 +		ipparam pppssh$$
    1.32 +	rm -f /etc/ppp/ip-up.d/pppssh$$
    1.33  }
    1.34  
    1.35  case "$(basename $0)" in
    1.36 -ppp*)	[ -z "$1" ] &&
    1.37 -	echo "Usage: $0 '[sshargs] user@remote' '[localip:remoteip] [localpppargs]' 'remotepppargs'" ||
    1.38 -	pppssh "$@" ;;
    1.39 +ppp*)	[ -z "$1" ] && cat <<EOT || pppssh "$@" ;;
    1.40 +Usage: $0 '[sshargs] user@remote' '[localip:remoteip] [localpppargs]' 'remotepppargs' 'routes' 
    1.41 +Example: $0 tux@slitaz.org '' '' '192.168.1.0/24 10.1.2.0/24'
    1.42 +EOT
    1.43  *)	[ -z "$DISPLAY" ] && exec dbclient "$@"
    1.44  	xauth list $DISPLAY | xdbclient "$@"
    1.45  esac
     2.1 --- a/ppp/receipt	Sat Feb 08 13:29:05 2014 +0000
     2.2 +++ b/ppp/receipt	Sat Feb 08 16:59:03 2014 +0000
     2.3 @@ -57,6 +57,8 @@
     2.4  	cp -a $src/scripts/callback $fs/etc/ppp/scripts
     2.5  	cp -a $src/scripts/redialer $fs/etc/ppp/scripts
     2.6  	cat >> $fs/etc/ppp/ip-up <<EOT
     2.7 +#!/bin/sh
     2.8 +
     2.9  if [ -x /etc/ppp/ip-up.d/\$6 ]; then
    2.10  	. /etc/ppp/ip-up.d/\$6 "\$@"
    2.11  elif [ -n "\$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
    2.12 @@ -74,6 +76,8 @@
    2.13  fi
    2.14  EOT
    2.15  	cat >> $fs/etc/ppp/ip-down <<EOT
    2.16 +#!/bin/sh
    2.17 +
    2.18  if [ -x /etc/ppp/ip-down.d/\$6 ]; then
    2.19  	. /etc/ppp/ip-down.d/\$6 "\$@"
    2.20  elif [ -n "\$USEPEERDNS" -a -f /etc/ppp/resolv.conf ]; then
    2.21 @@ -97,4 +101,4 @@
    2.22  	chmod go-rwx $fs/etc/ppp/*secrets
    2.23  	chmod go-rwx $fs/etc/ppp/options
    2.24  	chmod 711 $fs/etc/ppp/scripts/*
    2.25 -}
    2.26 \ No newline at end of file
    2.27 +}