Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
Enumerations | Functions
SSH Configuration And Status [OPENAPI_SSH]

Enumerations

enum  OPEN_SSH_KEY_TYPE_t { OPEN_SSH_KEY_TYPE_RSA = 0, OPEN_SSH_KEY_TYPE_DSA = 1 }
 OpEN uses this enumeration to define SSH key types. More...
 
enum  OPEN_SSH_PROTO_VERSION_t { OPEN_SSH_PROTO_VERSION_1 = 0, OPEN_SSH_PROTO_VERSION_2 = 1, OPEN_SSH_PROTO_VERSION_BOTH = 2 }
 OpEN uses this enumeration to define SSH protocol versions. More...
 

Functions

open_error_t openapiScpRemoteTransferComplete (openapiClientHandle_t *client_handle)
 To update application about the completion of scp remote file transfer. More...
 
open_error_t openapiScpRemoteTransferStart (openapiClientHandle_t *client_handle, int32_t scpClientPID, open_buffdesc *fileParams)
 To get the download file complete path and initiate transfer process. More...
 
open_error_t openapiScpServerAdminModeGet (openapiClientHandle_t *client_handle, OPEN_CONTROL_t *scpServerAdminMode)
 Get the SCP server admin mode. More...
 
open_error_t openapiScpServerAdminModeSet (openapiClientHandle_t *client_handle, OPEN_CONTROL_t scpServerAdminMode)
 Set the SCP server admin mode to initiate file transfer. More...
 
open_error_t openapiSSHActiveSessionsGet (openapiClientHandle_t *client_handle, uint32_t *sshActiveSessions)
 Get the active number of SSH sessions. More...
 
open_error_t openapiSSHAdminModeGet (openapiClientHandle_t *client_handle, OPEN_CONTROL_t *sshAdminMode)
 Get the admin mode of SSH. More...
 
open_error_t openapiSSHAdminModeSet (openapiClientHandle_t *client_handle, OPEN_CONTROL_t sshAdminMode)
 Set the admin mode of SSH. More...
 
open_error_t openapiSSHKeyDelete (openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType)
 Delete the generated SSH key pairs. More...
 
open_error_t openapiSSHKeyGenerate (openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType)
 Generate SSH key pairs. More...
 
open_error_t openapiSSHKeyStatusGet (openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType)
 Check the status of SSH key. More...
 
open_error_t openapiSSHLogMessage (openapiClientHandle_t *client_handle, OPEN_LOG_SEVERITY_t severity, open_buffdesc *fileName, uint32_t lineNum, open_buffdesc *msgBuf)
 Log an SSH message in the log server. More...
 
open_error_t openapiSSHMaxSessionsDefaultSet (openapiClientHandle_t *client_handle)
 Set the maximum number of allowed SSH sessions to the default. More...
 
open_error_t openapiSSHMaxSessionsGet (openapiClientHandle_t *client_handle, uint32_t *sshMaxSessions)
 Get the maximum number of SSH sessions allowed. More...
 
open_error_t openapiSSHMaxSessionsSet (openapiClientHandle_t *client_handle, uint32_t sshMaxSessions)
 Set the maximum number of allowed SSH sessions. More...
 
open_error_t openapiSSHProtocolVersionGet (openapiClientHandle_t *client_handle, OPEN_SSH_PROTO_VERSION_t *protoVersion)
 Get the SSH protocol version. More...
 
open_error_t openapiSSHProtocolVersionSet (openapiClientHandle_t *client_handle, OPEN_SSH_PROTO_VERSION_t protoVersion)
 Set the SSH protocol version. More...
 
open_error_t openapiSSHPubKeyAuthModeGet (openapiClientHandle_t *client_handle, OPEN_CONTROL_t *sshdPubKeyAuthMode)
 Get the admin mode of SSH public key. More...
 
open_error_t openapiSSHPubKeyGet (openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType, open_buffdesc *userName, open_buffdesc *pubKey)
 Get the SSH public key for specified user. More...
 
open_error_t openapiSSHPublicUserAuthenticate (openapiClientHandle_t *client_handle, open_buffdesc *userName, open_buffdesc *ipAddr, uint32_t sshClientID)
 Authenticate SSH User. More...
 
open_error_t openapiSSHRemotePasswordGet (openapiClientHandle_t *client_handle, uint32_t clientSockID, open_buffdesc *password)
 Get the remote password for the matching client Socket ID for outbound SSH . More...
 
open_error_t openapiSSHSessionTimeoutGet (openapiClientHandle_t *client_handle, uint32_t *sshSessionTimeout)
 Get the SSH session idle timeout value. More...
 
open_error_t openapiSSHSessionTimeoutSet (openapiClientHandle_t *client_handle, uint32_t sshSessionTimeout)
 Set the SSH session idle timeout. More...
 
open_error_t openapiSSHSocketInfoClear (openapiClientHandle_t *client_handle, uint32_t sshClientID)
 Clear socket info entry. More...
 
open_error_t openapiSSHTransferRemotePasswordFromUserGet (openapiClientHandle_t *client_handle, open_buffdesc *userName, open_buffdesc *password)
 Get the remote password for the matching remote username used for transfer. More...
 
open_error_t openapiSSHUserAuthenticate (openapiClientHandle_t *client_handle, open_buffdesc *userName, open_buffdesc *password, open_buffdesc *ipAddr, uint32_t sshClientID)
 Authenticate SSH User. More...
 

Detailed Description

Enumeration Type Documentation

OpEN uses this enumeration to define SSH key types.

Enumerator
OPEN_SSH_KEY_TYPE_RSA 

SSH Key Type RSA.

OPEN_SSH_KEY_TYPE_DSA 

SSH Key Type DSA.

Definition at line 45 of file openapi_ssh.h.

OpEN uses this enumeration to define SSH protocol versions.

Enumerator
OPEN_SSH_PROTO_VERSION_2 

SSH Protocol Version 2.

OPEN_SSH_PROTO_VERSION_BOTH 

SSH Protocol Version Both (1 and 2) option not supported.

Definition at line 52 of file openapi_ssh.h.

Function Documentation

open_error_t openapiScpRemoteTransferComplete ( openapiClientHandle_t client_handle)

To update application about the completion of scp remote file transfer.

Parameters
[in]client_handleClient handle from registration API.
Return values
OPEN_E_NONEif successfully updated status.
OPEN_E_FAILif failed to update status.
OPEN_E_PARAMif invalid input parameters is passed.

OpEN API Version: 1.14

Examples:
ssh_example.c.
open_error_t openapiScpRemoteTransferStart ( openapiClientHandle_t client_handle,
int32_t  scpClientPID,
open_buffdesc fileParams 
)

To get the download file complete path and initiate transfer process.

Parameters
[in]client_handleClient handle from registration API
[in]scpClientPIDProcess identifier of client
[in,out]fileParamsfile download path.
Return values
OPEN_E_NONEif file path updated and scp file transfer was successfully initiated.
OPEN_E_FAILif failed to start the scp remote file transfer.
OPEN_E_PARAMif invalid input parameters is passed.
Note
SCP remote file transfer supported for specific files via scp command. Example scp push commands executed on a PC host for configuration and firmware images. scp <config file> user\<scp server ip>:startup-config scp <config file> user\<scp server ip>:backup-config scp <config file> user\<scp server ip>:factory-defaults scp <config file> user\<scp server ip>:<scriptfile.scr> scp <image file> user\<scp server ip>:active scp <image file> user\<scp server ip>:backup
Caller provided fileName should be less than supported length. OPENAPI_FILENAME_LEN_MAX bytes.
Caller must provide a buffer for filename of at least OPENAPI_FILEPATH_LEN_MAX+1 bytes.
Caller must provide a PID of calling process. This identifier shall be used to monitor liveliness of scp client.

OpEN API Version: 1.15

Examples:
ssh_example.c.
open_error_t openapiScpServerAdminModeGet ( openapiClientHandle_t client_handle,
OPEN_CONTROL_t scpServerAdminMode 
)

Get the SCP server admin mode.

Parameters
[in]client_handleClient handle from registration API
[out]modeSCP Remote server mode enabled or disabled. Must be one of the following: OPEN_DISABLE or OPEN_ENABLE
Return values
OPEN_E_NONEif get SCP remote server admin mode status.
OPEN_E_FAILif failed to get SCP server admin mode.
OPEN_E_PARAMif invalid input parameters is passed.

OpEN API Version: 1.14

Examples:
ssh_example.c.
open_error_t openapiScpServerAdminModeSet ( openapiClientHandle_t client_handle,
OPEN_CONTROL_t  scpServerAdminMode 
)

Set the SCP server admin mode to initiate file transfer.

Parameters
[in]client_handleClient handle from registration API
[in]scpServerAdminModeSCP Remote server mode enabled or disabled. Must be one of the following: OPEN_DISABLE or OPEN_ENABLE
Return values
OPEN_E_NONEif SCP remote server mode status set.
OPEN_E_FAILif failed to get SCP server admin mode.
OPEN_E_PARAMif invalid input parameters is passed.

OpEN API Version: 1.14

Examples:
ssh_example.c.
open_error_t openapiSSHActiveSessionsGet ( openapiClientHandle_t client_handle,
uint32_t *  sshActiveSessions 
)

Get the active number of SSH sessions.

Parameters
[in]client_handleClient handle from registration API
[out]sshActiveSessionsActive SSH sessions
Return values
OPEN_E_NONEif the number of active SSH sessions is returned.
OPEN_E_FAILif failed to get number of active SSH sessions.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHAdminModeGet ( openapiClientHandle_t client_handle,
OPEN_CONTROL_t sshAdminMode 
)

Get the admin mode of SSH.

Parameters
[in]client_handleClient handle from registration API
[in]sshAdminModeSSH admin mode. Must be one of the following: OPEN_DISABLE or OPEN_ENABLE
Return values
OPEN_E_NONEif SSH admin mode is returned.
OPEN_E_FAILif failed to return SSH admin mode.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHAdminModeSet ( openapiClientHandle_t client_handle,
OPEN_CONTROL_t  sshAdminMode 
)

Set the admin mode of SSH.

Parameters
[in]client_handleClient handle from registration API
[in]sshAdminModeSSH admin mode. Must be one of the following: OPEN_DISABLE or OPEN_ENABLE
Return values
OPEN_E_NONEif SSH admin mode is set.
OPEN_E_FAILif the RSA and DSA keys are not present.
OPEN_E_PARAMif invalid parameter is passed.
Note
Calling this API will change the running configuration of the switch.
The API returns OPEN_E_FAIL only for OPEN_ENABLE mode if RSA and DSA keys are not found.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHKeyDelete ( openapiClientHandle_t client_handle,
OPEN_SSH_KEY_TYPE_t  sshKeyType 
)

Delete the generated SSH key pairs.

Parameters
[in]client_handleClient handle from registration API
[in]sshKeyTypeSSH key type. Must be one of the following: OPEN_SSH_KEY_TYPE_RSA or OPEN_SSH_KEY_TYPE_DSA
Return values
OPEN_E_NONEif the generated key is deleted.
OPEN_E_FAILif SSH admin mode is enabled.
OPEN_E_PARAMif invalid parameter is passed.
Note
SSH admin mode must be disabled to delete the keys.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHKeyGenerate ( openapiClientHandle_t client_handle,
OPEN_SSH_KEY_TYPE_t  sshKeyType 
)

Generate SSH key pairs.

Parameters
[in]client_handleClient handle from registration API
[in]sshKeyTypeSSH key type. Must be one of the following: OPEN_SSH_KEY_TYPE_RSA or OPEN_SSH_KEY_TYPE_DSA
Return values
OPEN_E_NONEif SSH key is generated.
OPEN_E_FAILif SSH admin mode is enabled or if key generation is in progress or if failed to generate SSH key.
OPEN_E_PARAMif invalid parameter is passed.
Note
SSH admin mode must be disabled to regenerate the keys.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHKeyStatusGet ( openapiClientHandle_t client_handle,
OPEN_SSH_KEY_TYPE_t  sshKeyType 
)

Check the status of SSH key.

Parameters
[in]client_handleClient handle from registration API
[in]sshKeyTypeSSH key type. Must be one of the following: OPEN_SSH_KEY_TYPE_RSA or OPEN_SSH_KEY_TYPE_DSA
Return values
OPEN_E_NONEif SSH key exists.
OPEN_E_FAILif SSH key generation is in progress.
OPEN_E_NOT_FOUNDif SSH key does not exist.
OPEN_E_INTERNALif internal error has occurred.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHLogMessage ( openapiClientHandle_t client_handle,
OPEN_LOG_SEVERITY_t  severity,
open_buffdesc fileName,
uint32_t  lineNum,
open_buffdesc msgBuf 
)

Log an SSH message in the log server.

Parameters
[in]client_handleClient handle from registration API
[in]severitySeverity of the log message
[in]fileNameFile name from which the log is generated
[in]lineNumLine number in the file generating the log
[in]msgBufLog message buffer
Return values
OPEN_E_NONEif message is logged.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

open_error_t openapiSSHMaxSessionsDefaultSet ( openapiClientHandle_t client_handle)

Set the maximum number of allowed SSH sessions to the default.

Parameters
[in]client_handleClient handle from registration API
Return values
OPEN_E_NONEif maximum number SSH sessions is set to default.
OPEN_E_FAILif failed to set maximum SSH sessions to default.
OPEN_E_PARAMif invalid parameter is passed.
Note
Calling this API will change the running configuration of the switch.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHMaxSessionsGet ( openapiClientHandle_t client_handle,
uint32_t *  sshMaxSessions 
)

Get the maximum number of SSH sessions allowed.

Parameters
[in]client_handleClient handle from registration API
[out]sshMaxSessionsMaximum number of SSH sessions
Return values
OPEN_E_NONEif maximum number of SSH sessions is returned.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHMaxSessionsSet ( openapiClientHandle_t client_handle,
uint32_t  sshMaxSessions 
)

Set the maximum number of allowed SSH sessions.

Parameters
[in]client_handleClient handle from registration API
[in]sshMaxSessionsMaximum number of SSH sessions
Return values
OPEN_E_NONEif maximum number of SSH sessions is set.
OPEN_E_FAILif failed to set maximum SSH sessions.
OPEN_E_PARAMif invalid parameter is passed.
Note
The maximum number of sessions can be obtained by using the OpEN API openapiSSHMaxSessionsGet() function.
Calling this API will change the running configuration of the switch.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHProtocolVersionGet ( openapiClientHandle_t client_handle,
OPEN_SSH_PROTO_VERSION_t protoVersion 
)

Get the SSH protocol version.

Parameters
[in]client_handleClient handle from registration API
[out]protoVersionSSH protocol version
Return values
OPEN_E_NONEif SSH protocol version is returned successfully.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHProtocolVersionSet ( openapiClientHandle_t client_handle,
OPEN_SSH_PROTO_VERSION_t  protoVersion 
)

Set the SSH protocol version.

Parameters
[in]client_handleClient handle from registration API
[in]protoVersionSSH protocol version. Must be set to OPEN_SSH_PROTO_VERSION_2
Return values
OPEN_E_NONEif SSH protocol version is set.
OPEN_E_FAILif failed to set SSH protocol version.
OPEN_E_UNAVAILSSH protocol version 1 not supported.
OPEN_E_PARAMif invalid parameter is passed.
Note
Calling this API will change the running configuration of the switch. Only SSH protocol vesion 2 supported. SSH protocol vesion 1 deprecated by OpenSSH7.5p1 version.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHPubKeyAuthModeGet ( openapiClientHandle_t client_handle,
OPEN_CONTROL_t sshdPubKeyAuthMode 
)

Get the admin mode of SSH public key.

Parameters
[in]client_handleClient handle from registration API
[in]sshAdminModeSSH admin mode. Must be one of the following: OPEN_DISABLE or OPEN_ENABLE
Return values
OPEN_E_NONEif SSH public key mode is returned.
OPEN_E_FAILif failed to return SSH public key mode.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

open_error_t openapiSSHPubKeyGet ( openapiClientHandle_t client_handle,
OPEN_SSH_KEY_TYPE_t  sshKeyType,
open_buffdesc userName,
open_buffdesc pubKey 
)

Get the SSH public key for specified user.

Parameters
[in]client_handleClient handle from registration API
[in]sshKeyTypeSSH key type. Must be one of the following: OPEN_SSH_KEY_TYPE_RSA or OPEN_SSH_KEY_TYPE_DSA
[in]userNameSSH user name supplied by SSH client
[out]pubKeySSH public key
Return values
OPEN_E_NONEif SSH public key is returned.
OPEN_E_FAILif failed to return SSH public key.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

open_error_t openapiSSHPublicUserAuthenticate ( openapiClientHandle_t client_handle,
open_buffdesc userName,
open_buffdesc ipAddr,
uint32_t  sshClientID 
)

Authenticate SSH User.

Parameters
[in]client_handleClient handle from registration API
[in]userNameSSH user name supplied by SSH client
[in]ipAddrIP address of SSH client
[in]sshClientIDopenSSH client ID
Return values
OPEN_E_NONEif SSH user exists.
OPEN_E_FAILif failed to get the user authenticated session.
OPEN_E_NOT_FOUNDif SSH user does not exist.
OPEN_E_INTERNALif internal error has occured.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

open_error_t openapiSSHRemotePasswordGet ( openapiClientHandle_t client_handle,
uint32_t  clientSockID,
open_buffdesc password 
)

Get the remote password for the matching client Socket ID for outbound SSH .

Parameters
[in]client_handleClient handle from registration API
[in]clientSockIDclient sock ID for which password is requested
[out]passwordPassword of the input client socket ID
-Maximum buffer size OPENAPI_SSHC_PASSWORD_SIZE_MAX
Return values
OPEN_E_NONEif password is returned.
OPEN_E_FAILif failed to return password.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.20

Examples:
ssh_example.c.
open_error_t openapiSSHSessionTimeoutGet ( openapiClientHandle_t client_handle,
uint32_t *  sshSessionTimeout 
)

Get the SSH session idle timeout value.

Parameters
[in]client_handleClient handle from registration API
[out]sshSessionTimeoutSSH session idle timeout
Return values
OPEN_E_NONEif SSH idle session timeout is returned successfully.
OPEN_E_FAILif failed to get SSH session idle timeout value.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHSessionTimeoutSet ( openapiClientHandle_t client_handle,
uint32_t  sshSessionTimeout 
)

Set the SSH session idle timeout.

Parameters
[in]client_handleClient handle from registration API
[in]sshSessionTimeoutSSH session idle timeout
-Maximum value OPENAPI_SSHD_MAX_TIMEOUT
Return values
OPEN_E_NONEif SSH session idle timeout is set.
OPEN_E_FAILif failed to set SSH session idle timeout value.
OPEN_E_PARAMif invalid parameter is passed.
Note
Setting sshSessionTimeout to 0 indicates the default timeout value.
Calling this API will change the running configuration of the switch.

OpEN API Version: 1.1

Examples:
ssh_example.c.
open_error_t openapiSSHSocketInfoClear ( openapiClientHandle_t client_handle,
uint32_t  sshClientID 
)

Clear socket info entry.

Parameters
[in]client_handleClient handle from registration API
[in]sshClientIDopenSSH client ID
Return values
OPEN_E_NONEif request socket info entry was cleared properly.
OPEN_E_FAILif failed to clear requested socket info entry.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

open_error_t openapiSSHTransferRemotePasswordFromUserGet ( openapiClientHandle_t client_handle,
open_buffdesc userName,
open_buffdesc password 
)

Get the remote password for the matching remote username used for transfer.

Parameters
[in]client_handleClient handle from registration API
[in]userNameUser name for which password is requested
[out]passwordPassword of the input User name
Return values
OPEN_E_NONEif message is logged.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1

open_error_t openapiSSHUserAuthenticate ( openapiClientHandle_t client_handle,
open_buffdesc userName,
open_buffdesc password,
open_buffdesc ipAddr,
uint32_t  sshClientID 
)

Authenticate SSH User.

Parameters
[in]client_handleClient handle from registration API
[in]userNameSSH user name supplied by SSH client
[in]passwordSSH user password supplied by SSH client
[in]ipAddrIP address of SSH client
[in]sshClientIDopenSSH client ID
Return values
OPEN_E_NONEif SSH user exists.
OPEN_E_FAILif failed to get the user authenticated session.
OPEN_E_NOT_FOUNDif SSH user does not exist.
OPEN_E_INTERNALif internal error has occurred.
OPEN_E_PARAMif invalid parameter is passed.

OpEN API Version: 1.1