mirror of https://github.com/tp4a/teleport
解决助手在某些情况下无法启动HTTPS服务的问题,重新颁发针对127.0.0.1的IP证书,助手版本号升级到3.2.2.
parent
951af98f51
commit
cad9beb31f
|
@ -1,3 +1,3 @@
|
|||
# -*- coding: utf8 -*-
|
||||
VER_TP_SERVER = "3.2.2"
|
||||
VER_TP_ASSIST = "3.2.0"
|
||||
VER_TP_ASSIST = "3.2.2"
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDxI1ZDRvuNnkVB
|
||||
JgTZmnwF97d7Ace+R0gSSkWi2l2oezakLSdUUkiysr1wx45u2Du36FNqMGg7LiCZ
|
||||
SX1e2Zba96PI6vwNGnlprCfXTe2eV3W8kMPKA6c9X8BTktMZINNHO3K591jGx+uM
|
||||
fyrl6/CFVPHNkl73Ium9u91JXIX9BOata4RTlphmHADc+hPXuC6oeN8qayZvV2rV
|
||||
Jfx1wMlWCMiGJM36JJO5pywteBCKQkVJuJ7y29XF2wT690o+i6ugk+yI2/2OpiET
|
||||
2E5SYdvyhlbcU+iBERsnY3X7IvFY8/m00YIjIc3reGSEwt9M5WTPRCjgonnpQGAx
|
||||
9xWXwqkzAgMBAAECggEAT9b2YdInye0EWxy+cFoBBGzPeE/PlcW+LCghRFlutzEM
|
||||
l3FH21hfL6OUq7m3BCZeJ3cp3zfl2upb6sT1WKlMlHV36jc7ew8v8fgJPPVVXp7w
|
||||
oZ2A5estvVltsX4knOZMbgJV6xLldvOMnvkf9/6VpV/Jq9nxzXvmzmZcT0TuLCaF
|
||||
uPk/g/yD5qQ8LkWXDVJeBiDrrOZYo5F+T8bveYKKIEZV0ZAlXwJqVOUFnhffIaDF
|
||||
fZVDOv4K3+q0aRDLTY2hxptHZiKzpLXgU634nBN3fiy0Fj88upNIus22gjaz+Jfx
|
||||
2pYv22iGNXAMFQwGaeuT7d4+qhgxze8C7YlLJ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0Kc15q8gxvQ3kePwaBY
|
||||
11f1FJ8iDMqxX7Hmb3KT0FeWKmUPgH3YtlitSAD7DrqMxBh5sr/28zN8XIjWWhY1
|
||||
huv7APQbuicxl/YZumPKa3r8FI1ca4pn4TKsm+YMN6Buy6k9CQV6POtNmawLNgNP
|
||||
axErEeTzNsis1JalHFAdr6mPWY0xaZsdrMeJHMx/7lvM7Qo+odEyswguoCS8Bc1Y
|
||||
6ZlEYZUev7lN0amqnoh25KrrGqpyHCXtXAEEwVyTmdpYDtqsetDYv7aCrfeITPBm
|
||||
GAyD
|
||||
-----END CERTIFICATE-----
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
<div class="footer">
|
||||
<div class="container">
|
||||
<p><a href="https://tp4a.com/" target="_blank">TELEPORT</a> | ©2015 - 2018,保留所有权利。</p>
|
||||
<p><a href="https://tp4a.com/" target="_blank">TELEPORT</a> | ©2015 - 2019,保留所有权利。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
<!DOCTYPE html>
|
||||
<!--[if IE 8]>
|
||||
<html lang="en" class="ie8"><![endif]-->
|
||||
<!--[if !IE]><!-->
|
||||
<html lang="zh_CN">
|
||||
<!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>TELEPORT助手</title>
|
||||
<link rel="shortcut icon" href="favicon.png">
|
||||
|
||||
<link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style type="text/css">
|
||||
.info-box {
|
||||
padding:20px;
|
||||
margin:40px;
|
||||
border:1px solid #78b17c;
|
||||
background-color:#e4ffe5;
|
||||
font-size: 140%;
|
||||
}
|
||||
.warning-box {
|
||||
padding:20px;
|
||||
margin:40px;
|
||||
border:1px solid #eac781;
|
||||
background-color: #f9f5d7;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<div class="container">
|
||||
<span class="title"><i class="fa fa-cog fa-fw"></i> Teleport 助手</span>
|
||||
<span class="sub-title" id="version"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-fix"></div>
|
||||
|
||||
<div class="footer">
|
||||
<div class="container">
|
||||
<p><a href="https://tp4a.com/" target="_blank">TELEPORT</a> | ©2015 - 2019,保留所有权利。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="info-box">
|
||||
Teleport助手工作正常!
|
||||
</div>
|
||||
|
||||
<div class="warning-box">
|
||||
<p>如果在使用 HTTPS 方式访问 teleport 的 web 服务时检测不到助手,请<a href="https://127.0.0.1:50023" target="_blank">点击这里</a>,查看页面是否能够正常显示。</p>
|
||||
<p>因为助手在配合HTTPS访问时使用了<strong>自签名证书</strong>,而自签名证书的颁发机构的根证书<strong>默认不被浏览器信任</strong>,因此,还<strong>需要将其设置为浏览器信任的根证书</strong>才行,根据浏览器的不同,具体设置方法有两种:</p>
|
||||
<p><strong>Chrome/IE/Edge/Opera 等浏览器</strong></p>
|
||||
<ol>
|
||||
<li>在桌面的助手快捷方式上点击右键,然后选择“打开文件所在的位置”;</li>
|
||||
<li>右键点击 <strong>cacert.cer</strong>,在弹出菜单中选择“安装证书”;</li>
|
||||
<li>在打开的“证书导入向导”对话框中选择“当前用户”,点击下一步;</li>
|
||||
<li>选择“将所有的证书都放入下列存储”,然后点击“浏览”按钮;</li>
|
||||
<li>在打开的“选择证书存储”对话框中选择<strong>“受信任的根证书颁发机构”</strong>,点击确定;</li>
|
||||
<li>点击“下一步”,然后点击“完成”;</li>
|
||||
<li>系统提示“导入成功”,大功告成。</li>
|
||||
</ol>
|
||||
|
||||
<p><strong>FireFox火狐浏览器</strong></p>
|
||||
<ol>
|
||||
<li>打开火狐浏览器的选项页面;</li>
|
||||
<li>点击左侧的“隐私与安全”,然后滚动页面到底部,点击“查看证书”按钮;</li>
|
||||
<li>在打开的“证书管理器”对话框中选择“证书颁发机构”选项卡;</li>
|
||||
<li>点击对话框底部的“导入”按钮,然后选择 <strong>cacert.cer</strong> 文件并点击“打开”按钮;</li>
|
||||
<li>在“下载证书”对话框中,勾选“信任由此证书颁发机构来标识网站”,然后点击“确定”;</li>
|
||||
<li>点击“确定”来关闭证书管理器对话框,大功告成。</li>
|
||||
</ol>
|
||||
|
||||
<p><strong>注意:</strong>导入证书后,请再次<a href="https://127.0.0.1:50023" target="_blank">点击这里</a>,查看页面是否能够正常显示。</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -17,11 +17,11 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.2.0</string>
|
||||
<string>3.2.2</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.2.0</string>
|
||||
<string>3.2.2</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.productivity</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
|
|
@ -32,9 +32,9 @@ int http_rpc_start(void* app) {
|
|||
EXLOGE("[ERROR] can not start HTTP-RPC listener, maybe port %d is already in use.\n", TS_HTTP_RPC_PORT);
|
||||
return -1;
|
||||
}
|
||||
|
||||
EXLOGW("[rpc] TeleportAssist-HTTP-RPC ready on localhost:%d\n", TS_HTTP_RPC_PORT);
|
||||
|
||||
|
||||
EXLOGW("[rpc] TeleportAssist-HTTP-RPC ready on 127.0.0.1:%d\n", TS_HTTP_RPC_PORT);
|
||||
|
||||
if(!g_http_interface.start())
|
||||
return -2;
|
||||
|
||||
|
@ -43,9 +43,9 @@ int http_rpc_start(void* app) {
|
|||
EXLOGE("[ERROR] can not start HTTPS-RPC listener, maybe port %d is already in use.\n", TS_HTTPS_RPC_PORT);
|
||||
return -1;
|
||||
}
|
||||
|
||||
EXLOGW("[rpc] TeleportAssist-HTTPS-RPC ready on localhost:%d\n", TS_HTTPS_RPC_PORT);
|
||||
|
||||
|
||||
EXLOGW("[rpc] TeleportAssist-HTTPS-RPC ready on 127.0.0.1:%d\n", TS_HTTPS_RPC_PORT);
|
||||
|
||||
if(!g_https_interface.start())
|
||||
return -2;
|
||||
|
||||
|
@ -107,21 +107,20 @@ TsHttpRpc::~TsHttpRpc()
|
|||
}
|
||||
|
||||
bool TsHttpRpc::init_http()
|
||||
{
|
||||
|
||||
struct mg_connection* nc = nullptr;
|
||||
|
||||
char addr[128] = { 0 };
|
||||
ex_strformat(addr, 128, "tcp://localhost:%d", TS_HTTP_RPC_PORT);
|
||||
|
||||
struct mg_connection* nc = NULL;
|
||||
ex_strformat(addr, 128, "tcp://127.0.0.1:%d", TS_HTTP_RPC_PORT);
|
||||
|
||||
nc = mg_bind(&m_mg_mgr, addr, _mg_event_handler);
|
||||
if (nc == NULL) {
|
||||
EXLOGE("[rpc] TsHttpRpc::init_http() localhost:%d\n", TS_HTTP_RPC_PORT);
|
||||
if (!nc) {
|
||||
EXLOGE("[rpc] TsHttpRpc::init 127.0.0.1:%d\n", TS_HTTP_RPC_PORT);
|
||||
return false;
|
||||
}
|
||||
nc->user_data = this;
|
||||
|
||||
|
||||
mg_set_protocol_http_websocket(nc);
|
||||
|
||||
|
||||
return _on_init();
|
||||
}
|
||||
|
||||
|
@ -135,27 +134,27 @@ bool TsHttpRpc::init_https()
|
|||
ex_wstr2astr(file_ssl_cert, _ssl_cert);
|
||||
ex_astr _ssl_key;
|
||||
ex_wstr2astr(file_ssl_key, _ssl_key);
|
||||
|
||||
|
||||
const char *err = NULL;
|
||||
struct mg_bind_opts bind_opts;
|
||||
memset(&bind_opts, 0, sizeof(bind_opts));
|
||||
bind_opts.ssl_cert = _ssl_cert.c_str();
|
||||
bind_opts.ssl_key = _ssl_key.c_str();
|
||||
bind_opts.error_string = &err;
|
||||
|
||||
|
||||
char addr[128] = { 0 };
|
||||
ex_strformat(addr, 128, "tcp://localhost:%d", TS_HTTPS_RPC_PORT);
|
||||
ex_strformat(addr, 128, "tcp://127.0.0.1:%d", TS_HTTPS_RPC_PORT);
|
||||
|
||||
struct mg_connection* nc = NULL;
|
||||
nc = mg_bind_opt(&m_mg_mgr, addr, _mg_event_handler, bind_opts);
|
||||
if (nc == NULL) {
|
||||
EXLOGE("[rpc] TsHttpRpc::init_https() localhost:%d\n", TS_HTTPS_RPC_PORT);
|
||||
if (!nc) {
|
||||
EXLOGE("[rpc] TsHttpRpc::init 127.0.0.1:%d\n", TS_HTTPS_RPC_PORT);
|
||||
return false;
|
||||
}
|
||||
nc->user_data = this;
|
||||
|
||||
|
||||
mg_set_protocol_http_websocket(nc);
|
||||
|
||||
|
||||
return _on_init();
|
||||
}
|
||||
|
||||
|
@ -182,7 +181,7 @@ void TsHttpRpc::_thread_loop(void)
|
|||
{
|
||||
mg_mgr_poll(&m_mg_mgr, 500);
|
||||
}
|
||||
|
||||
|
||||
EXLOGV("[core] rpc main loop end.\n");
|
||||
}
|
||||
|
||||
|
@ -225,23 +224,25 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
|
|||
EXLOGV("[rpc] got %s request: %s\n", dbg_method, uri.c_str());
|
||||
#endif
|
||||
ex_astr ret_buf;
|
||||
bool b_is_index = false;
|
||||
bool b_is_html = false;
|
||||
|
||||
if (uri == "/")
|
||||
{
|
||||
ex_wstr page = L"<html lang=\"zh_CN\"><head><meta charset=\"utf-8\"/><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><title>Teleport Assistor</title>\n<style type=\"text/css\">\n.box{padding:20px;margin:40px;border:1px solid #78b17c;background-color:#e4ffe5;}\n</style>\n</head><body><div class=\"box\">Teleport Assistor works fine.</div></body></html>";
|
||||
ex_wstr2astr(page, ret_buf, EX_CODEPAGE_UTF8);
|
||||
// if (uri == "/") {
|
||||
// ex_wstr page = L"<html lang=\"zh_CN\"><head><meta charset=\"utf-8\"/><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><title>TeleportÖúÊÖ</title>\n<style type=\"text/css\">\n.box{padding:20px;margin:40px;border:1px solid #78b17c;background-color:#e4ffe5;}\n</style>\n</head><body><div class=\"box\">Teleport Assistor works fine.</div></body></html>";
|
||||
// ex_wstr2astr(page, ret_buf, EX_CODEPAGE_UTF8);
|
||||
//
|
||||
// mg_printf(nc, "HTTP/1.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %d\r\nContent-Type: text/html\r\n\r\n%s", ret_buf.size() - 1, &ret_buf[0]);
|
||||
// nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
// return;
|
||||
// }
|
||||
|
||||
mg_printf(nc, "HTTP/1.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %ld\r\nContent-Type: text/html\r\n\r\n%s", ret_buf.size() - 1, &ret_buf[0]);
|
||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (uri == "/config")
|
||||
{
|
||||
uri = "/index.html";
|
||||
b_is_index = true;
|
||||
}
|
||||
if (uri == "/") {
|
||||
uri = "/status.html";
|
||||
b_is_html = true;
|
||||
}
|
||||
else if (uri == "/config") {
|
||||
uri = "/index.html";
|
||||
b_is_html = true;
|
||||
}
|
||||
|
||||
ex_astr temp;
|
||||
size_t offset = uri.find("/", 1);
|
||||
|
@ -262,24 +263,24 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
|
|||
{
|
||||
_this->_process_js_request(method, json_param, ret_buf);
|
||||
}
|
||||
|
||||
|
||||
mg_printf(nc, "HTTP/1.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %ld\r\nContent-Type: application/json\r\n\r\n%s", ret_buf.size() - 1, &ret_buf[0]);
|
||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ex_astr file_suffix;
|
||||
offset = uri.rfind(".");
|
||||
if (offset > 0)
|
||||
{
|
||||
file_suffix = uri.substr(offset, uri.length());
|
||||
}
|
||||
|
||||
|
||||
ex_wstr2astr(g_env.m_site_path, temp);
|
||||
ex_astr index_path = temp + uri;
|
||||
|
||||
|
||||
|
||||
FILE* file = ex_fopen(index_path.c_str(), "rb");
|
||||
if (file)
|
||||
|
@ -295,25 +296,23 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
|
|||
fseek(file, 0, SEEK_SET);
|
||||
ret = fread(buf, 1, file_size, file);
|
||||
fclose(file);
|
||||
|
||||
|
||||
ex_astr content_type = _this->get_content_type(file_suffix);
|
||||
|
||||
|
||||
mg_printf(nc, "HTTP/1.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %ld\r\nContent-Type: %s\r\n\r\n", file_size, content_type.c_str());
|
||||
mg_send(nc, buf, (int)file_size);
|
||||
delete []buf;
|
||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
return;
|
||||
}
|
||||
else if (b_is_index)
|
||||
{
|
||||
} else if (b_is_html) {
|
||||
ex_wstr page = L"<html lang=\"zh_CN\"><html><head><title>404 Not Found</title></head><body bgcolor=\"white\"><center><h1>404 Not Found</h1></center><hr><center><p>Teleport Assistor configuration page not found.</p></center></body></html>";
|
||||
ex_wstr2astr(page, ret_buf, EX_CODEPAGE_UTF8);
|
||||
|
||||
|
||||
mg_printf(nc, "HTTP/1.0 404 File Not Found\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %ld\r\nContent-Type: text/html\r\n\r\n%s", ret_buf.size() - 1, &ret_buf[0]);
|
||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -336,7 +335,7 @@ int TsHttpRpc::_parse_request(struct http_message* req, ex_astr& func_cmd, ex_as
|
|||
|
||||
ex_astrs strs;
|
||||
|
||||
size_t pos_start = 1; // 跳过第一个字节,一定是 '/'
|
||||
size_t pos_start = 1; // skip first charactor, it must be '/'
|
||||
|
||||
size_t i = 0;
|
||||
for (i = pos_start; i < req->uri.len; ++i)
|
||||
|
@ -349,7 +348,7 @@ int TsHttpRpc::_parse_request(struct http_message* req, ex_astr& func_cmd, ex_as
|
|||
tmp_uri.assign(req->uri.p + pos_start, i - pos_start);
|
||||
strs.push_back(tmp_uri);
|
||||
}
|
||||
pos_start = i + 1; // 跳过当前找到的分隔符
|
||||
pos_start = i + 1; // skip current split chactor.
|
||||
}
|
||||
}
|
||||
if (pos_start < req->uri.len)
|
||||
|
@ -397,7 +396,7 @@ int TsHttpRpc::_parse_request(struct http_message* req, ex_astr& func_cmd, ex_as
|
|||
|
||||
if (func_args.length() > 0)
|
||||
{
|
||||
// 将参数进行 url-decode 解码
|
||||
// decode param with url-decode.
|
||||
size_t len = func_args.length() * 2;
|
||||
ex_chars sztmp;
|
||||
sztmp.resize(len);
|
||||
|
@ -448,7 +447,7 @@ void TsHttpRpc::_process_js_request(const ex_astr& func_cmd, const ex_astr& func
|
|||
|
||||
void TsHttpRpc::_create_json_ret(ex_astr& buf, int errcode)
|
||||
{
|
||||
// 返回: {"code":123}
|
||||
// return {"code":123}
|
||||
|
||||
Json::FastWriter jr_writer;
|
||||
Json::Value jr_root;
|
||||
|
@ -465,11 +464,11 @@ void TsHttpRpc::_create_json_ret(ex_astr& buf, Json::Value& jr_root)
|
|||
|
||||
void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
||||
{
|
||||
// 入参:{"ip":"192.168.5.11","port":22,"uname":"root","uauth":"abcdefg","authmode":1,"protocol":2}
|
||||
// param: {"ip":"192.168.5.11","port":22,"uname":"root","uauth":"abcdefg","authmode":1,"protocol":2}
|
||||
// authmode: 1=password, 2=private-key
|
||||
// protocol: 1=rdp, 2=ssh
|
||||
// SSH返回: {"code":0, "data":{"sid":"0123abcde"}}
|
||||
// RDP返回: {"code":0, "data":{"sid":"0123abcde0A"}}
|
||||
// SSH return {"code":0, "data":{"sid":"0123abcde"}}
|
||||
// RDP return {"code":0, "data":{"sid":"0123abcde0A"}}
|
||||
|
||||
Json::Reader jreader;
|
||||
Json::Value jsRoot;
|
||||
|
@ -485,7 +484,7 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
return;
|
||||
}
|
||||
|
||||
// 判断参数是否正确
|
||||
// check param
|
||||
if (!jsRoot["teleport_ip"].isString()
|
||||
|| !jsRoot["teleport_port"].isNumeric() || !jsRoot["remote_host_ip"].isString()
|
||||
|| !jsRoot["session_id"].isString() || !jsRoot["protocol_type"].isNumeric() || !jsRoot["protocol_sub_type"].isNumeric()
|
||||
|
@ -512,8 +511,8 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
ex_astr s_exec;
|
||||
ex_astr s_arg;
|
||||
ex_astrs s_argv;
|
||||
|
||||
|
||||
|
||||
|
||||
if (pro_type == TP_PROTOCOL_TYPE_RDP)
|
||||
{
|
||||
//==============================================
|
||||
|
@ -524,10 +523,10 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
_create_json_ret(buf, TPE_NOT_EXISTS);
|
||||
return;
|
||||
}
|
||||
|
||||
bool flag_clipboard = (protocol_flag & TP_FLAG_RDP_CLIPBOARD);
|
||||
bool flag_disk = (protocol_flag & TP_FLAG_RDP_DISK);
|
||||
bool flag_console = (protocol_flag & TP_FLAG_RDP_CONSOLE);
|
||||
|
||||
bool flag_clipboard = ((protocol_flag & TP_FLAG_RDP_CLIPBOARD) == TP_FLAG_RDP_CLIPBOARD);
|
||||
bool flag_disk = ((protocol_flag & TP_FLAG_RDP_DISK) == TP_FLAG_RDP_DISK);
|
||||
bool flag_console = ((protocol_flag & TP_FLAG_RDP_CONSOLE) == TP_FLAG_RDP_CONSOLE);
|
||||
|
||||
int rdp_w = 800;
|
||||
int rdp_h = 640;
|
||||
|
@ -578,9 +577,9 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
{
|
||||
szPwd[i] = '*';
|
||||
}
|
||||
|
||||
|
||||
//ex_astr2wstr(real_sid, w_sid);
|
||||
|
||||
|
||||
//w_exe_path = _T("\"");
|
||||
//w_exe_path += g_cfg.rdp_app + _T("\" ");
|
||||
//w_exe_path += g_cfg.rdp_cmdline;
|
||||
|
@ -593,10 +592,10 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
|
||||
{
|
||||
ex_astr username = "02" + real_sid;
|
||||
|
||||
|
||||
s_argv.push_back("-u");
|
||||
s_argv.push_back(username.c_str());
|
||||
|
||||
|
||||
if (rdp_w == 0 || rdp_h == 0) {
|
||||
s_argv.push_back("-f");
|
||||
}
|
||||
|
@ -606,7 +605,7 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
s_argv.push_back("-g");
|
||||
s_argv.push_back(sz_size);
|
||||
}
|
||||
|
||||
|
||||
if (flag_console && rdp_console)
|
||||
s_argv.push_back("/admin");
|
||||
|
||||
|
@ -619,7 +618,7 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
// s_argv.push_back("+drives");
|
||||
// else
|
||||
// s_argv.push_back("-drives");
|
||||
|
||||
|
||||
{
|
||||
char sz_temp[128] = {0};
|
||||
ex_strformat(sz_temp, 127, "%s:%d", teleport_ip.c_str(), teleport_port);
|
||||
|
@ -639,10 +638,10 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
if(g_cfg.ssh.name == "terminal" || g_cfg.ssh.name == "iterm2") {
|
||||
char szCmd[1024] = {0};
|
||||
ex_strformat(szCmd, 1023, "ssh %s@%s -p %d", sid.c_str(), teleport_ip.c_str(), teleport_port);
|
||||
|
||||
|
||||
char szTitle[128] = {0};
|
||||
ex_strformat(szTitle, 127, "TP#%s", real_host_ip.c_str());
|
||||
|
||||
|
||||
int ret = AppDelegate_start_ssh_client(g_app, szCmd, g_cfg.ssh.name.c_str(), g_cfg.ssh.cmdline.c_str(), szTitle);
|
||||
if(ret == 0)
|
||||
_create_json_ret(buf, TPE_OK);
|
||||
|
@ -650,20 +649,20 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
_create_json_ret(buf, TPE_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(g_cfg.ssh.application.length() == 0) {
|
||||
_create_json_ret(buf, TPE_NOT_EXISTS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
s_exec = g_cfg.ssh.application;
|
||||
s_argv.push_back(s_exec.c_str());
|
||||
|
||||
|
||||
s_arg = g_cfg.ssh.cmdline;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
// sorry, SFTP not supported yet for macOS.
|
||||
// _create_json_ret(buf, TPE_NOT_IMPLEMENT);
|
||||
// return;
|
||||
|
@ -672,10 +671,10 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
_create_json_ret(buf, TPE_NOT_EXISTS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
s_exec = g_cfg.sftp.application;
|
||||
s_argv.push_back(s_exec.c_str());
|
||||
|
||||
|
||||
s_arg = g_cfg.sftp.cmdline;
|
||||
|
||||
}
|
||||
|
@ -716,7 +715,7 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
// s_arg = g_cfg.telnet.cmdline;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---- split s_arg and push to s_argv ---
|
||||
ex_astr::size_type p1 = 0;
|
||||
ex_astr::size_type p2 = 0;
|
||||
|
@ -739,7 +738,7 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
ex_astr _t;
|
||||
_t.assign(tmp, p1, p2 - p1);
|
||||
tmp.erase(0, p2 + 2);
|
||||
|
||||
|
||||
s_argv.push_back(_t);
|
||||
} else {
|
||||
p1 = 0;
|
||||
|
@ -754,12 +753,12 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
ex_astr _t;
|
||||
_t.assign(tmp, p1, p2 - p1);
|
||||
tmp.erase(0, p2 + 1);
|
||||
|
||||
|
||||
s_argv.push_back(_t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Json::Value root_ret;
|
||||
ex_astr utf8_path = s_exec;
|
||||
|
||||
|
@ -774,18 +773,18 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
utf8_path += " ";
|
||||
utf8_path += (*it);
|
||||
}
|
||||
|
||||
|
||||
root_ret["path"] = utf8_path;
|
||||
|
||||
// for macOS, Create Process should be fork()/exec()...
|
||||
pid_t processId;
|
||||
if ((processId = fork()) == 0) {
|
||||
|
||||
|
||||
int i = 0;
|
||||
char** _argv = (char**)calloc(s_argv.size()+1, sizeof(char*));
|
||||
if (!_argv)
|
||||
return;
|
||||
|
||||
|
||||
for (i = 0; i < s_argv.size(); ++i)
|
||||
{
|
||||
_argv[i] = ex_strdup(s_argv[i].c_str());
|
||||
|
@ -800,13 +799,13 @@ void TsHttpRpc::_rpc_func_run_client(const ex_astr& func_args, ex_astr& buf)
|
|||
}
|
||||
}
|
||||
free(_argv);
|
||||
|
||||
|
||||
} else if (processId < 0) {
|
||||
root_ret["code"] = TPE_FAILED;
|
||||
} else {
|
||||
root_ret["code"] = TPE_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// root_ret["code"] = TPE_OK;
|
||||
_create_json_ret(buf, root_ret);
|
||||
|
@ -848,7 +847,7 @@ void TsHttpRpc::_rpc_func_file_action(const ex_astr& func_args, ex_astr& buf) {
|
|||
#if 0
|
||||
Json::Reader jreader;
|
||||
Json::Value jsRoot;
|
||||
|
||||
|
||||
if (!jreader.parse(func_args.c_str(), jsRoot)) {
|
||||
_create_json_ret(buf, TPE_JSON_FORMAT);
|
||||
return;
|
||||
|
@ -859,7 +858,7 @@ void TsHttpRpc::_rpc_func_file_action(const ex_astr& func_args, ex_astr& buf) {
|
|||
// return;
|
||||
// }
|
||||
// int action = jsRoot["action"].asUInt();
|
||||
|
||||
|
||||
AppDelegate_select_app(g_app);
|
||||
_create_json_ret(buf, TPE_FAILED);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __TS_ASSIST_VER_H__
|
||||
#define __TS_ASSIST_VER_H__
|
||||
|
||||
#define TP_ASSIST_VER L"3.2.0"
|
||||
|
||||
#endif // __TS_ASSIST_VER_H__
|
||||
#ifndef __TS_ASSIST_VER_H__
|
||||
#define __TS_ASSIST_VER_H__
|
||||
|
||||
#define TP_ASSIST_VER L"3.2.2"
|
||||
|
||||
#endif // __TS_ASSIST_VER_H__
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
<div class="footer">
|
||||
<div class="container">
|
||||
<p><a href="https://tp4a.com/" target="_blank">TELEPORT</a> | ©2015 - 2018,保留所有权利。</p>
|
||||
<p><a href="https://tp4a.com/" target="_blank">TELEPORT</a> | ©2015 - 2019,保留所有权利。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
<!DOCTYPE html>
|
||||
<!--[if IE 8]>
|
||||
<html lang="en" class="ie8"><![endif]-->
|
||||
<!--[if !IE]><!-->
|
||||
<html lang="zh_CN">
|
||||
<!--<![endif]-->
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>TELEPORT助手</title>
|
||||
<link rel="shortcut icon" href="favicon.png">
|
||||
|
||||
<link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style type="text/css">
|
||||
.info-box {
|
||||
padding:20px;
|
||||
margin:40px;
|
||||
border:1px solid #78b17c;
|
||||
background-color:#e4ffe5;
|
||||
font-size: 140%;
|
||||
}
|
||||
.warning-box {
|
||||
padding:20px;
|
||||
margin:40px;
|
||||
border:1px solid #eac781;
|
||||
background-color: #f9f5d7;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<div class="container">
|
||||
<span class="title"><i class="fa fa-cog fa-fw"></i> Teleport 助手</span>
|
||||
<span class="sub-title" id="version"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-fix"></div>
|
||||
|
||||
<div class="footer">
|
||||
<div class="container">
|
||||
<p><a href="https://tp4a.com/" target="_blank">TELEPORT</a> | ©2015 - 2019,保留所有权利。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="info-box">
|
||||
Teleport助手工作正常!
|
||||
</div>
|
||||
|
||||
<div class="warning-box">
|
||||
<p>如果在使用 HTTPS 方式访问 teleport 的 web 服务时检测不到助手,请<a href="https://127.0.0.1:50023" target="_blank">点击这里</a>,查看页面是否能够正常显示。</p>
|
||||
<p>因为助手在配合HTTPS访问时使用了<strong>自签名证书</strong>,而自签名证书的颁发机构的根证书<strong>默认不被浏览器信任</strong>,因此,还<strong>需要将其设置为浏览器信任的根证书</strong>才行,根据浏览器的不同,具体设置方法有两种:</p>
|
||||
<p><strong>Chrome/IE/Edge/Opera 等浏览器</strong></p>
|
||||
<ol>
|
||||
<li>在桌面的助手快捷方式上点击右键,然后选择“打开文件所在的位置”;</li>
|
||||
<li>右键点击 <strong>cacert.cer</strong>,在弹出菜单中选择“安装证书”;</li>
|
||||
<li>在打开的“证书导入向导”对话框中选择“当前用户”,点击下一步;</li>
|
||||
<li>选择“将所有的证书都放入下列存储”,然后点击“浏览”按钮;</li>
|
||||
<li>在打开的“选择证书存储”对话框中选择<strong>“受信任的根证书颁发机构”</strong>,点击确定;</li>
|
||||
<li>点击“下一步”,然后点击“完成”;</li>
|
||||
<li>系统提示“导入成功”,大功告成。</li>
|
||||
</ol>
|
||||
|
||||
<p><strong>FireFox火狐浏览器</strong></p>
|
||||
<ol>
|
||||
<li>打开火狐浏览器的选项页面;</li>
|
||||
<li>点击左侧的“隐私与安全”,然后滚动页面到底部,点击“查看证书”按钮;</li>
|
||||
<li>在打开的“证书管理器”对话框中选择“证书颁发机构”选项卡;</li>
|
||||
<li>点击对话框底部的“导入”按钮,然后选择 <strong>cacert.cer</strong> 文件并点击“打开”按钮;</li>
|
||||
<li>在“下载证书”对话框中,勾选“信任由此证书颁发机构来标识网站”,然后点击“确定”;</li>
|
||||
<li>点击“确定”来关闭证书管理器对话框,大功告成。</li>
|
||||
</ol>
|
||||
|
||||
<p><strong>注意:</strong>导入证书后,请再次<a href="https://127.0.0.1:50023" target="_blank">点击这里</a>,查看页面是否能够正常显示。</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Binary file not shown.
|
@ -259,7 +259,7 @@ bool TsHttpRpc::init_http() {
|
|||
|
||||
nc = mg_bind(&m_mg_mgr, addr, _mg_event_handler);
|
||||
if (!nc) {
|
||||
EXLOGE("[rpc] TsHttpRpc::init localhost:%d\n", TS_HTTP_RPC_PORT);
|
||||
EXLOGE("[rpc] TsHttpRpc::init 127.0.0.1:%d\n", TS_HTTP_RPC_PORT);
|
||||
return false;
|
||||
}
|
||||
nc->user_data = this;
|
||||
|
@ -289,12 +289,11 @@ bool TsHttpRpc::init_https() {
|
|||
|
||||
char addr[128] = { 0 };
|
||||
ex_strformat(addr, 128, "tcp://127.0.0.1:%d", TS_HTTPS_RPC_PORT);
|
||||
//ex_strformat(addr, 128, "%d", TS_HTTPS_RPC_PORT);
|
||||
|
||||
struct mg_connection* nc = nullptr;
|
||||
nc = mg_bind_opt(&m_mg_mgr, addr, _mg_event_handler, bind_opts);
|
||||
if (!nc) {
|
||||
EXLOGE("[rpc] TsHttpRpc::init localhost:%d\n", TS_HTTPS_RPC_PORT);
|
||||
EXLOGE("[rpc] TsHttpRpc::init 127.0.0.1:%d\n", TS_HTTPS_RPC_PORT);
|
||||
return false;
|
||||
}
|
||||
nc->user_data = this;
|
||||
|
@ -375,20 +374,24 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
|
|||
EXLOGV("[rpc] got %s request: %s\n", dbg_method, uri.c_str());
|
||||
#endif
|
||||
ex_astr ret_buf;
|
||||
bool b_is_index = false;
|
||||
bool b_is_html = false;
|
||||
|
||||
// if (uri == "/") {
|
||||
// ex_wstr page = L"<html lang=\"zh_CN\"><head><meta charset=\"utf-8\"/><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><title>TeleportÖúÊÖ</title>\n<style type=\"text/css\">\n.box{padding:20px;margin:40px;border:1px solid #78b17c;background-color:#e4ffe5;}\n</style>\n</head><body><div class=\"box\">TeleportÖúÊÖ¹¤×÷Õý³££¡</div></body></html>";
|
||||
// ex_wstr2astr(page, ret_buf, EX_CODEPAGE_UTF8);
|
||||
//
|
||||
// mg_printf(nc, "HTTP/1.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %d\r\nContent-Type: text/html\r\n\r\n%s", ret_buf.size() - 1, &ret_buf[0]);
|
||||
// nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (uri == "/") {
|
||||
ex_wstr page = L"<html lang=\"zh_CN\"><head><meta charset=\"utf-8\"/><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><title>TeleportÖúÊÖ</title>\n<style type=\"text/css\">\n.box{padding:20px;margin:40px;border:1px solid #78b17c;background-color:#e4ffe5;}\n</style>\n</head><body><div class=\"box\">TeleportÖúÊÖ¹¤×÷Õý³££¡</div></body></html>";
|
||||
ex_wstr2astr(page, ret_buf, EX_CODEPAGE_UTF8);
|
||||
|
||||
mg_printf(nc, "HTTP/1.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %d\r\nContent-Type: text/html\r\n\r\n%s", ret_buf.size() - 1, &ret_buf[0]);
|
||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
return;
|
||||
uri = "/status.html";
|
||||
b_is_html = true;
|
||||
}
|
||||
|
||||
if (uri == "/config") {
|
||||
else if (uri == "/config") {
|
||||
uri = "/index.html";
|
||||
b_is_index = true;
|
||||
b_is_html = true;
|
||||
}
|
||||
|
||||
ex_astr temp;
|
||||
|
@ -445,7 +448,7 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
|
|||
delete[]buf;
|
||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||
return;
|
||||
} else if (b_is_index) {
|
||||
} else if (b_is_html) {
|
||||
ex_wstr page = L"<html lang=\"zh_CN\"><html><head><title>404 Not Found</title></head><body bgcolor=\"white\"><center><h1>404 Not Found</h1></center><hr><center><p>Teleport Assistor configuration page not found.</p></center></body></html>";
|
||||
ex_wstr2astr(page, ret_buf, EX_CODEPAGE_UTF8);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __TS_ASSIST_VER_H__
|
||||
#define __TS_ASSIST_VER_H__
|
||||
|
||||
#define TP_ASSIST_VER L"3.2.0"
|
||||
|
||||
#endif // __TS_ASSIST_VER_H__
|
||||
#ifndef __TS_ASSIST_VER_H__
|
||||
#define __TS_ASSIST_VER_H__
|
||||
|
||||
#define TP_ASSIST_VER L"3.2.2"
|
||||
|
||||
#endif // __TS_ASSIST_VER_H__
|
||||
|
|
|
@ -13,5 +13,5 @@ Revision: 修订号。主版本号和次版本号都相同但修订号不同的
|
|||
TP_SERVER 3.2.2 # 整个服务端打包的版本
|
||||
TP_TPCORE 3.2.0 # 核心服务 tp_core 的版本
|
||||
TP_TPWEB 3.1.0 # web服务 tp_web 的版本(一般除非升级Python,否则不会变化)
|
||||
TP_ASSIST 3.2.0 # 助手版本
|
||||
TP_ASSIST 3.2.2 # 助手版本
|
||||
TP_ASSIST_REQUIRE 3.1.0 # 适配的助手最低版本
|
||||
|
|
Loading…
Reference in New Issue