113 lines
3.2 KiB
C
113 lines
3.2 KiB
C
/* shellHook.h - header for the shell hooks */
|
|
|
|
/*
|
|
* Copyright (c) 2017-2018 Wind River Systems, Inc.
|
|
*
|
|
* The right to copy, distribute, modify, or otherwise make use of this software
|
|
* may be licensed only pursuant to the terms of an applicable Wind River
|
|
* license agreement.
|
|
*/
|
|
|
|
/*
|
|
modification history
|
|
--------------------
|
|
10oct18,jxy Add authentication status into login event (VXW6-86947)
|
|
08aug17,jxy Remove the limitation of 256 characters for login banner (VXW6-86342)
|
|
01jun17,jxy Add to support login banner (F8951)
|
|
27may17,ljl Created (F8192)
|
|
*/
|
|
|
|
#ifndef __INCshellHookh
|
|
#define __INCshellHookh
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
#define SEC_EVENT_SHELL_LOGIN 1
|
|
#define SEC_EVENT_TELNET_LOGIN 2
|
|
#define SEC_EVENT_FTP_LOGIN 3
|
|
#define SEC_EVENT_SSH_LOGIN 4
|
|
#define SEC_EVENT_RLOGIN_LOGIN 5
|
|
#define SEC_EVENT_SHELL_LOGOUT 6
|
|
#define SEC_EVENT_TELNET_LOGOUT 7
|
|
#define SEC_EVENT_SSH_LOGOUT 8
|
|
#define SEC_EVENT_FTP_LOGOUT 9
|
|
#define SEC_EVENT_RLOGIN_LOGOUT 10
|
|
|
|
/* auth method*/
|
|
#define SEC_EVENT_AUTH_PASSWD 0
|
|
#define SEC_EVENT_AUTH_PUBKEY 1
|
|
#define SEC_EVENT_AUTH_HOSTBASED 2
|
|
#define SEC_EVENT_AUTH_MAX 3
|
|
|
|
/* Define to enable supporting to check authentication status in loginEvent, in
|
|
order to handle failed attempts and prevent a login attempt from proceeding.
|
|
Undefined it can keep binary compatible */
|
|
/*
|
|
#define LOGINEVENT_CHECK_AUTH_STAT
|
|
*/
|
|
|
|
#ifdef LOGINEVENT_CHECK_AUTH_STAT
|
|
/* auth result */
|
|
#define SEC_EVENT_AUTH_SUCCESS 0
|
|
#define SEC_EVENT_AUTH_FAILED 1
|
|
#define SEC_EVENT_AUTH_RESULT_MAX 2
|
|
|
|
|
|
extern int (* _func_loginEvent)
|
|
(
|
|
int type, /* login session type */
|
|
const char * user, /* login user name */
|
|
int fd, /* socket fd */
|
|
int method, /* auth method */
|
|
int result /* auth result */
|
|
);
|
|
#else
|
|
extern void (* _func_loginEvent)
|
|
(
|
|
int type, /* login session type */
|
|
const char * user, /* login user name */
|
|
int fd, /* socket fd */
|
|
int method /* auth method */
|
|
);
|
|
#endif
|
|
|
|
extern void (* _func_logoutEvent)
|
|
(
|
|
int type, /* logout session type */
|
|
const char * user /* logout user name */
|
|
);
|
|
|
|
extern int (* _func_loginBanner)
|
|
(
|
|
char ** banner, /* login banner buffer*/
|
|
int * len /* login banner buffer length */
|
|
);
|
|
|
|
#ifdef LOGINEVENT_CHECK_AUTH_STAT
|
|
typedef int (* LOGIN_EVENT_FUNC) (int type, const char *user, int fd, int method, int result);
|
|
#else
|
|
typedef void (* LOGIN_EVENT_FUNC) (int type, const char *user, int fd, int method);
|
|
#endif
|
|
typedef void (* LOGOUT_EVENT_FUNC) (int type, const char *user);
|
|
typedef int (* SHELL_BANNER_FUNC) (char **loginBanner, int *bannerLen);
|
|
|
|
#ifdef LOGINEVENT_CHECK_AUTH_STAT
|
|
extern int loginEventExample(int type, const char* user, int fd, int method, int result);
|
|
#else
|
|
extern void loginEventExample(int type, const char* user, int fd, int method);
|
|
#endif
|
|
extern void logoutEventExample(int type, const char* user);
|
|
extern int loginBannerExample(char **loginBanner, int * bannerLen);
|
|
|
|
/* TODO: add function declaration for shell hooks configured in VIP here */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __INCshellHookh */
|