mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 07:38:49 -05:00
tests/sshserver.pl: use RSA instead of DSA for host auth
DSA is no longer supported by OpenSSH 7.0, which causes all SCP/SFTP test cases to be skipped. Using RSA for host authentication works with both old and new versions of OpenSSH. Reported-by: Karlson2k Closes #676
This commit is contained in:
parent
186546f1c5
commit
effa575fc7
4
tests/.gitignore
vendored
4
tests/.gitignore
vendored
@ -3,8 +3,8 @@ configurehelp.pm
|
||||
curl_client_key
|
||||
curl_client_key.pub
|
||||
curl_client_knownhosts
|
||||
curl_host_dsa_key
|
||||
curl_host_dsa_key.pub
|
||||
curl_host_rsa_key
|
||||
curl_host_rsa_key.pub
|
||||
curl_sftp_cmds
|
||||
curl_sftp_config
|
||||
curl_ssh_config
|
||||
|
@ -120,8 +120,8 @@ $sshlog = undef; # ssh client log file
|
||||
$sftplog = undef; # sftp client log file
|
||||
$sftpcmds = 'curl_sftp_cmds'; # sftp client commands batch file
|
||||
$knownhosts = 'curl_client_knownhosts'; # ssh knownhosts file
|
||||
$hstprvkeyf = 'curl_host_dsa_key'; # host private key file
|
||||
$hstpubkeyf = 'curl_host_dsa_key.pub'; # host public key file
|
||||
$hstprvkeyf = 'curl_host_rsa_key'; # host private key file
|
||||
$hstpubkeyf = 'curl_host_rsa_key.pub'; # host public key file
|
||||
$cliprvkeyf = 'curl_client_key'; # client private key file
|
||||
$clipubkeyf = 'curl_client_key.pub'; # client public key file
|
||||
|
||||
|
@ -371,12 +371,12 @@ if((! -e $hstprvkeyf) || (! -s $hstprvkeyf) ||
|
||||
# Make sure all files are gone so ssh-keygen doesn't complain
|
||||
unlink($hstprvkeyf, $hstpubkeyf, $cliprvkeyf, $clipubkeyf);
|
||||
logmsg 'generating host keys...' if($verbose);
|
||||
if(system "\"$sshkeygen\" -q -t dsa -f $hstprvkeyf -C 'curl test server' -N ''") {
|
||||
if(system "\"$sshkeygen\" -q -t rsa -f $hstprvkeyf -C 'curl test server' -N ''") {
|
||||
logmsg 'Could not generate host key';
|
||||
exit 1;
|
||||
}
|
||||
logmsg 'generating client keys...' if($verbose);
|
||||
if(system "\"$sshkeygen\" -q -t dsa -f $cliprvkeyf -C 'curl test client' -N ''") {
|
||||
if(system "\"$sshkeygen\" -q -t rsa -f $cliprvkeyf -C 'curl test client' -N ''") {
|
||||
logmsg 'Could not generate client key';
|
||||
exit 1;
|
||||
}
|
||||
@ -729,11 +729,11 @@ if(system "\"$sshd\" -t -f $sshdconfig > $sshdlog 2>&1") {
|
||||
if((! -e $knownhosts) || (! -s $knownhosts)) {
|
||||
logmsg 'generating ssh client known hosts file...' if($verbose);
|
||||
unlink($knownhosts);
|
||||
if(open(DSAKEYFILE, "<$hstpubkeyf")) {
|
||||
my @dsahostkey = do { local $/ = ' '; <DSAKEYFILE> };
|
||||
if(close(DSAKEYFILE)) {
|
||||
if(open(RSAKEYFILE, "<$hstpubkeyf")) {
|
||||
my @rsahostkey = do { local $/ = ' '; <RSAKEYFILE> };
|
||||
if(close(RSAKEYFILE)) {
|
||||
if(open(KNOWNHOSTS, ">$knownhosts")) {
|
||||
print KNOWNHOSTS "$listenaddr ssh-dss $dsahostkey[1]\n";
|
||||
print KNOWNHOSTS "$listenaddr ssh-rsa $rsahostkey[1]\n";
|
||||
if(!close(KNOWNHOSTS)) {
|
||||
$error = "Error: cannot close file $knownhosts";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user