forked from sshnet/SSH.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoteSshdConfigExtensions.cs
More file actions
32 lines (30 loc) · 1.43 KB
/
RemoteSshdConfigExtensions.cs
File metadata and controls
32 lines (30 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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();
}
}
}