diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-06-05 13:50:59 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-06-05 13:50:59 +0000 |
commit | a466b315742e958a06aee6a2e92f0de5bd22c635 (patch) | |
tree | c694d9adddf19dcafcd67651673426a3bece0476 /tests/sshserver.pl | |
parent | 48064f8deefd5424591a1caeb4ddf6ae9754679a (diff) | |
download | curl-a466b315742e958a06aee6a2e92f0de5bd22c635.tar.gz |
Daniel Black's test suite fixes and initial test cases for SOCKS4/5 using
openssh
Diffstat (limited to 'tests/sshserver.pl')
-rw-r--r-- | tests/sshserver.pl | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/tests/sshserver.pl b/tests/sshserver.pl index 178ea91e7..e24352023 100644 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -23,7 +23,7 @@ if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' || $^O eq 'dos' || $^O } # Where to look for sftp-server -my @sftppath=qw(/usr/lib/openssh /usr/libexec/openssh /usr/libexec /usr/local/libexec /opt/local/libexec /usr/lib/ssh /usr/libexec/ssh /usr/sbin /usr/lib /usr/lib/ssh/openssh /usr/lib64/ssh); +my @sftppath=qw(/usr/lib/openssh /usr/libexec/openssh /usr/libexec /usr/local/libexec /opt/local/libexec /usr/lib/ssh /usr/libexec/ssh /usr/sbin /usr/lib /usr/lib/ssh/openssh /usr/lib64/ssh /usr/lib64/misc); my $username = $ENV{USER}; @@ -55,6 +55,8 @@ do { } while(shift @ARGV); my $conffile="curl_sshd_config"; # sshd configuration data +my $conffile_ssh="curl_ssh_config"; # ssh configuration data +my $knownhostsfile="curl_client_knownhosts"; # ssh knownhosts file # Searching for sshd and sftp-server will be done first # in the PATH and afterwards in other common locations. @@ -146,9 +148,21 @@ if (! -e "curl_client_key.pub") { system "ssh-keygen -q -t dsa -f curl_host_dsa_key -C 'curl test server' -N ''" and die "Could not generate key"; system "ssh-keygen -q -t dsa -f curl_client_key -C 'curl test client' -N ''" and die "Could not generate key"; } - -open(my $FILE, ">>$conffile") || die "Could not write $conffile"; -print $FILE <<EOF +# setup knownhosts +open(my $DSAKEYFILE, "<", "curl_host_dsa_key.pub") || die 'Could not read curl_host_dsa_key.pub'; +my @dsahostkey = do { local $/ = ' '; <$DSAKEYFILE> }; +close $DSAKEYFILE || die "Could not close RSAKEYFILE"; +open(my $RSAKEYFILE, "<", "curl_host_dsa_key.pub") || die 'Could not read curl_host_dsa_key.pub'; +my @rsahostkey = do { local $/ = ' '; <$RSAKEYFILE> }; +close $RSAKEYFILE || die "Could not close RSAKEYFILE"; +open(my $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} "[127.0.0.1]:$port ssh-rsa $rsahostkey[1]\n" || die 'Could not write to KNOWNHOSTS'; +close $KNOWNHOSTS || die "Could not close KNOWNHOSTS"; + + +open(my $FILE, ">>", $conffile) || die "Could not write $conffile"; +print $FILE <<EOFSSHD AllowUsers $username DenyUsers DenyGroups @@ -158,7 +172,7 @@ PidFile $path/.ssh.pid Port $port ListenAddress localhost Protocol 2 -AllowTcpForwarding no +AllowTcpForwarding yes GatewayPorts no HostbasedAuthentication no IgnoreRhosts yes @@ -173,12 +187,22 @@ PrintMotd no StrictModes no Subsystem sftp $sftp UseLogin no +PrintLastLog no X11Forwarding no UsePrivilegeSeparation no # Newer OpenSSH options -EOF +EOFSSHD ; -close $FILE; +close $FILE || die "Could not close $conffile"; + +open(my $SSHFILE, ">>", $conffile_ssh) || die "Could not write $conffile_ssh"; +print $SSHFILE <<EOFSSH +UserKnownHostsFile $path/$knownhostsfile +IdentityFile $path/curl_client_key +EOFSSH +; +close $SSHFILE || die "Could not close $conffile_ssh"; + sub set_sshd_option { my ($string) = @_; |