mirror of https://github.com/tp4a/teleport
强制中断在线会话功能完成。版本升级到v3.0.1.6,准备作为beta版本发布。
parent
d78a1824c1
commit
e7c657e132
|
@ -1,3 +1,3 @@
|
|||
# -*- coding: utf8 -*-
|
||||
VER_TP_SERVER = "3.0.0.5"
|
||||
VER_TP_ASSIST = "3.0.0.5"
|
||||
# -*- coding: utf8 -*-
|
||||
VER_TP_SERVER = "3.0.1.6"
|
||||
VER_TP_ASSIST = "3.0.0.5"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
//# include <io.h>
|
||||
//# include <stdio.h>
|
||||
// #include <direct.h>
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#else
|
||||
// #include <dirent.h>
|
||||
# include <dlfcn.h>
|
||||
|
|
|
@ -68,9 +68,9 @@ typedef struct TPP_INIT_ARGS
|
|||
TPP_SESSION_END_FUNC func_session_end;
|
||||
}TPP_INIT_ARGS;
|
||||
|
||||
typedef struct TPP_SET_CFG_ARGS {
|
||||
ex_u32 noop_timeout; // as second.
|
||||
}TPP_SET_CFG_ARGS;
|
||||
// typedef struct TPP_SET_CFG_ARGS {
|
||||
// ex_u32 noop_timeout; // as second.
|
||||
// }TPP_SET_CFG_ARGS;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
@ -81,7 +81,7 @@ extern "C"
|
|||
TPP_API ex_rv tpp_start(void);
|
||||
TPP_API ex_rv tpp_stop(void);
|
||||
TPP_API void tpp_timer(void);
|
||||
TPP_API void tpp_set_cfg(TPP_SET_CFG_ARGS* cfg_args);
|
||||
// TPP_API void tpp_set_cfg(TPP_SET_CFG_ARGS* cfg_args);
|
||||
|
||||
TPP_API ex_rv tpp_command(ex_u32 cmd, const char* param);
|
||||
|
||||
|
@ -93,7 +93,7 @@ typedef ex_rv (*TPP_INIT_FUNC)(TPP_INIT_ARGS* init_args);
|
|||
typedef ex_rv (*TPP_START_FUNC)(void);
|
||||
typedef ex_rv(*TPP_STOP_FUNC)(void);
|
||||
typedef void(*TPP_TIMER_FUNC)(void);
|
||||
typedef void(*TPP_SET_CFG_FUNC)(TPP_SET_CFG_ARGS* cfg_args);
|
||||
// typedef void(*TPP_SET_CFG_FUNC)(TPP_SET_CFG_ARGS* cfg_args);
|
||||
|
||||
typedef ex_rv(*TPP_COMMAND_FUNC)(ex_u32 cmd, const char* param); // param is a JSON formatted string.
|
||||
|
||||
|
|
Binary file not shown.
|
@ -46,18 +46,25 @@ bool TppManager::load_tpp(const ex_wstr& libname)
|
|||
lib->start = (TPP_START_FUNC)GetProcAddress(lib->dylib, "tpp_start");
|
||||
lib->stop = (TPP_STOP_FUNC)GetProcAddress(lib->dylib, "tpp_stop");
|
||||
lib->timer = (TPP_TIMER_FUNC)GetProcAddress(lib->dylib, "tpp_timer");
|
||||
lib->set_cfg = (TPP_SET_CFG_FUNC)GetProcAddress(lib->dylib, "tpp_set_cfg");
|
||||
// lib->set_cfg = (TPP_SET_CFG_FUNC)GetProcAddress(lib->dylib, "tpp_set_cfg");
|
||||
lib->command = (TPP_COMMAND_FUNC)GetProcAddress(lib->dylib, "tpp_command");
|
||||
#else
|
||||
lib->init = (TPP_INIT_FUNC)dlsym(lib->dylib, "tpp_init");
|
||||
lib->start = (TPP_START_FUNC)dlsym(lib->dylib, "tpp_start");
|
||||
lib->stop = (TPP_STOP_FUNC)dlsym(lib->dylib, "tpp_stop");
|
||||
lib->timer = (TPP_TIMER_FUNC)dlsym(lib->dylib, "tpp_timer");
|
||||
lib->set_cfg = (TPP_SET_CFG_FUNC)dlsym(lib->dylib, "tpp_set_cfg");
|
||||
// lib->set_cfg = (TPP_SET_CFG_FUNC)dlsym(lib->dylib, "tpp_set_cfg");
|
||||
lib->command = (TPP_COMMAND_FUNC)dlsym(lib->dylib, "tpp_command");
|
||||
#endif
|
||||
|
||||
if (lib->init == NULL || lib->start == NULL || lib->stop == NULL || lib->timer == NULL || lib->set_cfg == NULL || lib->command == NULL)
|
||||
if (
|
||||
lib->init == NULL
|
||||
|| lib->start == NULL
|
||||
|| lib->stop == NULL
|
||||
|| lib->timer == NULL
|
||||
//|| lib->set_cfg == NULL
|
||||
|| lib->command == NULL
|
||||
)
|
||||
{
|
||||
EXLOGE(L"[core] load dylib `%ls` failed, can not locate all functions.\n", libfile.c_str());
|
||||
delete lib;
|
||||
|
@ -109,17 +116,17 @@ void TppManager::timer(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void TppManager::set_config(int noop_timeout) {
|
||||
|
||||
TPP_SET_CFG_ARGS args;
|
||||
args.noop_timeout = noop_timeout;
|
||||
|
||||
tpp_libs::iterator it = m_libs.begin();
|
||||
for (; it != m_libs.end(); ++it)
|
||||
{
|
||||
(*it)->set_cfg(&args);
|
||||
}
|
||||
}
|
||||
// void TppManager::set_config(int noop_timeout) {
|
||||
//
|
||||
// TPP_SET_CFG_ARGS args;
|
||||
// args.noop_timeout = noop_timeout;
|
||||
//
|
||||
// tpp_libs::iterator it = m_libs.begin();
|
||||
// for (; it != m_libs.end(); ++it)
|
||||
// {
|
||||
// (*it)->set_cfg(&args);
|
||||
// }
|
||||
// }
|
||||
|
||||
void TppManager::set_runtime_config(const ex_astr& sp) {
|
||||
tpp_libs::iterator it = m_libs.begin();
|
||||
|
|
|
@ -24,7 +24,7 @@ typedef struct TPP_LIB
|
|||
TPP_START_FUNC start;
|
||||
TPP_STOP_FUNC stop;
|
||||
TPP_TIMER_FUNC timer;
|
||||
TPP_SET_CFG_FUNC set_cfg;
|
||||
// TPP_SET_CFG_FUNC set_cfg;
|
||||
|
||||
TPP_COMMAND_FUNC command;
|
||||
}TPP_LIB;
|
||||
|
|
|
@ -478,17 +478,15 @@ void TsHttpRpc::_rpc_func_set_config(const Json::Value& json_param, ex_astr& buf
|
|||
return;
|
||||
}
|
||||
|
||||
// int noop_timeout = json_param["noop_timeout"].asUInt();
|
||||
// if (noop_timeout == 0) {
|
||||
// _create_json_ret(buf, TPE_PARAM);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// //static TppManager g_tpp_mgr;
|
||||
// EXLOGV("[core] no-op timeout set to %d minutes.\n", noop_timeout);
|
||||
// g_tpp_mgr.set_config(noop_timeout * 60); // 内部按秒计,因此要 *60
|
||||
int noop_timeout = json_param["noop_timeout"].asUInt();
|
||||
if (noop_timeout == 0) {
|
||||
_create_json_ret(buf, TPE_PARAM);
|
||||
return;
|
||||
}
|
||||
|
||||
EXLOGV("[core] set run-time config:\n");
|
||||
EXLOGV("[core] noop_timeout = %dm\n", noop_timeout);
|
||||
|
||||
EXLOGV("[core] set run-time config.\n");
|
||||
ex_astr sp = json_param.toStyledString();
|
||||
g_tpp_mgr.set_runtime_config(sp);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __TS_SERVER_VER_H__
|
||||
#define __TS_SERVER_VER_H__
|
||||
|
||||
#define TP_SERVER_VER L"3.0.0.5"
|
||||
|
||||
#endif // __TS_SERVER_VER_H__
|
||||
#ifndef __TS_SERVER_VER_H__
|
||||
#define __TS_SERVER_VER_H__
|
||||
|
||||
#define TP_SERVER_VER L"3.0.1.6"
|
||||
|
||||
#endif // __TS_SERVER_VER_H__
|
||||
|
|
|
@ -83,14 +83,14 @@ void SshProxy::timer() {
|
|||
}
|
||||
}
|
||||
|
||||
void SshProxy::set_cfg(TPP_SET_CFG_ARGS* args) {
|
||||
m_noop_timeout_sec = args->noop_timeout;
|
||||
void SshProxy::set_cfg(ex_u32 noop_timeout) {
|
||||
m_noop_timeout_sec = noop_timeout;
|
||||
}
|
||||
|
||||
void SshProxy::kill_sessions(const ex_astrs& sessions) {
|
||||
ExThreadSmartLock locker(m_lock);
|
||||
ts_ssh_sessions::iterator it;
|
||||
for (it = m_sessions.begin(); it != m_sessions.end(); ++it) {
|
||||
ts_ssh_sessions::iterator it = m_sessions.begin();
|
||||
for (; it != m_sessions.end(); ++it) {
|
||||
for (size_t i = 0; i < sessions.size(); ++i) {
|
||||
if (it->first->sid() == sessions[i]) {
|
||||
EXLOGW("[ssh] try to kill %s\n", sessions[i].c_str());
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
|
||||
bool init();
|
||||
void timer();
|
||||
void set_cfg(TPP_SET_CFG_ARGS* args);
|
||||
void set_cfg(ex_u32 noop_timeout);
|
||||
void kill_sessions(const ex_astrs& sessions);
|
||||
|
||||
void session_finished(SshSession* sess);
|
||||
|
|
|
@ -41,8 +41,30 @@ TPP_API void tpp_timer(void) {
|
|||
g_ssh_proxy.timer();
|
||||
}
|
||||
|
||||
TPP_API void tpp_set_cfg(TPP_SET_CFG_ARGS* cfg_args) {
|
||||
g_ssh_proxy.set_cfg(cfg_args);
|
||||
// TPP_API void tpp_set_cfg(TPP_SET_CFG_ARGS* cfg_args) {
|
||||
// //g_ssh_proxy.set_cfg(cfg_args);
|
||||
// }
|
||||
|
||||
static ex_rv _set_runtime_config(const char* param) {
|
||||
Json::Value jp;
|
||||
Json::Reader jreader;
|
||||
|
||||
if (!jreader.parse(param, jp))
|
||||
return TPE_JSON_FORMAT;
|
||||
|
||||
if (!jp.isObject())
|
||||
return TPE_PARAM;
|
||||
|
||||
if (jp["noop_timeout"].isNull() || !jp["noop_timeout"].isUInt())
|
||||
return TPE_PARAM;
|
||||
|
||||
ex_u32 noop_timeout = jp["noop_timeout"].asUInt();
|
||||
if (noop_timeout == 0)
|
||||
return TPE_PARAM;
|
||||
|
||||
g_ssh_proxy.set_cfg(noop_timeout * 60);
|
||||
|
||||
return TPE_PARAM;
|
||||
}
|
||||
|
||||
static ex_rv _kill_sessions(const char* param) {
|
||||
|
@ -73,6 +95,10 @@ static ex_rv _kill_sessions(const char* param) {
|
|||
|
||||
TPP_API ex_rv tpp_command(ex_u32 cmd, const char* param) {
|
||||
switch (cmd) {
|
||||
case TPP_CMD_SET_RUNTIME_CFG:
|
||||
if (param == NULL || strlen(param) == 0)
|
||||
return TPE_PARAM;
|
||||
return _set_runtime_config(param);
|
||||
case TPP_CMD_KILL_SESSIONS:
|
||||
if (param == NULL || strlen(param) == 0)
|
||||
return TPE_PARAM;
|
||||
|
@ -83,6 +109,3 @@ TPP_API ex_rv tpp_command(ex_u32 cmd, const char* param) {
|
|||
|
||||
return TPE_NOT_IMPLEMENT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;TPP_EXPORTS;LIBSSH_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../../../common\teleport;../../../../common\libex\include;../../../../external/jsoncpp/include;../../../../external\libssh-win-static\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../../../../common/teleport;../../../../common/libex/include;../../../../external/jsoncpp/include;../../../../external/libssh-win-static/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -86,7 +86,7 @@
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;TPP_EXPORTS;LIBSSH_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../../../common\teleport;../../../../common\libex\include;../../../../external/jsoncpp/include;../../../../external\libssh-win-static\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../../../../common/teleport;../../../../common/libex/include;../../../../external/jsoncpp/include;../../../../external/libssh-win-static/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
|
|
@ -55,8 +55,21 @@ void TelnetProxy::timer() {
|
|||
}
|
||||
}
|
||||
|
||||
void TelnetProxy::set_cfg(TPP_SET_CFG_ARGS* args) {
|
||||
m_noop_timeout_sec = args->noop_timeout;
|
||||
void TelnetProxy::set_cfg(ex_u32 noop_timeout) {
|
||||
m_noop_timeout_sec = noop_timeout;
|
||||
}
|
||||
|
||||
void TelnetProxy::kill_sessions(const ex_astrs& sessions) {
|
||||
ExThreadSmartLock locker(m_lock);
|
||||
ts_telnet_sessions::iterator it = m_sessions.begin();
|
||||
for (; it != m_sessions.end(); ++it) {
|
||||
for (size_t i = 0; i < sessions.size(); ++i) {
|
||||
if (it->first->sid() == sessions[i]) {
|
||||
EXLOGW("[telnet] try to kill %s\n", sessions[i].c_str());
|
||||
it->first->check_noop_timeout(0, 0); // Á¢¼´½áÊø
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TelnetProxy::_thread_loop(void)
|
||||
|
|
|
@ -16,7 +16,8 @@ public:
|
|||
|
||||
bool init();
|
||||
void timer();
|
||||
void set_cfg(TPP_SET_CFG_ARGS* args);
|
||||
void set_cfg(ex_u32 noop_timeout);
|
||||
void kill_sessions(const ex_astrs& sessions);
|
||||
|
||||
uv_loop_t* get_loop() { return &m_loop; }
|
||||
|
||||
|
|
|
@ -56,10 +56,12 @@ void TelnetSession::save_record() {
|
|||
}
|
||||
|
||||
void TelnetSession::check_noop_timeout(ex_u32 t_now, ex_u32 timeout) {
|
||||
if (t_now - m_last_access_timestamp > timeout) {
|
||||
EXLOGW("[telnet] need close session by timeout.\n");
|
||||
if (t_now == 0)
|
||||
EXLOGW("[telnet] try close session by kill.\n");
|
||||
else if (t_now - m_last_access_timestamp > timeout)
|
||||
EXLOGW("[telnet] try close session by timeout.\n");
|
||||
if (t_now == 0 || t_now - m_last_access_timestamp > timeout)
|
||||
_do_close(TP_SESS_STAT_END);
|
||||
}
|
||||
}
|
||||
|
||||
void TelnetSession::_session_error(int err_code) {
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
}
|
||||
//
|
||||
void check_noop_timeout(ex_u32 t_now, ex_u32 timeout);
|
||||
const ex_astr& sid() { return m_sid; }
|
||||
|
||||
void client_addr(const char* addr) { m_client_addr = addr; }
|
||||
const char* client_addr() const { return m_client_addr.c_str(); }
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "telnet_proxy.h"
|
||||
#include "tpp_env.h"
|
||||
|
||||
#include <teleport_const.h>
|
||||
#include <json/json.h>
|
||||
|
||||
TPP_API ex_rv tpp_init(TPP_INIT_ARGS* init_args)
|
||||
{
|
||||
|
@ -32,6 +34,72 @@ TPP_API void tpp_timer(void) {
|
|||
}
|
||||
|
||||
|
||||
TPP_API void tpp_set_cfg(TPP_SET_CFG_ARGS* cfg_args) {
|
||||
g_telnet_proxy.set_cfg(cfg_args);
|
||||
// TPP_API void tpp_set_cfg(TPP_SET_CFG_ARGS* cfg_args) {
|
||||
// g_telnet_proxy.set_cfg(cfg_args);
|
||||
// }
|
||||
|
||||
|
||||
static ex_rv _set_runtime_config(const char* param) {
|
||||
Json::Value jp;
|
||||
Json::Reader jreader;
|
||||
|
||||
if (!jreader.parse(param, jp))
|
||||
return TPE_JSON_FORMAT;
|
||||
|
||||
if (!jp.isObject())
|
||||
return TPE_PARAM;
|
||||
|
||||
if (jp["noop_timeout"].isNull() || !jp["noop_timeout"].isUInt())
|
||||
return TPE_PARAM;
|
||||
|
||||
ex_u32 noop_timeout = jp["noop_timeout"].asUInt();
|
||||
if (noop_timeout == 0)
|
||||
return TPE_PARAM;
|
||||
|
||||
g_telnet_proxy.set_cfg(noop_timeout * 60);
|
||||
|
||||
return TPE_PARAM;
|
||||
}
|
||||
|
||||
static ex_rv _kill_sessions(const char* param) {
|
||||
Json::Value jp;
|
||||
Json::Reader jreader;
|
||||
|
||||
if (!jreader.parse(param, jp))
|
||||
return TPE_JSON_FORMAT;
|
||||
|
||||
if (!jp.isArray())
|
||||
return TPE_PARAM;
|
||||
|
||||
ex_astrs ss;
|
||||
int cnt = jp.size();
|
||||
for (int i = 0; i < cnt; ++i)
|
||||
{
|
||||
if (!jp[i].isString()) {
|
||||
return TPE_PARAM;
|
||||
}
|
||||
|
||||
ss.push_back(jp[i].asString());
|
||||
}
|
||||
|
||||
g_telnet_proxy.kill_sessions(ss);
|
||||
|
||||
return TPE_PARAM;
|
||||
}
|
||||
|
||||
TPP_API ex_rv tpp_command(ex_u32 cmd, const char* param) {
|
||||
switch (cmd) {
|
||||
case TPP_CMD_SET_RUNTIME_CFG:
|
||||
if (param == NULL || strlen(param) == 0)
|
||||
return TPE_PARAM;
|
||||
return _set_runtime_config(param);
|
||||
case TPP_CMD_KILL_SESSIONS:
|
||||
if (param == NULL || strlen(param) == 0)
|
||||
return TPE_PARAM;
|
||||
return _kill_sessions(param);
|
||||
default:
|
||||
return TPE_UNKNOWN_CMD;
|
||||
}
|
||||
|
||||
return TPE_NOT_IMPLEMENT;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;TPP_EXPORTS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\common\teleport;..\..\..\..\common\libex\include;..\..\..\..\external\mbedtls\include;..\..\..\..\external\libuv\include;..\..\..\..\external\libuv\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../../../../common/teleport;../../../../common/libex/include;../../../../external/jsoncpp/include;../../../../external/mbedtls/include;../../../../external/libuv/include;../../../../external/libuv/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -78,7 +78,7 @@
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;TPP_EXPORTS;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\common\teleport;..\..\..\..\common\libex\include;..\..\..\..\external\mbedtls\include;..\..\..\..\external\libuv\include;..\..\..\..\external\libuv\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../../../../common/teleport;../../../../common/libex/include;../../../../external/jsoncpp/include;../../../../external/mbedtls/include;../../../../external/libuv/include;../../../../external/libuv/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
@ -102,6 +102,7 @@
|
|||
<ClInclude Include="..\..\..\..\common\libex\include\ex\ex_util.h" />
|
||||
<ClInclude Include="..\..\..\..\common\libex\include\ex\ex_winsrv.h" />
|
||||
<ClInclude Include="..\..\..\..\common\teleport\teleport_const.h" />
|
||||
<ClInclude Include="..\..\..\..\external\jsoncpp\include\json\json.h" />
|
||||
<ClInclude Include="..\..\..\..\external\libuv\include\tree.h" />
|
||||
<ClInclude Include="..\..\..\..\external\libuv\include\uv-errno.h" />
|
||||
<ClInclude Include="..\..\..\..\external\libuv\include\uv-threadpool.h" />
|
||||
|
@ -135,6 +136,9 @@
|
|||
<ClCompile Include="..\..\..\..\common\libex\src\ex_thread.cpp" />
|
||||
<ClCompile Include="..\..\..\..\common\libex\src\ex_util.cpp" />
|
||||
<ClCompile Include="..\..\..\..\common\libex\src\ex_winsrv.cpp" />
|
||||
<ClCompile Include="..\..\..\..\external\jsoncpp\src\lib_json\json_reader.cpp" />
|
||||
<ClCompile Include="..\..\..\..\external\jsoncpp\src\lib_json\json_value.cpp" />
|
||||
<ClCompile Include="..\..\..\..\external\jsoncpp\src\lib_json\json_writer.cpp" />
|
||||
<ClCompile Include="..\..\..\..\external\libuv\src\fs-poll.c" />
|
||||
<ClCompile Include="..\..\..\..\external\libuv\src\inet.c" />
|
||||
<ClCompile Include="..\..\..\..\external\libuv\src\threadpool.c" />
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
<Filter Include="libuv\src\win">
|
||||
<UniqueIdentifier>{89181d75-3db3-45a5-a35d-9083fb349de3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="jsoncpp">
|
||||
<UniqueIdentifier>{fae1b562-5e3f-4b9b-9a5d-41bb15ae2223}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\common\libex\include\ex\ex_const.h">
|
||||
|
@ -146,6 +149,9 @@
|
|||
<ClInclude Include="..\..\..\..\common\teleport\teleport_const.h">
|
||||
<Filter>common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\external\jsoncpp\include\json\json.h">
|
||||
<Filter>jsoncpp</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="tptelnet.cpp">
|
||||
|
@ -301,5 +307,14 @@
|
|||
<ClCompile Include="..\..\..\..\external\libuv\src\win\process-stdio.c">
|
||||
<Filter>libuv\src\win</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\external\jsoncpp\src\lib_json\json_writer.cpp">
|
||||
<Filter>jsoncpp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\external\jsoncpp\src\lib_json\json_reader.cpp">
|
||||
<Filter>jsoncpp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\external\jsoncpp\src\lib_json\json_value.cpp">
|
||||
<Filter>jsoncpp</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
File diff suppressed because one or more lines are too long
|
@ -221,28 +221,46 @@ $app.on_table_host_render_created = function (render) {
|
|||
act_btn.push('</li>');
|
||||
} else {
|
||||
if (acc.protocol_type === TP_PROTOCOL_TYPE_RDP) {
|
||||
if ((acc.policy_.flag_rdp & TP_FLAG_RDP_DESKTOP) !== 0) {
|
||||
act_btn.push('<div class="btn-group btn-group-sm">');
|
||||
act_btn.push('<button type="button" class="btn btn-primary" data-action="rdp" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_RDP_DESKTOP + '"><i class="fa fa-desktop fa-fw"></i> RDP</button>');
|
||||
act_btn.push('<a href="javascript:;" class="btn btn-primary dropdown-toggle" data-action="rdp-option" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_RDP_DESKTOP + '">');
|
||||
act_btn.push('<i class="fa fa-cog"></i>');
|
||||
act_btn.push('</a>');
|
||||
act_btn.push('</div>');
|
||||
if (!$app.options.core_cfg.rdp.enable) {
|
||||
act_btn.push('<li class="remote-action-state state-disabled">');
|
||||
act_btn.push('<i class="fa fa-ban fa-fw"></i> RDP协议未启用');
|
||||
act_btn.push('</li>');
|
||||
} else {
|
||||
if ((acc.policy_.flag_rdp & TP_FLAG_RDP_DESKTOP) !== 0) {
|
||||
act_btn.push('<div class="btn-group btn-group-sm">');
|
||||
act_btn.push('<button type="button" class="btn btn-primary" data-action="rdp" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_RDP_DESKTOP + '"><i class="fa fa-desktop fa-fw"></i> RDP</button>');
|
||||
act_btn.push('<a href="javascript:;" class="btn btn-primary dropdown-toggle" data-action="rdp-option" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_RDP_DESKTOP + '">');
|
||||
act_btn.push('<i class="fa fa-cog"></i>');
|
||||
act_btn.push('</a>');
|
||||
act_btn.push('</div>');
|
||||
}
|
||||
}
|
||||
} else if (acc.protocol_type === TP_PROTOCOL_TYPE_SSH) {
|
||||
act_btn.push('<div class="btn-group btn-group-sm">');
|
||||
if ((acc.policy_.flag_ssh & TP_FLAG_SSH_SHELL) !== 0) {
|
||||
act_btn.push('<button type="button" class="btn btn-success" data-action="ssh" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_SSH_SHELL + '"><i class="far fa-keyboard fa-fw"></i> SSH</button>');
|
||||
}
|
||||
if (!$app.options.core_cfg.ssh.enable) {
|
||||
act_btn.push('<li class="remote-action-state state-disabled">');
|
||||
act_btn.push('<i class="fa fa-ban fa-fw"></i> SSH协议未启用');
|
||||
act_btn.push('</li>');
|
||||
} else {
|
||||
act_btn.push('<div class="btn-group btn-group-sm">');
|
||||
if ((acc.policy_.flag_ssh & TP_FLAG_SSH_SHELL) !== 0) {
|
||||
act_btn.push('<button type="button" class="btn btn-success" data-action="ssh" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_SSH_SHELL + '"><i class="far fa-keyboard fa-fw"></i> SSH</button>');
|
||||
}
|
||||
|
||||
if ((acc.policy_.flag_ssh & TP_FLAG_SSH_SFTP) !== 0) {
|
||||
act_btn.push('<button type="button" class="btn btn-info" data-action="ssh" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_SSH_SFTP + '"><i class="fa fa-upload fa-fw"></i> SFTP</button>');
|
||||
if ((acc.policy_.flag_ssh & TP_FLAG_SSH_SFTP) !== 0) {
|
||||
act_btn.push('<button type="button" class="btn btn-info" data-action="ssh" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_SSH_SFTP + '"><i class="fa fa-upload fa-fw"></i> SFTP</button>');
|
||||
}
|
||||
act_btn.push('</div>');
|
||||
}
|
||||
act_btn.push('</div>');
|
||||
} else if (acc.protocol_type === TP_PROTOCOL_TYPE_TELNET) {
|
||||
act_btn.push('<div class="btn-group btn-group-sm">');
|
||||
act_btn.push('<button type="button" class="btn btn-warning" data-action="telnet" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_TELNET_SHELL + '"><i class="far fa-keyboard fa-fw"></i> TELNET</button>');
|
||||
act_btn.push('</div>');
|
||||
if (!$app.options.core_cfg.telnet.enable) {
|
||||
act_btn.push('<li class="remote-action-state state-disabled">');
|
||||
act_btn.push('<i class="fa fa-ban fa-fw"></i> TELNET协议未启用');
|
||||
act_btn.push('</li>');
|
||||
} else {
|
||||
act_btn.push('<div class="btn-group btn-group-sm">');
|
||||
act_btn.push('<button type="button" class="btn btn-warning" data-action="telnet" data-id="' + acc.uni_id + '" data-acc-id="' + acc.a_id + '" data-host-id="' + acc.h_id + '" data-sub-protocol="' + TP_PROTOCOL_TYPE_TELNET_SHELL + '"><i class="far fa-keyboard fa-fw"></i> TELNET</button>');
|
||||
act_btn.push('</div>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,7 +424,7 @@ $app.connect_remote = function (uni_id, acc_id, host_id, protocol_type, protocol
|
|||
|
||||
console.log('--s--', args);
|
||||
|
||||
if(uni_id === 'none')
|
||||
if (uni_id === 'none')
|
||||
args.mode = 2;
|
||||
|
||||
$assist.do_teleport(
|
||||
|
|
|
@ -412,8 +412,14 @@ $app.on_btn_kill_sessions_click = function () {
|
|||
$tp.ajax_post_json('/ops/kill', {sessions: sessions},
|
||||
function (ret) {
|
||||
if (ret.code === TPE_OK) {
|
||||
$app.table_session.load_data();
|
||||
$tp.notify_success('强行终止会话操作成功!');
|
||||
setTimeout(function () {
|
||||
var _cb = CALLBACK_STACK.create();
|
||||
_cb.add($app.check_host_all_selected)
|
||||
.add($app.table_session.load_data)
|
||||
.exec();
|
||||
|
||||
$tp.notify_success('强行终止会话操作成功!');
|
||||
}, 1500);
|
||||
} else {
|
||||
$tp.notify_error('强行终止会话失败:' + tp_error_msg(ret.code, ret.message));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
$app.on_init = function (cb_stack) {
|
||||
console.log($app.options);
|
||||
//console.log($app.options);
|
||||
|
||||
$app.dlg_result = $app.create_dlg_result();
|
||||
// cb_stack.add($app.dlg_result.init);
|
||||
|
|
|
@ -21,142 +21,144 @@
|
|||
// height: 28px;
|
||||
// margin: 0;
|
||||
// padding: 0;
|
||||
//
|
||||
// & > li {
|
||||
// float: left;
|
||||
// position: relative;
|
||||
// display: block;
|
||||
// height: 28px;
|
||||
// padding: 4px 5px;
|
||||
//
|
||||
// background-color: #eee;
|
||||
// border-top: 1px solid #ccc;
|
||||
// border-right: 1px solid #ccc;
|
||||
// border-bottom: 1px solid #ccc;
|
||||
//
|
||||
// &.remote-action-btn {
|
||||
// background: none;
|
||||
// padding: 0;
|
||||
// border: none;
|
||||
// }
|
||||
//
|
||||
// &.remote-action-input {
|
||||
// background: none;
|
||||
// padding: 4px 0;
|
||||
//
|
||||
// select {
|
||||
// border: none;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// &.remote-action-chk-protocol {
|
||||
// width: 86px;
|
||||
// }
|
||||
//
|
||||
// &.remote-action-state {
|
||||
// //width: 64px;
|
||||
// text-align: center;
|
||||
// white-space: nowrap;
|
||||
//
|
||||
// &.state-disabled {
|
||||
// background-color: @color-bg-ignore;
|
||||
// color: #aaa;
|
||||
// text-shadow: -1px -1px 1px #fff;
|
||||
//
|
||||
// & > i.fa {
|
||||
// color: #b53a2f;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// &.remote-action-username, &.remote-action-name, &.remote-action-protocol {
|
||||
// width: 96px;
|
||||
// text-align: center;
|
||||
// white-space: nowrap;
|
||||
// overflow: hidden;
|
||||
// text-overflow: ellipsis;
|
||||
// }
|
||||
// &.remote-action-username {
|
||||
// font-size: 90%;
|
||||
// color: #999;
|
||||
// }
|
||||
// &.remote-action-name, &.remote-action-protocol, &.remote-action-chk-protocol {
|
||||
// color: #000;
|
||||
// }
|
||||
// &.remote-action-name, &.remote-action-chk-protocol {
|
||||
// font-weight: bold;
|
||||
// }
|
||||
//
|
||||
// &.remote-action-password, &.remote-action-sshkey, &.remote-action-noauth {
|
||||
// text-align: center;
|
||||
// padding: 4px 8px;
|
||||
// width: 45px;
|
||||
// }
|
||||
// &.remote-action-password {
|
||||
// background-color: #e3ffe3;
|
||||
// color: #999;
|
||||
// }
|
||||
// &.remote-action-sshkey {
|
||||
// background-color: #fbe9c8;
|
||||
// color: #666;
|
||||
// }
|
||||
// &.remote-action-noauth {
|
||||
// background-color: #e0e0e0;
|
||||
// color: #666;
|
||||
// }
|
||||
//
|
||||
// & > .btn {
|
||||
// line-height: 1.5;
|
||||
// margin: 0;
|
||||
// padding: 4px 8px;
|
||||
// font-size: 12px;
|
||||
// border-radius: 0;
|
||||
// }
|
||||
//
|
||||
// label {
|
||||
// padding: 0;
|
||||
// display: block;
|
||||
// float: left;
|
||||
// margin-top: 1px;
|
||||
// cursor: pointer;
|
||||
// }
|
||||
// input[type=checkbox] {
|
||||
// display: block;
|
||||
// float: left;
|
||||
// margin: 3px 5px 0 0;
|
||||
// }
|
||||
// select {
|
||||
// margin-top: -3px;
|
||||
// }
|
||||
//
|
||||
// &:first-child {
|
||||
// border-left: 1px solid #ccc;
|
||||
// border-top-left-radius: 4px;
|
||||
// border-bottom-left-radius: 4px;
|
||||
// }
|
||||
//
|
||||
// &.remote-action-btn:first-child {
|
||||
// border: none;
|
||||
// .btn {
|
||||
// border-top-left-radius: 4px;
|
||||
// border-bottom-left-radius: 4px;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// &:last-child {
|
||||
// border-top-right-radius: 4px;
|
||||
// border-bottom-right-radius: 4px;
|
||||
// }
|
||||
//
|
||||
// &.remote-action-btn:last-child {
|
||||
// border: none;
|
||||
// .btn {
|
||||
// border-top-right-radius: 4px;
|
||||
// border-bottom-right-radius: 4px;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
& > li {
|
||||
float: left;
|
||||
position: relative;
|
||||
display: block;
|
||||
height: 28px;
|
||||
padding: 4px 5px;
|
||||
|
||||
background-color: #eee;
|
||||
border-top: 1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
|
||||
font-size: 12px;
|
||||
|
||||
//&.remote-action-btn {
|
||||
// background: none;
|
||||
// padding: 0;
|
||||
// border: none;
|
||||
//}
|
||||
//
|
||||
//&.remote-action-input {
|
||||
// background: none;
|
||||
// padding: 4px 0;
|
||||
//
|
||||
// select {
|
||||
// border: none;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//&.remote-action-chk-protocol {
|
||||
// width: 86px;
|
||||
//}
|
||||
|
||||
&.remote-action-state {
|
||||
//width: 64px;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
|
||||
&.state-disabled {
|
||||
background-color: @color-bg-ignore;
|
||||
color: #aaa;
|
||||
text-shadow: -1px -1px 1px #fff;
|
||||
|
||||
& > i.fa {
|
||||
color: #b53a2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//&.remote-action-username, &.remote-action-name, &.remote-action-protocol {
|
||||
// width: 96px;
|
||||
// text-align: center;
|
||||
// white-space: nowrap;
|
||||
// overflow: hidden;
|
||||
// text-overflow: ellipsis;
|
||||
//}
|
||||
//&.remote-action-username {
|
||||
// font-size: 90%;
|
||||
// color: #999;
|
||||
//}
|
||||
//&.remote-action-name, &.remote-action-protocol, &.remote-action-chk-protocol {
|
||||
// color: #000;
|
||||
//}
|
||||
//&.remote-action-name, &.remote-action-chk-protocol {
|
||||
// font-weight: bold;
|
||||
//}
|
||||
//
|
||||
//&.remote-action-password, &.remote-action-sshkey, &.remote-action-noauth {
|
||||
// text-align: center;
|
||||
// padding: 4px 8px;
|
||||
// width: 45px;
|
||||
//}
|
||||
//&.remote-action-password {
|
||||
// background-color: #e3ffe3;
|
||||
// color: #999;
|
||||
//}
|
||||
//&.remote-action-sshkey {
|
||||
// background-color: #fbe9c8;
|
||||
// color: #666;
|
||||
//}
|
||||
//&.remote-action-noauth {
|
||||
// background-color: #e0e0e0;
|
||||
// color: #666;
|
||||
//}
|
||||
//
|
||||
//& > .btn {
|
||||
// line-height: 1.5;
|
||||
// margin: 0;
|
||||
// padding: 4px 8px;
|
||||
// font-size: 12px;
|
||||
// border-radius: 0;
|
||||
//}
|
||||
//
|
||||
//label {
|
||||
// padding: 0;
|
||||
// display: block;
|
||||
// float: left;
|
||||
// margin-top: 1px;
|
||||
// cursor: pointer;
|
||||
//}
|
||||
//input[type=checkbox] {
|
||||
// display: block;
|
||||
// float: left;
|
||||
// margin: 3px 5px 0 0;
|
||||
//}
|
||||
//select {
|
||||
// margin-top: -3px;
|
||||
//}
|
||||
//
|
||||
&:first-child {
|
||||
border-left: 1px solid #ccc;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
//
|
||||
//&.remote-action-btn:first-child {
|
||||
// border: none;
|
||||
// .btn {
|
||||
// border-top-left-radius: 4px;
|
||||
// border-bottom-left-radius: 4px;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
&:last-child {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
//
|
||||
//&.remote-action-btn:last-child {
|
||||
// border: none;
|
||||
// .btn {
|
||||
// border-top-right-radius: 4px;
|
||||
// border-bottom-right-radius: 4px;
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
|
@ -249,7 +251,7 @@
|
|||
|
||||
.radio, .checkbox {
|
||||
// overwrite bootstrap.
|
||||
margin:0;
|
||||
margin: 0;
|
||||
font-family: @font-family-mono;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
## <script type="text/javascript" src="${ static_url('js/tp-assist.js') }"></script>
|
||||
<script type="text/javascript" src="${ static_url('js/ops/remote-list.js') }"></script>
|
||||
</%block>
|
||||
<%block name="embed_js">
|
||||
<script type="text/javascript">
|
||||
$app.add_options(${page_param});
|
||||
</script>
|
||||
</%block>
|
||||
|
||||
<%block name="embed_css">
|
||||
<style>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# -*- coding: utf8 -*-
|
||||
TP_SERVER_VER = "3.0.0.5"
|
||||
# -*- coding: utf8 -*-
|
||||
TP_SERVER_VER = "3.0.1.6"
|
||||
|
|
|
@ -34,7 +34,10 @@ class RemoteHandler(TPBaseHandler):
|
|||
ret = self.check_privilege(TP_PRIVILEGE_OPS)
|
||||
if ret != TPE_OK:
|
||||
return
|
||||
self.render('ops/remote-list.mako')
|
||||
param = {
|
||||
'core_cfg': tp_cfg().core
|
||||
}
|
||||
self.render('ops/remote-list.mako', page_param=json.dumps(param))
|
||||
|
||||
|
||||
class PolicyDetailHandler(TPBaseHandler):
|
||||
|
|
|
@ -13,7 +13,7 @@ Revision : 修订号。主版本号和次版本号都相同但修订号不同
|
|||
Build : 构建号。构建号用于表明此版本发布之前进行了多少次构建及测试。某些情况下此版本号可以省略。
|
||||
|
||||
|
||||
TP_SERVER 3.0.0.5 # 整个服务端打包的版本
|
||||
TP_TPCORE 3.0.0.5 # 核心服务 tp_core 的版本
|
||||
TP_SERVER 3.0.1.6 # 整个服务端打包的版本
|
||||
TP_TPCORE 3.0.1.6 # 核心服务 tp_core 的版本
|
||||
TP_TPWEB 3.0.0.1 # web服务 tp_web 的版本(一般除非升级Python,否则不会变化)
|
||||
TP_ASSIST 3.0.0.5 # 助手版本
|
||||
|
|
Loading…
Reference in New Issue