Skip to content

Commit

Permalink
chore: use new sshd:1.2.0 image (#1160)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya authored Apr 24, 2024
1 parent 136ca49 commit fce5672
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/Testcontainers/Containers/PortForwarding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,10 @@ public Task ExposeHostPortsAsync(IEnumerable<ushort> ports, CancellationToken ct
[PublicAPI]
private sealed class PortForwardingBuilder : ContainerBuilder<PortForwardingBuilder, PortForwardingContainer, PortForwardingConfiguration>
{
public const string SshdImage = "testcontainers/sshd:1.1.0";
public const string SshdImage = "testcontainers/sshd:1.2.0";

public const ushort SshdPort = 22;

private const string Command = "echo \"$USERNAME:$PASSWORD\" | chpasswd && /usr/sbin/sshd -D"
+ " -o AddressFamily=inet"
+ " -o AllowAgentForwarding=yes"
+ " -o AllowTcpForwarding=yes"
+ " -o GatewayPorts=yes"
+ " -o HostkeyAlgorithms=+ssh-rsa"
+ " -o KexAlgorithms=+diffie-hellman-group1-sha1"
+ " -o PermitRootLogin=yes";

/// <summary>
/// Initializes a new instance of the <see cref="PortForwardingConfiguration" /> class.
/// </summary>
Expand Down Expand Up @@ -114,8 +105,6 @@ protected override PortForwardingBuilder Init()
return base.Init()
.WithImage(SshdImage)
.WithPortBinding(SshdPort, true)
.WithEntrypoint("/bin/sh", "-c")
.WithCommand(Command)
.WithUsername("root")
.WithPassword("root")
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(SshdPort));
Expand Down

0 comments on commit fce5672

Please sign in to comment.