Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.13.1.2
openapi_ssh.h
Go to the documentation of this file.
1 
9 /*********************************************************************
10 *
11 * Copyright 2016-2022 Broadcom.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 **********************************************************************
26 *
27 * @filename openapi_ssh.h
28 *
29 * @purpose SSH Configuration and Status
30 *
31 * @component OpEN
32 *
33 * @create 30/01/2013
34 *
35 * @end
36 *
37 **********************************************************************/
38 #ifndef OPENAPI_SSH_H_INCLUDED
39 #define OPENAPI_SSH_H_INCLUDED
40 
41 #include "openapi_common.h"
42 #include "openapi_logging.h"
43 #include "openapi_transfer.h"
44 
46 typedef enum
47 {
52 
54 typedef enum
55 {
56  OPEN_SSH_PROTO_VERSION_1 = 0, /* SSH Protocol Version 1 option not supported */
60 
61 typedef enum
62 {
63  OPEN_SCP_OPER_NONE = 0,
64  OPEN_SCP_PUSH = 1,
65  OPEN_SCP_PULL = 2
66 } OPEN_SCP_OPER_t;
67 
68 #define OPEN_SSHD_KEY_DATA_SIZE_MAX 8192 /* L7_SSHD_KEY_DATA_SIZE_MAX */
69 /*****************************************************************/
89  OPEN_SSH_KEY_TYPE_t sshKeyType);
90 
91 /*****************************************************************/
109  OPEN_SSH_KEY_TYPE_t sshKeyType);
110 
111 /*****************************************************************/
131  OPEN_CONTROL_t sshAdminMode);
132 
133 /*****************************************************************/
149  OPEN_CONTROL_t *sshAdminMode);
150 
151 /*****************************************************************/
171  OPEN_SSH_PROTO_VERSION_t protoVersion);
172 
173 /*****************************************************************/
186  OPEN_SSH_PROTO_VERSION_t *protoVersion);
187 
188 /*****************************************************************/
206  uint32_t sshSessionTimeout);
207 
208 /*****************************************************************/
222  uint32_t *sshSessionTimeout);
223 
224 /*****************************************************************/
242  uint32_t sshMaxSessions);
243 
244 /*****************************************************************/
259 
260 /*****************************************************************/
273  uint32_t *sshMaxSessions);
274 
275 /*****************************************************************/
289  uint32_t *sshActiveSessions);
290 
291 /*****************************************************************/
309  OPEN_SSH_KEY_TYPE_t sshKeyType);
310 #ifndef DOXYGEN_SHOULD_SKIP_THIS
311 /*****************************************************************/
324 open_error_t openapiSSHSocketInfoClear(openapiClientHandle_t *client_handle,
325  uint32_t sshClientID);
326 
327 /*****************************************************************/
345 open_error_t openapiSSHUserAuthenticate(openapiClientHandle_t *client_handle,
346  open_buffdesc *userName, open_buffdesc *password,
347  open_buffdesc *ipAddr, uint32_t sshClientID);
348 
349 /*****************************************************************/
366 open_error_t openapiSSHPublicUserAuthenticate(openapiClientHandle_t *client_handle,
367  open_buffdesc *userName, open_buffdesc *ipAddr,
368  uint32_t sshClientID);
369 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
370 
371 /*****************************************************************/
387  OPEN_CONTROL_t *sshdPubKeyAuthMode);
388 
389 /*****************************************************************/
407  OPEN_SSH_KEY_TYPE_t sshKeyType,
408  open_buffdesc *userName,
409  open_buffdesc *pubKey);
410 
411 #ifndef DOXYGEN_SHOULD_SKIP_THIS
412 /*****************************************************************/
427 open_error_t openapiSSHLogMessage(openapiClientHandle_t *client_handle,
428  OPEN_LOG_SEVERITY_t severity, open_buffdesc *fileName,
429  uint32_t lineNum, open_buffdesc *msgBuf);
430 
431 
432 /*****************************************************************/
445 open_error_t openapiSSHTransferRemotePasswordFromUserGet(openapiClientHandle_t *client_handle,
446  open_buffdesc *userName,
447  open_buffdesc *password);
448 
449 /*****************************************************************/
465 open_error_t openapiSSHRemotePasswordGet(openapiClientHandle_t *client_handle,
466  uint32_t clientSockID,
467  open_buffdesc *password);
468 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
469 
470 /*****************************************************************/
487  OPEN_CONTROL_t scpServerAdminMode);
488 
489 /*****************************************************************/
506  OPEN_CONTROL_t *scpServerAdminMode);
507 
508 #ifndef DOXYGEN_SHOULD_SKIP_THIS
509 /*****************************************************************/
544 open_error_t openapiScpRemoteTransferStart (openapiClientHandle_t *client_handle,
545  int32_t scpClientPID,
546  open_buffdesc *fileParams);
547 
548 /*****************************************************************/
566 open_error_t openapiScpRemoteTransferComplete (openapiClientHandle_t *client_handle);
567 
568 /*********************************************************************
569 * @purpose To get passphrase for SSH key decryption.
570 *
571 * @param[in] client_handle Client handle from registration API.
572 * @param[in] sshKeyType SSH host key type
573 * @param[out] bufPassphrase Buffer for passphrase
574 *
575 * @returns OPEN_E_NONE if successfully updated status.
576 * @returns OPEN_E_PARAM if invalid input parameters is passed.
577 * @returns OPEN_E_ERROR if failed to get passphrase.
578 *
579 * @note This OpEN API returns the passphrase used to decrypt the SSH host key
580 * in plain-text. Usage of this API is not recommended as this can
581 * be a security concern.
582 *
583 * @open-status-hidden
584 *
585 * @supportedinversion OpEN API Version: 1.21
586 *
587 * @end
588 *********************************************************************/
589 open_error_t openapiSSHKeyEncryptPassphraseGet(openapiClientHandle_t *client_handle,
590  OPEN_SSH_KEY_TYPE_t sshKeyType,
591  open_buffdesc *bufPassphrase);
592 
593 /*****************************************************************/
629 open_error_t openapiScpRemoteTransferUploadStart(openapiClientHandle_t *client_handle,
630  int32_t scpClientPID,
631  open_buffdesc *fileParams);
632 
633 /*****************************************************************/
648 open_error_t openapiScpTransferRemoteComplete(openapiClientHandle_t *client_handle,
649  OPEN_TRANSFER_STATUS_t transferStatus,
650  OPEN_SCP_OPER_t transferType);
651 
652 /*****************************************************************/
665 open_error_t openapiScpTransferStatusSet(openapiClientHandle_t *client_handle);
666 
667 /*****************************************************************/
681 open_error_t openapiSSHTaskCleanup(openapiClientHandle_t *client_handle);
682 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
683 
684 /*************************************************************************/
702  uint32_t portNum);
703 
704 /*************************************************************************/
720  uint32_t *pPort);
721 
722 /*************************************************************************/
739  OPEN_BOOL_t *pSshV1Flag,
740  OPEN_BOOL_t *pSshV2Flag);
741 
742 /*************************************************************************/
762  OPEN_SSH_KEY_TYPE_t type, uint32_t length);
763 
764 /*************************************************************************/
781  OPEN_SSH_KEY_TYPE_t type,
782  uint32_t *pLength);
783 
784 /*************************************************************************/
801  OPEN_SSH_KEY_TYPE_t type,
802  uint32_t *pLength);
803 
804 /*************************************************************************/
821  OPEN_SSH_KEY_TYPE_t type,
822  open_buffdesc *pkeyData);
823 
824 #endif
825 
open_error_t openapiSshdKeyLenGet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t type, uint32_t *pLength)
Gets the length of the existing SSH key.
open_error_t openapiSSHPubKeyAuthModeGet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t *sshdPubKeyAuthMode)
Get the admin mode of SSH public key.
SSH Protocol Version 2.
Definition: openapi_ssh.h:57
open_error_t openapiSshdKeyLenSet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t type, uint32_t length)
Set the length for SSH Key to be generated.
open_error_t openapiSSHActiveSessionsGet(openapiClientHandle_t *client_handle, uint32_t *sshActiveSessions)
Get the active number of SSH sessions.
open_error_t
OPEN uses these enumerators to indicate the error codes.
open_error_t openapiSshdPortNumSet(openapiClientHandle_t *client_handle, uint32_t portNum)
Sets the port number to be used for SSH Server.
open_error_t openapiScpServerAdminModeGet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t *scpServerAdminMode)
Get the SCP server admin mode.
open_error_t openapiSSHAdminModeSet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t sshAdminMode)
Set the admin mode of SSH.
open_error_t openapiSshdPortNumGet(openapiClientHandle_t *client_handle, uint32_t *pPort)
Gets ssh server port number.
open_error_t openapiSSHMaxSessionsGet(openapiClientHandle_t *client_handle, uint32_t *sshMaxSessions)
Get the maximum number of SSH sessions allowed.
open_error_t openapiSSHKeyGenerate(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType)
Generate SSH key pairs.
open_error_t openapiSSHSessionTimeoutGet(openapiClientHandle_t *client_handle, uint32_t *sshSessionTimeout)
Get the SSH session idle timeout value.
SSH Key Type DSA.
Definition: openapi_ssh.h:49
OPEN_LOG_SEVERITY_t
OpEN uses this enumeration to define Logging Severity Levels.
SSH Key Type RSA.
Definition: openapi_ssh.h:48
open_error_t openapiSshdKeyDataGet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t type, open_buffdesc *pkeyData)
Gets key data for a specific key type.
open_error_t openapiSshdProtoLevelFlagsGet(openapiClientHandle_t *client_handle, OPEN_BOOL_t *pSshV1Flag, OPEN_BOOL_t *pSshV2Flag)
Gets ssh version flags.
open_error_t openapiSSHKeyStatusGet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType)
Check the status of SSH key.
open_error_t openapiSSHProtocolVersionGet(openapiClientHandle_t *client_handle, OPEN_SSH_PROTO_VERSION_t *protoVersion)
Get the SSH protocol version.
open_error_t openapiSSHSessionTimeoutSet(openapiClientHandle_t *client_handle, uint32_t sshSessionTimeout)
Set the SSH session idle timeout.
open_error_t openapiScpServerAdminModeSet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t scpServerAdminMode)
Set the SCP server admin mode to initiate file transfer.
open_error_t openapiSSHAdminModeGet(openapiClientHandle_t *client_handle, OPEN_CONTROL_t *sshAdminMode)
Get the admin mode of SSH.
SSH Key Type ECDSA.
Definition: openapi_ssh.h:50
open_error_t openapiSSHMaxSessionsSet(openapiClientHandle_t *client_handle, uint32_t sshMaxSessions)
Set the maximum number of allowed SSH sessions.
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.
OPEN_CONTROL_t
OPEN uses these enumerators to indicate enable or disable for a given config or status parameter...
OPEN_BOOL_t
OPEN uses these enumerators to indicate true or false for a given config or status parameter...
open_error_t openapiSSHMaxSessionsDefaultSet(openapiClientHandle_t *client_handle)
Set the maximum number of allowed SSH sessions to the default.
open_error_t openapiSSHProtocolVersionSet(openapiClientHandle_t *client_handle, OPEN_SSH_PROTO_VERSION_t protoVersion)
Set the SSH protocol version.
open_error_t openapiSSHKeyDelete(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t sshKeyType)
Delete the generated SSH key pairs.
open_error_t openapiSshdCfgKeyLenGet(openapiClientHandle_t *client_handle, OPEN_SSH_KEY_TYPE_t type, uint32_t *pLength)
Gets the configured key length of SSH key.
OPEN_SSH_KEY_TYPE_t
OpEN uses this enumeration to define SSH key types.
Definition: openapi_ssh.h:46
OPEN_SSH_PROTO_VERSION_t
OpEN uses this enumeration to define SSH protocol versions.
Definition: openapi_ssh.h:54
OPEN_TRANSFER_STATUS_t
OPEN File Transfer Status.
SSH Protocol Version Both (1 and 2) option not supported.
Definition: openapi_ssh.h:58