From 1eab64facac53aa1b3ca29584ac8296bcc4eb6fb Mon Sep 17 00:00:00 2001 From: Adi Masputra Date: Mon, 24 Jan 2000 23:05:14 +0000 Subject: [PATCH] Added some sample scripts and options files for connecting PPP over rsh and ssh, along with short descriptions in README --- scripts/README | 56 ++++++++++++++++++++++++++++-- scripts/options-rsh-loc | 1 + scripts/options-rsh-rem | 1 + scripts/options-ssh-loc | 1 + scripts/options-ssh-rem | 1 + scripts/ppp-on-rsh | 72 ++++++++++++++++++++++++++++++++++++++ scripts/ppp-on-ssh | 76 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 scripts/options-rsh-loc create mode 100644 scripts/options-rsh-rem create mode 100644 scripts/options-ssh-loc create mode 100644 scripts/options-ssh-rem create mode 100755 scripts/ppp-on-rsh create mode 100755 scripts/ppp-on-ssh diff --git a/scripts/README b/scripts/README index 088cb09..00e032c 100644 --- a/scripts/README +++ b/scripts/README @@ -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. diff --git a/scripts/options-rsh-loc b/scripts/options-rsh-loc new file mode 100644 index 0000000..a7a95e7 --- /dev/null +++ b/scripts/options-rsh-loc @@ -0,0 +1 @@ +debug asyncmap FFFFFFFF escape FF kdebug 0 noipdefault nodefaultroute noauth diff --git a/scripts/options-rsh-rem b/scripts/options-rsh-rem new file mode 100644 index 0000000..f9b76ef --- /dev/null +++ b/scripts/options-rsh-rem @@ -0,0 +1 @@ +notty debug asyncmap FFFFFFFF escape FF kdebug 0 noipdefault nodefaultroute noauth diff --git a/scripts/options-ssh-loc b/scripts/options-ssh-loc new file mode 100644 index 0000000..a7a95e7 --- /dev/null +++ b/scripts/options-ssh-loc @@ -0,0 +1 @@ +debug asyncmap FFFFFFFF escape FF kdebug 0 noipdefault nodefaultroute noauth diff --git a/scripts/options-ssh-rem b/scripts/options-ssh-rem new file mode 100644 index 0000000..f9b76ef --- /dev/null +++ b/scripts/options-ssh-rem @@ -0,0 +1 @@ +notty debug asyncmap FFFFFFFF escape FF kdebug 0 noipdefault nodefaultroute noauth diff --git a/scripts/ppp-on-rsh b/scripts/ppp-on-rsh new file mode 100755 index 0000000..fbe775f --- /dev/null +++ b/scripts/ppp-on-rsh @@ -0,0 +1,72 @@ +#!/bin/ksh +# +# A sample script to establish PPP session(s) via rsh +# +# Adi Masputra +# 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 + diff --git a/scripts/ppp-on-ssh b/scripts/ppp-on-ssh new file mode 100755 index 0000000..063b823 --- /dev/null +++ b/scripts/ppp-on-ssh @@ -0,0 +1,76 @@ +#!/bin/ksh +# +# A sample script to establish PPP session(s) via SSH 1.x +# +# Adi Masputra +# 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 + -- 2.39.2