mirror of
https://github.com/curl/curl.git
synced 2026-08-25 13:53:37 +03:00
runtests: allow configuring SSH host/client key algorithm
via env `CURL_TEST_SSH_KEYALGO`, `rsa` (default), `ecdsa`, `ed25519`. To ease debugging and testing and to make these code paths more universal. Closes #21223
This commit is contained in:
parent
2e5d219205
commit
acda4eae5e
7 changed files with 44 additions and 13 deletions
|
|
@ -1784,6 +1784,17 @@ sub runrtspserver {
|
|||
return (0, $rtsppid, $pid2, $port);
|
||||
}
|
||||
|
||||
#***************************************************************************
|
||||
# Return key algorithm string
|
||||
#
|
||||
sub sshkeyalgostr {
|
||||
my ($algo) = @_;
|
||||
my %algomap = (
|
||||
ecdsa => 'ecdsa-sha2-nistp256',
|
||||
);
|
||||
return exists $algomap{$algo} ? $algomap{$algo} : 'ssh-' . $algo;
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
# Start the ssh (scp/sftp) server
|
||||
#
|
||||
|
|
@ -1831,6 +1842,9 @@ sub runsshserver {
|
|||
$flags .= "--id $idnum " if($idnum > 1);
|
||||
$flags .= "--ipv$ipvnum --addr \"$ip\" ";
|
||||
$flags .= "--user \"$USER\"";
|
||||
if(defined $feature{"sshkeyalgo"}) {
|
||||
$flags .= ' --keyalgo ' . $feature{"sshkeyalgo"};
|
||||
}
|
||||
|
||||
my @tports;
|
||||
my $port = getfreeport($ipvnum);
|
||||
|
|
@ -3199,6 +3213,8 @@ sub subvariables {
|
|||
|
||||
$$thing =~ s/${prefix}SSHSRVMD5/$SSHSRVMD5/g;
|
||||
$$thing =~ s/${prefix}SSHSRVSHA256/$SSHSRVSHA256/g;
|
||||
my $keyalgostr = sshkeyalgostr(defined $feature{"sshkeyalgo"} ? $feature{"sshkeyalgo"} : "");
|
||||
$$thing =~ s/${prefix}SSHKEYALGO/$keyalgostr/g;
|
||||
|
||||
# The purpose of FTPTIME2 is to provide times that can be
|
||||
# used for time-out tests and that would work on most hosts as these
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue