Files
mus65 ebdcb3ea7d CI: add Windows Integration Tests for .NET (#1704)
* CI: add Windows Integration Tests for .NET

see https://github.com/sshnet/SSH.NET/pull/1702#issuecomment-3342506642

* fix podman setup with Windows and .NET

* debug

* x

* x

* x

* revert

* Run Windows .NET tests in separate job

so they run in parallel and we avoid the Common_CreateMoreChannelsThanMaxSessions test failure.

* fix coverlet artifacts

* fix missing PermitTTY in RemoteSshdConfig Reset

this fixes a test failure in Common_CreateMoreChannelsThanMaxSessions
when running the tests multiple times against the same SSH server
instance.

see https://github.com/sshnet/SSH.NET/pull/1704#issuecomment-3343210311

* speed up Windows tests

turns out this is caused by DNS resolution taking about
2 seconds on every new connection...

* add windows integration tests to Publish needs:

---------

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
2025-10-04 10:00:09 +01:00

33 lines
1.4 KiB
C#

using Renci.SshNet.TestTools.OpenSSH;
namespace Renci.SshNet.IntegrationTests.Common
{
internal static class RemoteSshdConfigExtensions
{
private const string DefaultAuthenticationMethods = "password publickey";
public static void Reset(this RemoteSshdConfig remoteSshdConfig)
{
remoteSshdConfig.WithAuthenticationMethods(Users.Regular.UserName, DefaultAuthenticationMethods)
.WithChallengeResponseAuthentication(false)
.WithKeyboardInteractiveAuthentication(false)
.PrintMotd()
.WithLogLevel(LogLevel.Debug3)
.ClearHostKeyFiles()
.AddHostKeyFile(HostKeyFile.Rsa.FilePath)
.WithHostKeyCertificate(null)
.ClearSubsystems()
.AddSubsystem(new Subsystem("sftp", "/usr/lib/ssh/sftp-server"))
.ClearCiphers()
.ClearKeyExchangeAlgorithms()
.ClearHostKeyAlgorithms()
.ClearPublicKeyAcceptedAlgorithms()
.ClearMessageAuthenticationCodeAlgorithms()
.PermitTTY(true)
.WithUsePAM(true)
.Update()
.Restart();
}
}
}