Added some sample scripts and options files for connecting PPP

over rsh and ssh, along with short descriptions in README
This commit is contained in:
Adi Masputra 2000-01-24 23:05:14 +00:00
parent 153580fa56
commit 1eab64faca
7 changed files with 206 additions and 2 deletions

View File

@ -1,6 +1,7 @@
This directory contains a set of scripts which have been used on Linux
systems to initiate or maintain a connection with PPP. The files in
this directory were contributed by Al Longyear (longyear@netcom.com).
as well as Solaris 2.x systems to initiate or maintain a connection
with PPP. The files in this directory were contributed by Al Longyear
(longyear@netcom.com) and Adi Masputra (adi.masputra@sun.com)
------------------------------------------------------------------------
@ -89,3 +90,54 @@ value before it starts the dial sequence. What was needed was a script which
asked the user at the user's console at the time that it is needed.
This led to the use of expect.
------------------------------------------------------------------------
8. ppp-on-rsh
This script will initiate a PPP connection to a remote machine using rsh.
This is implemented by creating a master/slave pseudo-tty with the slave
pointing to rsh, specifically with the 'pty' and 'notty' options of pppd.
It is assumed that the remote machine contains some sort of trust
mechanisms (such as ~/.rhosts, et al) to allow the local machine to
connect via rsh as root.
------------------------------------------------------------------------
9. ppp-on-ssh
This script will initiate a PPP connection to a remote machine using the
secure shell, or ssh. I've only tested this on ssh 1.x, so those of you
who are running ssh 2.x mahy need to modify the ssh options slightly.
This is implemented by creating a master/slave pseudo-ttyt with the slave
pointing to ssh, specifically with the 'pty' and 'notty' options of pppd.
It is assumed that the remote machine can accept the ssh connection from
the local host, in the sense that all ssh authentication mechanisms have
been properly configured, so that a remote root user can open a ssh
connection.
------------------------------------------------------------------------
10. options-rsh-loc & options-rsh-rem
These options files accompany the ppp-on-rsh script mentioned above. In
theory, you'd want to copy the options-rsh-rem to the remote machine where
in.rshd is running. The only extra option required on the remote machine
options file is the 'notty' option. In addition, all ASCII control characters
[0x00 to 0x1f], plus 0xff, are escaped. This may need to be modified
depending on the rsh (or pseudo-tty) implementation which may differ across
platforms, for further optimizations.
------------------------------------------------------------------------
11. options-ssh-loc & options-ssh-rem
These options files accompany the ppp-on-ssh script mentioned above. I've
only tested this on ssh 1.x, so those of you who are running ssh 2.x need
to modify the ssh options slightly. In theory, you'd want to copy the
options-ssh-rem to the remote machine where sshd daemon is running. The only
extra options required on the remote machine options file is the 'notty'
option. In addition, all ASCII control characters [0x00 to 0x1f], plus 0xff,
are escaped. This may need to be modified depending on the ssh (or
pseudo-tty) implementation which may differ across platforms, for further
optimizations.

1
scripts/options-rsh-loc Normal file
View File

@ -0,0 +1 @@
debug asyncmap FFFFFFFF escape FF kdebug 0 noipdefault nodefaultroute noauth

1
scripts/options-rsh-rem Normal file
View File

@ -0,0 +1 @@
notty debug asyncmap FFFFFFFF escape FF kdebug 0 noipdefault nodefaultroute noauth

1
scripts/options-ssh-loc Normal file
View File

@ -0,0 +1 @@
debug asyncmap FFFFFFFF escape FF kdebug 0 noipdefault nodefaultroute noauth

1
scripts/options-ssh-rem Normal file
View File

@ -0,0 +1 @@
notty debug asyncmap FFFFFFFF escape FF kdebug 0 noipdefault nodefaultroute noauth

72
scripts/ppp-on-rsh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/ksh
#
# A sample script to establish PPP session(s) via rsh
#
# Adi Masputra <adi.masputra@sun.com>
# Jan 24, 2000
#
#
# You'd definitely want to change the following addresses to suit
# your network configuration
#
LOC_IP=10.0.0.1
REM_IP=10.0.0.2
NETMASK=255.255.0.0
export LOC_IP REM_IP
#
# This is the remote peer where in.rshd is running, either
# its hostname or IP address
#
PPPD_RHOST=myremotehost
#
# For this example, we assume that pppd on both local and remote
# machines reside in the same place, /usr/local/bin/pppd
#
PPPD_LOC=/usr/local/bin/pppd
#
# The location of local options file (where rsh client is running).
# Note that the sample options file included in the distribution
# may need further customizations, depending on your needs. The 'noauth'
# option specified in the file is there to simplify the example. In
# reality, you'd probably want to remove such option.
#
PPPD_LOC_OPT=/etc/ppp/options-rsh-loc
#
# The location of remote options file (where in.rshd daemon is running).
# Note that the sample options file included in the distribution
# may need further customizations, depending on your needs. The 'noauth'
# option specified in the file is there to simplify the example. In
# reality, you'd probably want to remove such option. Also note that
# the remote options file need to include the 'notty' option for this
# to work
#
PPPD_REM_OPT=/etc/ppp/options-rsh-rem
#
# The location of rsh client on the local machine
#
RSH_LOC=/bin/rsh
export PPPD_LOC PPPD_LOC_OPT PPPD_REM_OPT PPPD_RHOST RSH_LOC
#
# Uncomment the following to enable IPv6, note that the IPv6 support
# needs to be enabled during compilation
#
# PPPD_IPV6='+ipv6 ipv6cp-use-ipaddr'
export PPPD_IPV6
#
# And execute pppd with the pty option, specifying rsh client as the
# slave side of the pseduo-tty master/slave pair.
#
exec $PPPD_LOC \
pty '$RSH_LOC $PPPD_RHOST $PPPD_LOC $REM_IP:$LOC_IP $PPPD_IPV6 file $PPPD_REM_OPT' \
$LOC_IP:$REM_IP netmask $NETMASK $PPPD_IPV6 file $PPPD_LOC_OPT

76
scripts/ppp-on-ssh Executable file
View File

@ -0,0 +1,76 @@
#!/bin/ksh
#
# A sample script to establish PPP session(s) via SSH 1.x
#
# Adi Masputra <adi.masputra@sun.com>
# Jan 24, 2000
#
#
# You'd definitely want to change the following addresses to suit
# your network configuration
#
LOC_IP=10.0.0.1
REM_IP=10.0.0.2
NETMASK=255.255.0.0
export LOC_IP REM_IP
#
# This is the remote peer where sshd is running, either
# its hostname or IP address
#
PPPD_RHOST=myremotehost
#
# For this example, we assume that pppd on both local and remote
# machines reside in the same place, /usr/local/bin/pppd
#
PPPD_LOC=/usr/local/bin/pppd
#
# The location of local options file (where ssh client is running).
# Note that the sample options file included in the distribution
# may need further customizations, depending on your needs. The 'noauth'
# option specified in the file is there to simplify the example, although
# some may choose to have it there and rely on ssh authentication
# instead.
#
PPPD_LOC_OPT=/etc/ppp/options-ssh-loc
#
# The location of remote options file (where sshd daemon is running)
# Note that the sample options file included in the distribution
# may need further customizations, depending on your needs. The 'noauth'
# option specified in the file is there to simplify the example, although
# some may choose to have it there and rely on ssh authentication
# instead. Also note that the remote options file need to include the 'notty'
# options for this to work.
#
PPPD_REM_OPT=/etc/ppp/options-ssh-rem
#
# The location of ssh client on the local machine
#
SSH_LOC=/usr/local/bin/ssh
export PPPD_LOC PPPD_LOC_OPT PPPD_REM_OPT PPPD_RHOST SSH_LOC
#
# Uncomment the following to enable IPv6, note that the IPv6 support
# needs to be enabled during compilation
#
# PPPD_IPV6='+ipv6 ipv6cp-use-ipaddr'
export PPPD_IPV6
#
# And execute pppd with the pty option, specifying ssh client as the
# slave side of the pseudo-tty master/slave pair. Note that on this example,
# ssh has been compiled to allow NULL encryption (thus the '-c none' option),
# but in reality, you'd probably want to specify the encryption algorithm.
# See the man page of ssh(1) for details.
#
exec $PPPD_LOC \
pty '$SSH_LOC -c none $PPPD_RHOST $PPPD_LOC $REM_IP:$LOC_IP $PPPD_IPV6 file $PPPD_REM_OPT' \
$LOC_IP:$REM_IP netmask $NETMASK $PPPD_IPV6 file $PPPD_LOC_OPT