Bugzilla – Attachment 783 Details for
Bug 413
Port forwarding: [localhost:]localport:remotehost:remoteport
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
forward-bind.sh: regression test for binding port forwards to addresses
forward-bind.sh (text/plain), 4.94 KB, created by
Darren Tucker
on 2005-01-24 16:48:26 AEDT
(
hide
)
Description:
forward-bind.sh: regression test for binding port forwards to addresses
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2005-01-24 16:48:26 AEDT
Size:
4.94 KB
patch
obsolete
># $OpenBSD$ ># Placed in the Public Domain. > ># ># Current limitations: ># - doesn't test IPv6 ># - backward compat tests require Portable OpenSSH 3.9p1 installed in ># /usr/local/openssh-3.9p1. Build it with ># ./configure --prefix=/usr/local/openssh-3.9p1 --sysconfdir=/etc/ssh > >tid="local and remote forwarding with bind addresses" > >start_sshd > >base=3301 > ># Ugly and not very portable but can't see any other sane way right now >hostname=`hostname` >myip=`host $hostname | awk '/has address/{print $4}'` > >echo "HostKeyAlias localhost-with-alias" >> ${OBJ}/ssh_config >echo "HostKeyAlias localhost-with-alias" >> ${OBJ}/ssh_proxy > >opts="-F ${OBJ}/ssh_config" ># checklistener always uses these options >checkopts="$opts" > >if [ -x /usr/local/openssh-3.9p1/sbin/sshd ]; then > trace enabling 3.9p1 backward compatibility tests > BWCOMPAT_SSHD=/usr/local/openssh-3.9p1/sbin/sshd > # we use the proxy config for running the backward compat tests > ( > cat $OBJ/ssh_config > echo proxycommand ${BWCOMPAT_SSHD} -i -f $OBJ/sshd_proxy > ) > $OBJ/ssh_proxy >else > BWCOMPAT_SSHD=no >fi > >if [ -x /usr/local/openssh-3.9p1/bin/ssh ]; then > BWCOMPAT_SSH=/usr/local/openssh-3.9p1/bin/ssh >else > BWCOMPAT_SSH=no >fi > >insert_delay() >{ > sleep 1 >} > ># check_listen address port expected >checklistener () >{ > trace check $1:$2 for listener $3 > ${SSH} $checkopts -p $2 -o Hostname=$1 $1 true >/dev/null 2>&1 > if [ $? -eq 0 ]; then > if [ "$3" = "no" ]; then > fail WARN: connect $1:$2 worked when expected to fail > return 1 > fi > else > if [ "$3" = "yes" ]; then > trace WARN: connect $1:$2 failed when expected to work > return 1 > fi > fi > >} > ># run_fwd_test arguments ># 1 test number ># 2 local/remote (L/R) ># 3 ssh GatewayPorts (yes/no) ># 4 bind spec or 'none' ># 5 expected result for localhost (yes/no) ># 6 expected result for myip (yes/no) >run_fwd_test () >{ > thistest="test $1: forward=$2, ssh GatewayPorts=$3, bind spec $4" > verbose $thistest > > if [ "$4" = "none" ]; then > fwd="$base:127.0.0.1:$PORT" > else > fwd="$4:$base:127.0.0.1:$PORT" > fi > > ${SSH} $opts -f -$2 $fwd -oGatewayPorts=$3 somehost \ > exec sh -c \'"echo \$\$ > $OBJ/remote_pid; exec sleep 444"\' || \ > fail "failed to start forwarder" > insert_delay > > checklistener 127.0.0.1 $base $5 || fail $thistest > checklistener $myip $base $6 || fail thistest > > if [ -f $OBJ/remote_pid ]; then > remote=`cat $OBJ/remote_pid` > trace "terminate remote shell, pid $remote" > if [ $remote -gt 1 ]; then > kill -HUP $remote > fi > else > fail "no pid file: $OBJ/remote_pid" > fi > > base=`expr $base + 1` > insert_delay >} > ># Test with sshd GatewayPorts=no (the default) ># result result ># testno L/R gwport bind spec loop ipaddr >run_fwd_test 1 L no none yes no >run_fwd_test 2 L yes none yes yes >run_fwd_test 3 R no none yes no >run_fwd_test 4 R yes none yes no >run_fwd_test 5 L no 127.0.0.1 yes no >run_fwd_test 6 L no $myip no yes >run_fwd_test 7 R no $myip yes no > >if [ "${BWCOMPAT_SSH}" != "no" ]; then > verbose ssh 3.9p1 backward compat tests with sshd GatewayPorts=no > OLD_SSH=${SSH} > SSH=${BWCOMPAT_SSH} > # result result > # testno L/R gwport bind spec loop ipaddr > run_fwd_test a1 L no none yes no > run_fwd_test a2 L yes none yes yes > run_fwd_test a3 R no none yes no > run_fwd_test a4 R yes none yes no > > SSH=${OLD_SSH} >fi > >if [ "${BWCOMPAT_SSHD}" != "no" ]; then > verbose sshd 3.9p1 backward compat tests with sshd GatewayPorts=no > oldopts="$opts" > opts="-F ${OBJ}/ssh_proxy" > > # result result > # testno L/R gwport bind spec loop ipaddr > run_fwd_test b1 R no none yes no > run_fwd_test b2 R yes none yes no > run_fwd_test b3 R no $myip yes no > run_fwd_test b4 R yes $myip yes no > > opts="$oldopts" >fi > >trace reconfigure sshd with GatewayPorts=yes >echo GatewayPorts=yes >> ${OBJ}/sshd_config >echo GatewayPorts=yes >> ${OBJ}/sshd_proxy >$SUDO kill -HUP `cat $PIDFILE` >sleep 1 >trace "wait for sshd to restart" >i=0; >while [ ! -f $PIDFILE -a $i -lt 10 ]; do > i=`expr $i + 1` > sleep $i >done >test -f $PIDFILE || fatal "sshd did not restart" > ># Test with sshd GatewayPorts=yes ># result result ># testno L/R gwport bind spec loop ipaddr >run_fwd_test 8 R no none yes no >run_fwd_test 9 R yes none yes no >run_fwd_test 10 R no $myip no yes >run_fwd_test 11 R yes 127.0.0.1 yes no >run_fwd_test 12 R yes localhost yes no > >if [ "${BWCOMPAT_SSH}" != "no" ]; then > verbose ssh 3.9p1 backward compat tests with sshd GatewayPorts=yes > OLD_SSH=${SSH} > SSH=${BWCOMPAT_SSH} > # result result > # testno L/R gwport bind spec loop ipaddr > run_fwd_test a5 L no none yes no > run_fwd_test a6 L yes none yes yes > run_fwd_test a7 R no none yes yes > run_fwd_test a8 R yes none yes yes > > SSH=${OLD_SSH} >fi > >if [ "${BWCOMPAT_SSHD}" != "no" ]; then > verbose sshd 3.9p1 backward compat tests with sshd GatewayPorts=yes > oldopts="$opts" > opts="-F ${OBJ}/ssh_proxy" > > # result result > # testno L/R gwport bind spec loop ipaddr > run_fwd_test b5 R no none yes yes > run_fwd_test b6 R yes none yes yes > run_fwd_test b7 R no $myip yes yes > run_fwd_test b8 R yes $myip yes yes > > opts="$oldopts" >fi
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 413
:
179
|
180
|
182
|
217
|
219
|
229
|
321
|
666
|
782
| 783 |
784
|
791
|
792
|
806
|
834