Search Results for

    Class AMNetSshServer

    Main .NET-facing SSH server wrapper used to host SFTP and SCP services.

    Inheritance
    object
    AMNetSshServer
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: ApacheMinaSSHD.NET.Wrapper
    Assembly: ApacheMinaSSHD.NET.Wrapper.dll
    Syntax
    public sealed class AMNetSshServer : IDisposable
    Remarks

    This type hides the underlying Apache MINA SSHD server from application code. Configure authentication, host keys, filesystem policy, and enabled subsystems before calling Start().

    Properties

    | Edit this page View Source

    Config

    Gets server configuration helpers for resource limits, timeouts, and cryptographic algorithms.

    Declaration
    public AMNetSshServerConfig Config { get; }
    Property Value
    Type Description
    AMNetSshServerConfig
    | Edit this page View Source

    Host

    Gets or sets the bind address. Use null to use the server default. Accepts IPv4, IPv6, or valid hostname. Rejects empty/whitespace-only values.

    Declaration
    public string? Host { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Port

    Gets or sets the TCP port the SSH server listens on.

    Declaration
    public int Port { get; set; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Dispose()

    Stops the server if it was started.

    Declaration
    public void Dispose()
    | Edit this page View Source

    GetConfiguredAuthenticationMethods()

    Gets the configured authentication method chains in evaluation order.

    Declaration
    public IReadOnlyList<IReadOnlyList<string>> GetConfiguredAuthenticationMethods()
    Returns
    Type Description
    IReadOnlyList<IReadOnlyList<string>>
    | Edit this page View Source

    IsClosed()

    Returns whether the server has been closed.

    Declaration
    public bool IsClosed()
    Returns
    Type Description
    bool
    | Edit this page View Source

    IsStarted()

    Returns whether the server has been started.

    Declaration
    public bool IsStarted()
    Returns
    Type Description
    bool
    | Edit this page View Source

    SetAuthenticationMethodGroups(params IEnumerable<string>[])

    Sets the authentication method policy using one or more required method groups.

    Declaration
    public void SetAuthenticationMethodGroups(params IEnumerable<string>[] authenticationMethodGroups)
    Parameters
    Type Name Description
    IEnumerable<string>[] authenticationMethodGroups

    Each group contains methods that must all succeed in order. The outer set represents alternative groups.

    | Edit this page View Source

    SetAuthenticationMethods(params string[])

    Sets the authentication method policy using one or more pre-built method chains.

    Declaration
    public void SetAuthenticationMethods(params string[] authenticationChains)
    Parameters
    Type Name Description
    string[] authenticationChains

    Authentication chains such as PublicKey or values returned by RequireAll(params string[]).

    | Edit this page View Source

    SetAuthorizedKeysAuthenticator(IAMNetAuthorizedKeysAuthenticator)

    Enables public key authentication backed by an authorized_keys file.

    Declaration
    public void SetAuthorizedKeysAuthenticator(IAMNetAuthorizedKeysAuthenticator authorizedKeysAuthenticator)
    Parameters
    Type Name Description
    IAMNetAuthorizedKeysAuthenticator authorizedKeysAuthenticator

    The authorized keys configuration.

    | Edit this page View Source

    SetAuthorizedKeysAuthenticator(string)

    Enables public key authentication backed by an authorized_keys file path.

    Declaration
    public void SetAuthorizedKeysAuthenticator(string path)
    Parameters
    Type Name Description
    string path

    The authorized_keys file path.

    | Edit this page View Source

    SetAuthorizedkeyAuthenticator(IAMNetAuthorizedKeysAuthenticator)

    Enables public key authentication backed by an authorized_keys file.

    Declaration
    public void SetAuthorizedkeyAuthenticator(IAMNetAuthorizedKeysAuthenticator authorizedKeysAuthenticator)
    Parameters
    Type Name Description
    IAMNetAuthorizedKeysAuthenticator authorizedKeysAuthenticator

    The authorized keys configuration.

    | Edit this page View Source

    SetAuthorizedkeyAuthenticator(string)

    Enables public key authentication backed by an authorized_keys file path.

    Declaration
    public void SetAuthorizedkeyAuthenticator(string path)
    Parameters
    Type Name Description
    string path

    The authorized_keys file path.

    | Edit this page View Source

    SetCompositePasswordAuthenticator(params IAMNetPasswordAuthenticator[])

    Enables username/password authentication using multiple modules evaluated in order.

    Declaration
    public void SetCompositePasswordAuthenticator(params IAMNetPasswordAuthenticator[] authenticators)
    Parameters
    Type Name Description
    IAMNetPasswordAuthenticator[] authenticators

    The password authenticators to try.

    | Edit this page View Source

    SetCompositePublicKeyAuthenticator(params IAMNetPublickeyAuthenticator[])

    Enables public key authentication using multiple modules evaluated in order.

    Declaration
    public void SetCompositePublicKeyAuthenticator(params IAMNetPublickeyAuthenticator[] authenticators)
    Parameters
    Type Name Description
    IAMNetPublickeyAuthenticator[] authenticators

    The public key authenticators to try.

    | Edit this page View Source

    SetCompositePublickeyAuthenticator(params IAMNetPublickeyAuthenticator[])

    Enables public key authentication using multiple modules evaluated in order.

    Declaration
    public void SetCompositePublickeyAuthenticator(params IAMNetPublickeyAuthenticator[] authenticators)
    Parameters
    Type Name Description
    IAMNetPublickeyAuthenticator[] authenticators

    The public key authenticators to try.

    | Edit this page View Source

    SetDelegateKeyboardInteractiveAuthenticator(Action<string, ISshChallenge>, Func<ISshSession, string, IResponseList, bool>)

    Enables keyboard-interactive authentication using .NET callbacks.

    Declaration
    public void SetDelegateKeyboardInteractiveAuthenticator(Action<string, ISshChallenge> generateChallenge, Func<ISshSession, string, IResponseList, bool> authenticate)
    Parameters
    Type Name Description
    Action<string, ISshChallenge> generateChallenge

    Callback that populates prompts sent to the client.

    Func<ISshSession, string, IResponseList, bool> authenticate

    Callback that validates the client responses.

    | Edit this page View Source

    SetDelegatePasswordAuthenticator(Func<string, string, ISshSession, bool>)

    Enables username/password authentication using a .NET callback.

    Declaration
    public void SetDelegatePasswordAuthenticator(Func<string, string, ISshSession, bool> authenticate)
    Parameters
    Type Name Description
    Func<string, string, ISshSession, bool> authenticate

    Callback that receives username, password, and session metadata and returns whether the credentials should be accepted.

    | Edit this page View Source

    SetDelegatePublicKeyAuthenticator(Func<string, string, ISshSession, bool>)

    Enables public key authentication using a .NET callback.

    Declaration
    public void SetDelegatePublicKeyAuthenticator(Func<string, string, ISshSession, bool> authenticate)
    Parameters
    Type Name Description
    Func<string, string, ISshSession, bool> authenticate

    Callback that receives username, public key fingerprint, and session metadata and returns whether the key should be accepted.

    | Edit this page View Source

    SetDelegatePublickeyAuthenticator(Func<string, string, ISshSession, bool>)

    Enables public key authentication using a .NET callback.

    Declaration
    public void SetDelegatePublickeyAuthenticator(Func<string, string, ISshSession, bool> authenticate)
    Parameters
    Type Name Description
    Func<string, string, ISshSession, bool> authenticate

    Callback that receives username, public key fingerprint, and session metadata and returns whether the key should be accepted.

    | Edit this page View Source

    SetFingerprintPublicKeyAuthenticator(string, params string[])

    Enables public key authentication for one username and one or more accepted fingerprints.

    Declaration
    public void SetFingerprintPublicKeyAuthenticator(string username, params string[] acceptedFingerprints)
    Parameters
    Type Name Description
    string username

    The exact username to accept.

    string[] acceptedFingerprints

    One or more accepted public key fingerprints.

    | Edit this page View Source

    SetFingerprintPublickeyAuthenticator(string, params string[])

    Enables public key authentication for one username and one or more accepted fingerprints.

    Declaration
    public void SetFingerprintPublickeyAuthenticator(string username, params string[] acceptedFingerprints)
    Parameters
    Type Name Description
    string username

    The exact username to accept.

    string[] acceptedFingerprints

    One or more accepted public key fingerprints.

    | Edit this page View Source

    SetFixedKeyboardInteractiveAuthenticator(string, string?, string, string, string)

    Enables keyboard-interactive authentication with a single fixed response.

    Declaration
    public void SetFixedKeyboardInteractiveAuthenticator(string expectedResponse, string? username = null, string prompt = "Verification code", string interactionName = "Authentication", string instruction = "Enter the verification code.")
    Parameters
    Type Name Description
    string expectedResponse

    The exact response to accept.

    string username

    Optional exact username to accept.

    string prompt

    Prompt text shown to the client.

    string interactionName

    Challenge name shown to the client.

    string instruction

    Instruction text shown with the challenge.

    | Edit this page View Source

    SetFixedPasswordAuthenticator(string, string)

    Enables a single fixed username/password pair.

    Declaration
    public void SetFixedPasswordAuthenticator(string username, string password)
    Parameters
    Type Name Description
    string username

    The exact username to accept.

    string password

    The exact password to accept.

    | Edit this page View Source

    SetKeyboardInteractiveAuthenticator(IAMNetKeyboardInteractiveAuthenticator)

    Enables keyboard-interactive authentication.

    Declaration
    public void SetKeyboardInteractiveAuthenticator(IAMNetKeyboardInteractiveAuthenticator keyboardInteractiveAuthenticator)
    Parameters
    Type Name Description
    IAMNetKeyboardInteractiveAuthenticator keyboardInteractiveAuthenticator

    The application authenticator.

    | Edit this page View Source

    SetPasswordAuthenticator(IAMNetPasswordAuthenticator)

    Enables username/password authentication.

    Declaration
    public void SetPasswordAuthenticator(IAMNetPasswordAuthenticator passwordAuthenticator)
    Parameters
    Type Name Description
    IAMNetPasswordAuthenticator passwordAuthenticator

    The application authenticator.

    | Edit this page View Source

    SetPublicKeyAuthenticator(IAMNetPublickeyAuthenticator)

    Enables public key authentication.

    Declaration
    public void SetPublicKeyAuthenticator(IAMNetPublickeyAuthenticator publickeyAuthenticator)
    Parameters
    Type Name Description
    IAMNetPublickeyAuthenticator publickeyAuthenticator

    The application authenticator.

    | Edit this page View Source

    SetPublickeyAuthenticator(IAMNetPublickeyAuthenticator)

    Enables public key authentication.

    Declaration
    public void SetPublickeyAuthenticator(IAMNetPublickeyAuthenticator publickeyAuthenticator)
    Parameters
    Type Name Description
    IAMNetPublickeyAuthenticator publickeyAuthenticator

    The application authenticator.

    | Edit this page View Source

    SetUpDefaultServer()

    Creates a server with the default SSH server factories.

    Declaration
    public static AMNetSshServer SetUpDefaultServer()
    Returns
    Type Description
    AMNetSshServer
    | Edit this page View Source

    Start()

    Starts accepting SSH connections.

    Declaration
    public void Start()
    | Edit this page View Source

    Stop()

    Stops the server and closes active resources using the server default shutdown behavior.

    Declaration
    public void Stop()
    | Edit this page View Source

    Stop(bool)

    Stops the server.

    Declaration
    public void Stop(bool immediately)
    Parameters
    Type Name Description
    bool immediately

    When true, closes active sessions immediately.

    | Edit this page View Source

    addSessionListener(IAMNetSessionListener)

    Registers session lifecycle callbacks.

    Declaration
    public void addSessionListener(IAMNetSessionListener sessionListener)
    Parameters
    Type Name Description
    IAMNetSessionListener sessionListener

    The session listener to add.

    | Edit this page View Source

    getConfiguredAuthenticationMethods()

    Gets the configured authentication method chains in evaluation order.

    Declaration
    public IReadOnlyList<IReadOnlyList<string>> getConfiguredAuthenticationMethods()
    Returns
    Type Description
    IReadOnlyList<IReadOnlyList<string>>
    | Edit this page View Source

    getHost()

    Gets the configured bind address.

    Declaration
    public string? getHost()
    Returns
    Type Description
    string
    | Edit this page View Source

    getPort()

    Gets the TCP port the SSH server listens on.

    Declaration
    public int getPort()
    Returns
    Type Description
    int
    | Edit this page View Source

    isClosed()

    Returns whether the server has been closed.

    Declaration
    public bool isClosed()
    Returns
    Type Description
    bool
    | Edit this page View Source

    isStarted()

    Returns whether the server has been started.

    Declaration
    public bool isStarted()
    Returns
    Type Description
    bool
    | Edit this page View Source

    setAuthenticationMethodGroups(params IEnumerable<string>[])

    Sets the authentication method policy using one or more required method groups.

    Declaration
    public void setAuthenticationMethodGroups(params IEnumerable<string>[] authenticationMethodGroups)
    Parameters
    Type Name Description
    IEnumerable<string>[] authenticationMethodGroups

    Each group contains methods that must all succeed in order. The outer set represents alternative groups.

    | Edit this page View Source

    setAuthenticationMethods(params string[])

    Sets the authentication method policy using one or more pre-built method chains.

    Declaration
    public void setAuthenticationMethods(params string[] authenticationChains)
    Parameters
    Type Name Description
    string[] authenticationChains

    Authentication chains such as PublicKey or values returned by RequireAll(params string[]).

    | Edit this page View Source

    setAuthorizedkeyAuthenticator(IAMNetAuthorizedKeysAuthenticator)

    Enables public key authentication backed by an authorized_keys file.

    Declaration
    public void setAuthorizedkeyAuthenticator(IAMNetAuthorizedKeysAuthenticator authorizedKeysAuthenticator)
    Parameters
    Type Name Description
    IAMNetAuthorizedKeysAuthenticator authorizedKeysAuthenticator

    The authorized keys configuration.

    | Edit this page View Source

    setAuthorizedkeyAuthenticator(string)

    Enables public key authentication backed by an authorized_keys file path.

    Declaration
    public void setAuthorizedkeyAuthenticator(string path)
    Parameters
    Type Name Description
    string path

    The authorized_keys file path.

    | Edit this page View Source

    setCommandFactory(AMNetScpCommandFactory)

    Enables SCP command handling for incoming SSH sessions.

    Declaration
    public void setCommandFactory(AMNetScpCommandFactory scpFactory)
    Parameters
    Type Name Description
    AMNetScpCommandFactory scpFactory

    The SCP command factory.

    | Edit this page View Source

    setCompositePasswordAuthenticator(params IAMNetPasswordAuthenticator[])

    Enables username/password authentication using multiple modules evaluated in order.

    Declaration
    public void setCompositePasswordAuthenticator(params IAMNetPasswordAuthenticator[] authenticators)
    Parameters
    Type Name Description
    IAMNetPasswordAuthenticator[] authenticators

    The password authenticators to try.

    | Edit this page View Source

    setCompositePublickeyAuthenticator(params IAMNetPublickeyAuthenticator[])

    Enables public key authentication using multiple modules evaluated in order.

    Declaration
    public void setCompositePublickeyAuthenticator(params IAMNetPublickeyAuthenticator[] authenticators)
    Parameters
    Type Name Description
    IAMNetPublickeyAuthenticator[] authenticators

    The public key authenticators to try.

    | Edit this page View Source

    setDelegateKeyboardInteractiveAuthenticator(Action<string, ISshChallenge>, Func<ISshSession, string, IResponseList, bool>)

    Enables keyboard-interactive authentication using .NET callbacks.

    Declaration
    public void setDelegateKeyboardInteractiveAuthenticator(Action<string, ISshChallenge> generateChallenge, Func<ISshSession, string, IResponseList, bool> authenticate)
    Parameters
    Type Name Description
    Action<string, ISshChallenge> generateChallenge

    Callback that populates prompts sent to the client.

    Func<ISshSession, string, IResponseList, bool> authenticate

    Callback that validates the client responses.

    | Edit this page View Source

    setDelegatePasswordAuthenticator(Func<string, string, ISshSession, bool>)

    Enables username/password authentication using a .NET callback.

    Declaration
    public void setDelegatePasswordAuthenticator(Func<string, string, ISshSession, bool> authenticate)
    Parameters
    Type Name Description
    Func<string, string, ISshSession, bool> authenticate

    Callback that receives username, password, and session metadata and returns whether the credentials should be accepted.

    | Edit this page View Source

    setDelegatePublickeyAuthenticator(Func<string, string, ISshSession, bool>)

    Enables public key authentication using a .NET callback.

    Declaration
    public void setDelegatePublickeyAuthenticator(Func<string, string, ISshSession, bool> authenticate)
    Parameters
    Type Name Description
    Func<string, string, ISshSession, bool> authenticate

    Callback that receives username, public key fingerprint, and session metadata and returns whether the key should be accepted.

    | Edit this page View Source

    setFileSystemFactory(AMNetVirtualFileSystemFactory)

    Sets the virtual filesystem factory used to map users to server-side home directories.

    Declaration
    public void setFileSystemFactory(AMNetVirtualFileSystemFactory fileSystemFactory)
    Parameters
    Type Name Description
    AMNetVirtualFileSystemFactory fileSystemFactory

    The filesystem factory configuration.

    | Edit this page View Source

    setFingerprintPublickeyAuthenticator(string, params string[])

    Enables public key authentication for one username and one or more accepted fingerprints.

    Declaration
    public void setFingerprintPublickeyAuthenticator(string username, params string[] acceptedFingerprints)
    Parameters
    Type Name Description
    string username

    The exact username to accept.

    string[] acceptedFingerprints

    One or more accepted public key fingerprints.

    | Edit this page View Source

    setFixedKeyboardInteractiveAuthenticator(string, string?, string, string, string)

    Enables keyboard-interactive authentication with a single fixed response.

    Declaration
    public void setFixedKeyboardInteractiveAuthenticator(string expectedResponse, string? username = null, string prompt = "Verification code", string interactionName = "Authentication", string instruction = "Enter the verification code.")
    Parameters
    Type Name Description
    string expectedResponse

    The exact response to accept.

    string username

    Optional exact username to accept.

    string prompt

    Prompt text shown to the client.

    string interactionName

    Challenge name shown to the client.

    string instruction

    Instruction text shown with the challenge.

    | Edit this page View Source

    setFixedPasswordAuthenticator(string, string)

    Enables a single fixed username/password pair.

    Declaration
    public void setFixedPasswordAuthenticator(string username, string password)
    Parameters
    Type Name Description
    string username

    The exact username to accept.

    string password

    The exact password to accept.

    | Edit this page View Source

    setHost(string?)

    Sets the bind address. Use null to use the server default.

    Declaration
    public void setHost(string? host)
    Parameters
    Type Name Description
    string host

    The IP address or host name to bind.

    | Edit this page View Source

    setIoServiceEventListener(IAMNetIoServiceEventListener)

    Registers low-level I/O service callbacks.

    Declaration
    public void setIoServiceEventListener(IAMNetIoServiceEventListener serverIoServiceEventListener)
    Parameters
    Type Name Description
    IAMNetIoServiceEventListener serverIoServiceEventListener

    The low-level connection listener.

    | Edit this page View Source

    setKeyPairProvider(AMNetSimpleGeneratorHostKeyProvider)

    Sets the host key provider used to identify this SSH server to clients.

    Declaration
    public void setKeyPairProvider(AMNetSimpleGeneratorHostKeyProvider keyProvider)
    Parameters
    Type Name Description
    AMNetSimpleGeneratorHostKeyProvider keyProvider

    The host key provider configuration.

    | Edit this page View Source

    setKeyboardInteractiveAuthenticator(IAMNetKeyboardInteractiveAuthenticator)

    Enables keyboard-interactive authentication.

    Declaration
    public void setKeyboardInteractiveAuthenticator(IAMNetKeyboardInteractiveAuthenticator keyboardInteractiveAuthenticator)
    Parameters
    Type Name Description
    IAMNetKeyboardInteractiveAuthenticator keyboardInteractiveAuthenticator

    The application authenticator.

    | Edit this page View Source

    setPasswordAuthenticator(IAMNetPasswordAuthenticator)

    Enables username/password authentication.

    Declaration
    public void setPasswordAuthenticator(IAMNetPasswordAuthenticator passwordAuthenticator)
    Parameters
    Type Name Description
    IAMNetPasswordAuthenticator passwordAuthenticator

    The application authenticator.

    | Edit this page View Source

    setPort(int)

    Sets the TCP port the SSH server listens on.

    Declaration
    public void setPort(int port)
    Parameters
    Type Name Description
    int port

    The TCP port number.

    | Edit this page View Source

    setPublickeyAuthenticator(IAMNetPublickeyAuthenticator)

    Enables public key authentication.

    Declaration
    public void setPublickeyAuthenticator(IAMNetPublickeyAuthenticator publickeyAuthenticator)
    Parameters
    Type Name Description
    IAMNetPublickeyAuthenticator publickeyAuthenticator

    The application authenticator.

    | Edit this page View Source

    setServerProxyAcceptor(IAMNetServerProxyAcceptor)

    Enables PROXY protocol metadata handling before the SSH handshake.

    Declaration
    public void setServerProxyAcceptor(IAMNetServerProxyAcceptor serverProxyAcceptor)
    Parameters
    Type Name Description
    IAMNetServerProxyAcceptor serverProxyAcceptor

    The acceptor that parses and validates proxy metadata.

    | Edit this page View Source

    setSubsystemFactories(AMNetSftpSubsystemFactory)

    Enables the SFTP subsystem for incoming SSH sessions.

    Declaration
    public void setSubsystemFactories(AMNetSftpSubsystemFactory sftpFactory)
    Parameters
    Type Name Description
    AMNetSftpSubsystemFactory sftpFactory

    The SFTP subsystem factory.

    | Edit this page View Source

    setUpDefaultServer()

    Creates a server with the default SSH server factories.

    Declaration
    public static AMNetSshServer setUpDefaultServer()
    Returns
    Type Description
    AMNetSshServer
    | Edit this page View Source

    start()

    Starts accepting SSH connections.

    Declaration
    public void start()
    | Edit this page View Source

    stop()

    Stops the server and closes active resources using the server default shutdown behavior.

    Declaration
    public void stop()
    | Edit this page View Source

    stop(bool)

    Stops the server.

    Declaration
    public void stop(bool immediately)
    Parameters
    Type Name Description
    bool immediately

    When true, closes active sessions immediately.

    Implements

    IDisposable
    • Edit this page
    • View Source
    In this article
    Back to top Porta SFTP ServerGitHubApacheMinaSSHD.NET Generated by DocFX