Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run integration tests on alpine:latest #1553

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/Renci.SshNet.IntegrationTests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.20
FROM alpine:latest

COPY --chown=root:root server/ssh /etc/ssh/
COPY --chown=root:root server/script /opt/sshnet
Expand Down
25 changes: 15 additions & 10 deletions test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sshd.pam -> sshd-session.pam is the fix for OpenSSH 9.8+. However, that release also completely removes DSA at compile time, so now the DSA tests fail.

I think it is time to remove DSA

{
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}");
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Loading