Bugzilla – Attachment 782 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), 2.46 KB, created by
Darren Tucker
on 2005-01-24 14:27:33 AEDT
(
hide
)
Description:
forward-bind.sh: regression test for binding port forwards to addresses
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2005-01-24 14:27:33 AEDT
Size:
2.46 KB
patch
obsolete
># $OpenBSD$ ># Placed in the Public Domain. > ># ># Current limitations: ># - doesn't test IPv6 ># - doesn't test backwards compat w/ <=3.9 > >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}'` > >opts="-F ${OBJ}/ssh_config -o HostKeyAlias=localhost-with-alias" > >insert_delay() >{ > sleep 1 >} > ># check_listen address port expected >checklistener () >{ > trace check $1:$2 for listener $3 > ${SSH} $opts -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 -MS ${OBJ}/ctl -f -$2 $fwd -oGatewayPorts=$3 somehost \ > sleep 100 || fail "failed to start forwarder" > insert_delay > checklistener 127.0.0.1 $base $5 || fail $thistest > checklistener $myip $base $6 || fail thistest > ${SSH} $opts -S ${OBJ}/ctl -O exit somehost >/dev/null 2>&1 > 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 > >trace reconfigure sshd with GatewayPorts=yes >echo GatewayPorts=yes >> ${OBJ}/sshd_config >$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 11 R yes localhost yes no
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