Skip to content

Commit 7dfecc7

Browse files
committed
Trying to repro Rekeying issue sshnet#1764
1 parent 0ff2c50 commit 7dfecc7

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

test/Renci.SshNet.IntegrationTests/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN apk update && apk upgrade --no-cache && \
1818
# Set the default RSA key
1919
echo 'HostKey /etc/ssh/ssh_host_rsa_key' >> /etc/ssh/sshd_config && \
2020
echo 'TrustedUserCAKeys /etc/ssh/user-ca.pub' >> /etc/ssh/sshd_config && \
21+
echo 'RekeyLimit 1M 0' >> /etc/ssh/sshd_config && \
2122
chmod 646 /etc/ssh/sshd_config && \
2223
# install and configure sudo
2324
apk add --no-cache sudo && \

test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.Upload.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,5 +482,25 @@ public async Task Test_Sftp_UploadFileAsync_UploadProgress()
482482
Assert.IsTrue(callbackCalled);
483483
}
484484
}
485+
486+
#if NET
487+
[TestMethod]
488+
public async Task Test_SftpUpload_WithLowRekeyLimit()
489+
{
490+
using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
491+
{
492+
await sftp.ConnectAsync(CancellationToken.None);
493+
494+
await Parallel.ForEachAsync(Enumerable.Range(0, 10), async (i, ct) =>
495+
{
496+
var filename = Path.GetTempFileName();
497+
int testFileSizeMB = 100;
498+
CreateTestFile(filename, testFileSizeMB);
499+
using var fileStream = File.OpenRead(filename);
500+
await sftp.UploadFileAsync(fileStream, "test" + i, ct);
501+
});
502+
}
503+
}
504+
#endif
485505
}
486506
}

test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ private static void ProcessGlobalOption(SshdConfig sshdConfig, string line)
426426
case "PasswordAuthentication":
427427
case "GatewayPorts":
428428
case "Include":
429+
case "RekeyLimit":
429430
break;
430431
default:
431432
throw new NotSupportedException($"Global option '{name}' is not supported.");

0 commit comments

Comments
 (0)