From 267317e3b29a9b7652f04771290c44eb37085c43 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 10:13:32 +0000 Subject: [PATCH 1/2] Bump alpine from 3.20 to 3.21 in /test/Renci.SshNet.IntegrationTests Bumps alpine from 3.20 to 3.21. --- updated-dependencies: - dependency-name: alpine dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- test/Renci.SshNet.IntegrationTests/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Renci.SshNet.IntegrationTests/Dockerfile b/test/Renci.SshNet.IntegrationTests/Dockerfile index d2ef74223..6a3346304 100644 --- a/test/Renci.SshNet.IntegrationTests/Dockerfile +++ b/test/Renci.SshNet.IntegrationTests/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.20 +FROM alpine:3.21 COPY --chown=root:root server/ssh /etc/ssh/ COPY --chown=root:root server/script /opt/sshnet From cb4f1b31762e9df4db8f934a6453856a36a7eed0 Mon Sep 17 00:00:00 2001 From: Robert Hague Date: Fri, 3 Jan 2025 11:21:39 +0100 Subject: [PATCH 2/2] merge #1553 --- .../KeyExchangeAlgorithmTests.cs | 1 - .../SshConnectionDisruptor.cs | 25 +++++++++++-------- .../TestsFixtures/InfrastructureFixture.cs | 4 ++- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/test/Renci.SshNet.IntegrationTests/KeyExchangeAlgorithmTests.cs b/test/Renci.SshNet.IntegrationTests/KeyExchangeAlgorithmTests.cs index d88c9cc7d..bce4cc6d7 100644 --- a/test/Renci.SshNet.IntegrationTests/KeyExchangeAlgorithmTests.cs +++ b/test/Renci.SshNet.IntegrationTests/KeyExchangeAlgorithmTests.cs @@ -23,7 +23,6 @@ public void TearDown() } [TestMethod] - [Ignore] public void SNtruP761X25519Sha512() { _remoteSshdConfig.ClearKeyExchangeAlgorithms() diff --git a/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs b/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs index 4116daad7..ae6d4c5b8 100644 --- a/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs +++ b/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs @@ -22,19 +22,24 @@ public SshConnectionRestorer BreakConnections() private static void PauseSshd(SshClient client) { - var command = client.CreateCommand("sudo echo 'DenyUsers sshnet' >> /etc/ssh/sshd_config"); - var output = command.Execute(); - if (command.ExitStatus != 0) + using (var command = client.CreateCommand("sudo echo 'DenyUsers sshnet' >> /etc/ssh/sshd_config")) { - throw new ApplicationException( - $"Blocking user sshnet failed with exit code {command.ExitStatus}.\r\n{output}\r\n{command.Error}"); + var output = command.Execute(); + if (command.ExitStatus != 0) + { + throw new ApplicationException( + $"Blocking user sshnet failed with exit code {command.ExitStatus}.\r\n{output}\r\n{command.Error}"); + } } - command = client.CreateCommand("sudo pkill -9 -U sshnet -f sshd.pam"); - output = command.Execute(); - if (command.ExitStatus != 0) + + using (var command = client.CreateCommand("sudo pkill -9 -U sshnet -f sshd-session.pam")) { - throw new ApplicationException( - $"Killing sshd.pam service failed with exit code {command.ExitStatus}.\r\n{output}\r\n{command.Error}"); + var output = command.Execute(); + if (command.ExitStatus != 0) + { + throw new ApplicationException( + $"Killing sshd-session.pam service failed with exit code {command.ExitStatus}.\r\n{output}\r\n{command.Error}"); + } } } } diff --git a/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs b/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs index 93d44e015..47629b67f 100644 --- a/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs +++ b/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs @@ -75,14 +75,16 @@ public async Task DisposeAsync() { if (_sshServer != null) { +#pragma warning disable S6966 // Awaitable method should be used //try //{ - // File.WriteAllBytes(@"C:\tmp\auth.log", await _sshServer.ReadFileAsync("/var/log/auth.log")); + // File.WriteAllBytes(@"C:\tmp\auth.log", await _sshServer.ReadFileAsync("/var/log/auth.log").ConfigureAwait(false)); //} //catch (Exception ex) //{ // Console.Error.WriteLine(ex.ToString()); //} +#pragma warning restore S6966 // Awaitable method should be used await _sshServer.DisposeAsync(); }