aboutsummaryrefslogtreecommitdiff
path: root/tests/sshserver.pl
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2007-09-17 21:39:34 +0000
committerDan Fandrich <dan@coneharvesters.com>2007-09-17 21:39:34 +0000
commit0ed57d370d5fa183f573c54167d57b4cd909eea1 (patch)
treee0df78b9f5ad5d29432b038a7a8b07a1fadc96bc /tests/sshserver.pl
parent551abba2777507ed0dea728c013c05deaefc35cf (diff)
Allow setting the IP address on which to listen for connections.
Diffstat (limited to 'tests/sshserver.pl')
-rw-r--r--tests/sshserver.pl9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/sshserver.pl b/tests/sshserver.pl
index d6802ea38..bdff5a9bb 100644
--- a/tests/sshserver.pl
+++ b/tests/sshserver.pl
@@ -15,6 +15,7 @@ use File::Spec;
my $verbose=0; # set to 1 for debugging
my $port = 8999; # just our default, weird enough
+my $listenaddr = "127.0.0.1"; # address on which to listen
my $path = `pwd`;
chomp $path;
@@ -51,6 +52,10 @@ do {
$username=$ARGV[1];
shift @ARGV;
}
+ elsif($ARGV[0] eq "-l") {
+ $listenaddr=$ARGV[1];
+ shift @ARGV;
+ }
elsif($ARGV[0] =~ /^(\d+)$/) {
$port = $1;
}
@@ -160,7 +165,7 @@ AuthorizedKeysFile $path/curl_client_key.pub
HostKey $path/curl_host_dsa_key
PidFile $path/.ssh.pid
Port $port
-ListenAddress localhost
+ListenAddress $listenaddr
Protocol 2
AllowTcpForwarding yes
GatewayPorts no
@@ -210,7 +215,7 @@ my @dsahostkey = do { local $/ = ' '; <DSAKEYFILE> };
close DSAKEYFILE || die "Could not close DSAKEYFILE";
open(KNOWNHOSTS, ">$knownhostsfile") || die "Could not write $knownhostsfile";
-print KNOWNHOSTS "[127.0.0.1]:$port ssh-dss $dsahostkey[1]\n" || die 'Could not write to KNOWNHOSTS';
+print KNOWNHOSTS "[$listenaddr]:$port ssh-dss $dsahostkey[1]\n" || die 'Could not write to KNOWNHOSTS';
close KNOWNHOSTS || die "Could not close KNOWNHOSTS";
open(SSHFILE, ">$conffile_ssh") || die "Could not write $conffile_ssh";