IPWorks SSH 2020 Python Edition

Questions / Feedback?

ssh_auth_mode Property

The authentication method to be used the class when calling SSHLogon .

Syntax

def get_ssh_auth_mode() -> int: ...
def set_ssh_auth_mode(value: int) -> None: ...

ssh_auth_mode = property(get_ssh_auth_mode, set_ssh_auth_mode)

Default Value

2

Remarks

The SSH Authentication specification (RFC 4252) specifies multiple methods by which a user can be authenticated by an SSH server. When a call is made to ssh_logon, the class will connect to the SSH server and establish the security layer. After the connection has been secured, the client will send an authentication request to the ssh_host containing the ssh_user. The server will respond containing a list of methods by which that user may be authenticated.

The class will attempt to authenticate the user by one of those methods based on the value of ssh_auth_mode and other property values supplied by the user. Currently, the class supports the following authentication methods:

amNone (0)No authentication will be performed. The current ssh_user value is ignored, and the connection will be logged in as anonymous.
amMultiFactor (1)This allows the class to attempt a multi-step authentication process. The class will send authentication data to the server based on the list of methods allowed for the current user and the authentication property values supplied. The class will continue to send authentication data until the server acknowledges authentication success. If the server rejects an authentication step, the class fails with an error.
amPassword (2)The class will use the values of ssh_user and ssh_password to authenticate the user.
amPublicKey (3)The class will use the values of ssh_user and the ssh_cert* properties to authenticate the user. the ssh_cert* properties must have a private key available for this authentication method to succeed.
amKeyboardInteractive (4)At the time of authentication, the class will fire the on_ssh_keyboard_interactive event containing instructions on how to complete the authentication step. (NOTE: amKeyboardInteractive is not supported in SSHTunnel).
amGSSAPIWithMic (5)This allows the class to attempt Kerberos authentication using the GSSAPI-WITH-MIC scheme. The client will try Kerberos authentication using the value of ssh_user (single sign-on), or if ssh_password is specified as well, it will try Kerberos authentication with alternate credentials. This is currently supported only in the .NET client.
amCustom (6)This allows the class caller to take over the authentication process completely. When amCustom is set, the class will fire the on_ssh_custom_auth event as necessary to complete the authentication process.

Example (User/Password Auth):

Control.SSHAuthMode = SftpSSHAuthModes.amPassword
Control.SSHUser = "username"
Control.SSHPassword = "password"
Control.SSHLogon("server", 22)
Example (Public Key Auth):
Control.SSHAuthMode = SftpSSHAuthModes.amPublicKey
Control.SSHUser = "username"
Control.SSHCertStoreType = SSHCertStoreTypes.cstPFXFile;
Control.SSHCertStore = "cert.pfx";
Control.SSHCertStorePassword = "certpassword";
Control.SSHCertSubject = "*";  
Control.SSHLogon("server", 22)

Copyright (c) 2023 /n software inc. - All rights reserved.
IPWorks SSH 2020 Python Edition - Version 20.0 [Build 8501]