mirror of https://github.com/tp4a/teleport
Merge commit 'd9a15640e6568b1d582be9e9d942b6d2fd69a652'
commit
1d508dcdd9
|
@ -34,6 +34,7 @@
|
|||
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/rdp/rdp_proxy.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/rdp/rdp_session.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/rdp/rdp_session.h" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/rdp_mstsc/rdp_proxy.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/ssh/ssh_recorder.h" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/ssh/tpssh_proxy.cpp" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/server/tp_core/protocol/ssh/tpssh_proxy.h" charset="GBK" />
|
||||
|
|
|
@ -1,2 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Python" name="Python facet">
|
||||
<configuration sdkName="Python 3.7" />
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
|
@ -103,7 +103,8 @@ class BuilderWin(BuilderBase):
|
|||
class BuilderLinux(BuilderBase):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.name = 'teleport-server-linux-{}-{}'.format(ctx.bits_path, VER_TP_SERVER)
|
||||
state = '' if VER_TP_STATE == 'release' else '-{}'.format(VER_TP_STATE)
|
||||
self.name = 'teleport-server-linux-{}-{}{}'.format(ctx.bits_path, VER_TP_SERVER, state)
|
||||
self._final_file = os.path.join(env.root_path, 'out', 'installer', '{}.tar.gz'.format(self.name))
|
||||
|
||||
self.dist_path = os.path.join(env.root_path, 'dist', 'server')
|
||||
|
|
|
@ -19,6 +19,7 @@ class Builder:
|
|||
self.VER_TP_TPWEB = ''
|
||||
self.VER_TP_ASSIST = ''
|
||||
self.VER_TP_ASSIST_REQUIRE = ''
|
||||
self.VER_TP_STATE = ''
|
||||
|
||||
def build(self):
|
||||
cc.n('update version...')
|
||||
|
@ -48,6 +49,10 @@ class Builder:
|
|||
x = l.split(' ')
|
||||
self.VER_TP_ASSIST_REQUIRE = x[1].strip()
|
||||
# self.VER_TP_ASSIST += '.0'
|
||||
elif l.startswith('TP_STATE '):
|
||||
x = l.split(' ')
|
||||
self.VER_TP_STATE = x[1].strip()
|
||||
# self.VER_TP_ASSIST += '.0'
|
||||
|
||||
cc.v('new version:')
|
||||
cc.v(' Server : ', self.VER_TP_SERVER)
|
||||
|
@ -55,6 +60,7 @@ class Builder:
|
|||
cc.v(' - tp_web : ', self.VER_TP_TPWEB)
|
||||
cc.v(' Assist : ', self.VER_TP_ASSIST)
|
||||
cc.v(' - Require : ', self.VER_TP_ASSIST_REQUIRE)
|
||||
cc.v(' State : ', self.VER_TP_STATE)
|
||||
cc.v('')
|
||||
|
||||
self.make_builder_ver()
|
||||
|
@ -66,7 +72,7 @@ class Builder:
|
|||
|
||||
def make_builder_ver(self):
|
||||
ver_file = os.path.join(env.root_path, 'build', 'builder', 'core', 'ver.py')
|
||||
ver_content = '# -*- coding: utf8 -*-\nVER_TP_SERVER = "{}"\nVER_TP_ASSIST = "{}"\n'.format(self.VER_TP_SERVER, self.VER_TP_ASSIST)
|
||||
ver_content = '# -*- coding: utf8 -*-\nVER_TP_SERVER = "{}"\nVER_TP_ASSIST = "{}"\nVER_TP_STATE = "{}"\n'.format(self.VER_TP_SERVER, self.VER_TP_ASSIST, self.VER_TP_STATE)
|
||||
|
||||
rewrite = False
|
||||
if not os.path.exists(ver_file):
|
||||
|
@ -111,7 +117,8 @@ class Builder:
|
|||
'# -*- coding: utf8 -*-\n' \
|
||||
'TP_SERVER_VER = "{}"\n' \
|
||||
'TP_ASSIST_REQUIRE_VER = "{}"\n' \
|
||||
''.format(self.VER_TP_SERVER, self.VER_TP_ASSIST_REQUIRE)
|
||||
'TP_STATE_VER = "{}"\n' \
|
||||
''.format(self.VER_TP_SERVER, self.VER_TP_ASSIST_REQUIRE, self.VER_TP_STATE)
|
||||
|
||||
rewrite = False
|
||||
if not os.path.exists(ver_file):
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf8 -*-
|
||||
VER_TP_SERVER = "3.5.6"
|
||||
VER_TP_ASSIST = "3.5.6"
|
||||
# -*- coding: utf8 -*-
|
||||
VER_TP_SERVER = "3.5.6"
|
||||
VER_TP_ASSIST = "3.5.6"
|
||||
VER_TP_STATE = "rc6"
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
FROM centos:7
|
||||
LABEL maintainer="Apex Liu <apex.liu@qq.com>"
|
||||
|
||||
ENV TP_VER=3.5.6-rc6
|
||||
|
||||
|
||||
ADD res/teleport-server-linux-x64-$TP_VER.tar.gz /root
|
||||
ADD res/bootstrap.sh /root
|
||||
|
||||
RUN mkdir /usr/local/teleport; \
|
||||
mkdir /usr/local/teleport/data; \
|
||||
cp -R /root/teleport-server-linux-x64-$TP_VER/data/bin /usr/local/teleport/bin; \
|
||||
cp -R /root/teleport-server-linux-x64-$TP_VER/data/www /usr/local/teleport/www; \
|
||||
chmod +x /root/bootstrap.sh; \
|
||||
rm -rf /etc/localtime; \
|
||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
EXPOSE 7190
|
||||
EXPOSE 52089
|
||||
EXPOSE 52189
|
||||
EXPOSE 52389
|
||||
|
||||
ENTRYPOINT ["/root/bootstrap.sh"]
|
|
@ -0,0 +1,44 @@
|
|||
#/bin/bash
|
||||
|
||||
# 请设置一个目录用于teleport保存数据,包括配置文件、录像、服务日志等
|
||||
# TP_DATA=/var/data/teleport
|
||||
|
||||
TP_VER=3.5.6-rc6
|
||||
|
||||
PATH_ROOT=$(cd "$(dirname "$0")/../.."; pwd)
|
||||
PATH_DOCKER=${PATH_ROOT}/dist/docker
|
||||
INSTALLER_FILE_NAME=teleport-server-linux-x64-${TP_VER}.tar.gz
|
||||
|
||||
cd ${PATH_DOCKER}
|
||||
|
||||
container_id=$(docker ps -a | grep "teleport-${TP_VER}" | awk '{print $1}')
|
||||
if [ "x-${container_id}" != "x-" ]; then
|
||||
flag=$(docker ps | grep ${container_id})
|
||||
|
||||
if [ "x-${flag}" != "x-" ]; then
|
||||
echo "stop running container..."
|
||||
docker stop ${container_id}
|
||||
fi
|
||||
|
||||
echo "remove container..."
|
||||
docker rm ${container_id}
|
||||
fi
|
||||
|
||||
image_id=$(docker images | grep "tp4a/teleport" | grep "${TP_VER}" | awk '{print $3}')
|
||||
if [ "x-${image_id}" != "x-" ]; then
|
||||
echo "remove old image..."
|
||||
docker rmi ${image_id}
|
||||
fi
|
||||
|
||||
echo "copying teleport installer package..."
|
||||
rm -rf ${PATH_DOCKER}/res/${INSTALLER_FILE_NAME}
|
||||
cp ${PATH_ROOT}/out/installer/${INSTALLER_FILE_NAME} ${PATH_DOCKER}/res/.
|
||||
|
||||
echo "building docker-image tp4a/teleport:${TP_VER} ..."
|
||||
docker build -t="tp4a/teleport:${TP_VER}" .
|
||||
|
||||
echo "starting container..."
|
||||
docker run --name=teleport-${TP_VER} -d \
|
||||
-v ${TP_DATA}:/usr/local/teleport/data \
|
||||
-p 7190:7190 -p 52089:52089 -p 52189:52189 -p 52389:52389 \
|
||||
tp4a/teleport:${TP_VER}
|
|
@ -0,0 +1,57 @@
|
|||
# CentOS-Base.repo
|
||||
#
|
||||
# The mirror system uses the connecting IP address of the client and the
|
||||
# update status of each mirror to pick mirrors that are updated to and
|
||||
# geographically close to the client. You should use this for CentOS updates
|
||||
# unless you are manually picking other mirrors.
|
||||
#
|
||||
# If the mirrorlist= does not work for you, as a fall back you can try the
|
||||
# remarked out baseurl= line instead.
|
||||
#
|
||||
#
|
||||
|
||||
[base]
|
||||
name=CentOS-$releasever - Base - mirrors.aliyun.com
|
||||
failovermethod=priority
|
||||
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
|
||||
# http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
|
||||
gpgcheck=1
|
||||
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
|
||||
|
||||
#released updates
|
||||
[updates]
|
||||
name=CentOS-$releasever - Updates - mirrors.aliyun.com
|
||||
failovermethod=priority
|
||||
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
|
||||
# http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
|
||||
gpgcheck=1
|
||||
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
|
||||
|
||||
#additional packages that may be useful
|
||||
[extras]
|
||||
name=CentOS-$releasever - Extras - mirrors.aliyun.com
|
||||
failovermethod=priority
|
||||
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
|
||||
# http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
|
||||
gpgcheck=1
|
||||
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
|
||||
|
||||
#additional packages that extend functionality of existing packages
|
||||
[centosplus]
|
||||
name=CentOS-$releasever - Plus - mirrors.aliyun.com
|
||||
failovermethod=priority
|
||||
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
|
||||
# http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
|
||||
gpgcheck=1
|
||||
enabled=0
|
||||
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
|
||||
|
||||
#contrib - packages by Centos Users
|
||||
[contrib]
|
||||
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
|
||||
failovermethod=priority
|
||||
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
|
||||
# http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
|
||||
gpgcheck=1
|
||||
enabled=0
|
||||
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
TP_VER=3.5.6-rc6
|
||||
|
||||
if [ ! -d /usr/local/teleport/data/etc ]; then
|
||||
cp -R /root/teleport-server-linux-x64-${TP_VER}/data/tmp/etc /usr/local/teleport/data/etc
|
||||
fi
|
||||
|
||||
if [ ! -d /usr/local/teleport/data/log ]; then
|
||||
mkdir /usr/local/teleport/data/log
|
||||
fi
|
||||
|
||||
nohup /usr/local/teleport/bin/tp_core -d start 2>/dev/null 1>/dev/null &
|
||||
/usr/local/teleport/bin/tp_web -d start 2>/dev/null 1>/dev/null
|
|
@ -0,0 +1,17 @@
|
|||
#/bin/bash
|
||||
|
||||
# 请设置一个目录用于teleport保存数据,包括配置文件、录像、服务日志等
|
||||
# TP_DATA=/var/data/teleport
|
||||
|
||||
#=============================================
|
||||
|
||||
TP_VER=3.5.6-rc6
|
||||
|
||||
if [ ! -d ${TP_DATA} ]; then
|
||||
mkdir -p ${TP_DATA}
|
||||
fi
|
||||
|
||||
echo "starting teleport server ${TP_VER} ..."
|
||||
docker start $(docker ps -n 100 | grep "tp4a/teleport:${TP_VER}" | awk '{print $1}')
|
||||
|
||||
# docker run -v /Users/apex/tmp/docker-tp-data:/usr/local/teleport/data -p 7190:7190 -p 52089:52089 -p 52189:52189 -p 52389:52389 -it tp4a/teleport:3.5.6-rc6 /bin/bash
|
|
@ -28,6 +28,8 @@ debug-mode=0
|
|||
; DO NOT FORGET update this setting if you modified rpc::bind-port in core.ini.
|
||||
core-server-rpc=http://127.0.0.1:52080/rpc
|
||||
|
||||
;
|
||||
check-host-alive=0
|
||||
|
||||
[database]
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
#include <ex.h>
|
||||
|
||||
// 命令行参数说明(不带参数运行则以服务方式启动)
|
||||
// 命令行参数说明(不带参数运行则以服务方式启动)
|
||||
// tp_core [-i|-u|--version] [ [-d] start]
|
||||
// -d 启动程序并输出调试信息(不会运行为守护进程/服务模式)
|
||||
// -i 安装服务然后退出(仅限Win平台)
|
||||
// -u 卸载服务然后退出(仅限Win平台)
|
||||
// --version 打印版本号然后退出
|
||||
// start 以服务方式运行
|
||||
// stop 停止运行中的程序
|
||||
// -d 启动程序并输出调试信息(不会运行为守护进程/服务模式)
|
||||
// -i 安装服务然后退出(仅限Win平台)
|
||||
// -u 卸载服务然后退出(仅限Win平台)
|
||||
// --version 打印版本号然后退出
|
||||
// start 以服务方式运行
|
||||
// stop 停止运行中的程序
|
||||
//
|
||||
ExLogger g_ex_logger;
|
||||
|
||||
|
@ -205,10 +205,10 @@ static DWORD WINAPI service_thread_func(LPVOID lpParam);
|
|||
int main()
|
||||
{
|
||||
int ret = 0;
|
||||
LPWSTR szCmdLine = (LPWSTR)::GetCommandLineW(); //获取命令行参数;
|
||||
LPWSTR szCmdLine = (LPWSTR)::GetCommandLineW(); //获取命令行参数;
|
||||
|
||||
int _argc = 0;
|
||||
wchar_t** _argv = ::CommandLineToArgvW(szCmdLine, &_argc); //拆分命令行参数字符串;
|
||||
wchar_t** _argv = ::CommandLineToArgvW(szCmdLine, &_argc); //拆分命令行参数字符串;
|
||||
|
||||
ret = _app_main(_argc, _argv);
|
||||
|
||||
|
@ -240,7 +240,7 @@ static DWORD WINAPI service_thread_func(LPVOID lpParam)
|
|||
{
|
||||
int ret = _main_loop();
|
||||
|
||||
// 更新服务状态(如果服务还在运行,将其设置为停止状态)
|
||||
// 更新服务状态(如果服务还在运行,将其设置为停止状态)
|
||||
g_ServiceStatus.dwWin32ExitCode = 0;
|
||||
g_ServiceStatus.dwCurrentState = SERVICE_STOPPED;
|
||||
g_ServiceStatus.dwCheckPoint = 0;
|
||||
|
|
|
@ -297,8 +297,9 @@ void SshSession::_thread_loop()
|
|||
if (t_now - t_last_send_keepalive >= 60)
|
||||
{
|
||||
t_last_send_keepalive = t_now;
|
||||
EXLOGD("[%s] send keepalive to client.\n", m_dbg_name.c_str());
|
||||
EXLOGD("[%s] send keepalive.\n", m_dbg_name.c_str());
|
||||
ssh_send_ignore(m_rs_tp2cli, "keepalive@openssh.com");
|
||||
ssh_send_ignore(m_rs_tp2srv, "keepalive@openssh.com");
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$/../../share" />
|
||||
<content url="file://$MODULE_DIR$/static" />
|
||||
<content url="file://$MODULE_DIR$/view" />
|
||||
<content url="file://$MODULE_DIR$/webroot">
|
||||
|
@ -17,7 +18,4 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
|
||||
</component>
|
||||
</module>
|
|
@ -2,6 +2,13 @@
|
|||
<project version="4">
|
||||
<component name="WebResourcesPaths">
|
||||
<contentEntries>
|
||||
<entry url="file://$PROJECT_DIR$/../../share">
|
||||
<entryData>
|
||||
<resourceRoots>
|
||||
<path value="file://$PROJECT_DIR$/../../share" />
|
||||
</resourceRoots>
|
||||
</entryData>
|
||||
</entry>
|
||||
<entry url="file://$PROJECT_DIR$/static">
|
||||
<entryData>
|
||||
<resourceRoots>
|
||||
|
@ -11,4 +18,4 @@
|
|||
</entry>
|
||||
</contentEntries>
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
|
@ -224,9 +224,7 @@ $app.on_table_users_cell_created = function (tbl, row_id, col_key, cell_obj) {
|
|||
cell_obj.find('[data-check-box]').click(function () {
|
||||
$app.check_user_list_all_selected();
|
||||
});
|
||||
}
|
||||
|
||||
else if (col_key === 'action') {
|
||||
} else if (col_key === 'action') {
|
||||
cell_obj.find('[data-action]').click(function () {
|
||||
var user = $app.table_users.get_row(row_id);
|
||||
var action = $(this).attr('data-action');
|
||||
|
@ -234,7 +232,7 @@ $app.on_table_users_cell_created = function (tbl, row_id, col_key, cell_obj) {
|
|||
$app.dlg_edit_user.show_edit(row_id);
|
||||
} else if (action === 'reset-password') {
|
||||
// console.log(user);
|
||||
if(user.type === TP_USER_TYPE_LDAP)
|
||||
if (user.type === TP_USER_TYPE_LDAP)
|
||||
return;
|
||||
$app.dlg_reset_password.show_edit(row_id);
|
||||
} else if (action === 'reset-oath-bind') {
|
||||
|
@ -419,7 +417,7 @@ $app.on_table_users_render_created = function (render) {
|
|||
} else {
|
||||
class_user_type = '';
|
||||
}
|
||||
h.push('<li' + class_user_type +'><a href="javascript:;" data-action="reset-password"><i class="fa fa-street-view fa-fw"></i> 重置密码</a></li>');
|
||||
h.push('<li' + class_user_type + '><a href="javascript:;" data-action="reset-password"><i class="fa fa-street-view fa-fw"></i> 重置密码</a></li>');
|
||||
|
||||
h.push('<li><a href="javascript:;" data-action="reset-oath-bind"><i class="fa fa-street-view fa-fw"></i> 重置身份验证器</a></li>');
|
||||
h.push('<li role="separator" class="divider"></li>');
|
||||
|
@ -808,16 +806,16 @@ $app.create_dlg_edit_user = function () {
|
|||
dlg.dom.edit_valid_from.datetimepicker({format: "yyyy-mm-dd hh:ii", autoclose: true, todayHighlight: true, todayBtn: true, language: "zh-CN"});
|
||||
dlg.dom.edit_valid_to.datetimepicker({format: "yyyy-mm-dd hh:ii", autoclose: true, todayHighlight: true, todayBtn: true, language: "zh-CN"});
|
||||
|
||||
dlg.dom.edit_valid_from.on('changeDate', function(ev){
|
||||
dlg.dom.edit_valid_from.on('changeDate', function (ev) {
|
||||
var start_time = dlg.dom.edit_valid_from.find('input').val();
|
||||
if(start_time === '')
|
||||
if (start_time === '')
|
||||
dlg.dom.edit_valid_to.datetimepicker('setStartDate', '1000-01-01 00:00');
|
||||
else
|
||||
dlg.dom.edit_valid_to.datetimepicker('setStartDate', start_time);
|
||||
});
|
||||
dlg.dom.edit_valid_to.on('changeDate', function(ev){
|
||||
dlg.dom.edit_valid_to.on('changeDate', function (ev) {
|
||||
var end_time = dlg.dom.edit_valid_to.find('input').val();
|
||||
if(end_time === '')
|
||||
if (end_time === '')
|
||||
dlg.dom.edit_valid_from.datetimepicker('setEndDate', '9999-12-12 00:00');
|
||||
else
|
||||
dlg.dom.edit_valid_from.datetimepicker('setEndDate', end_time);
|
||||
|
@ -892,7 +890,7 @@ $app.create_dlg_edit_user = function () {
|
|||
var role_name = '选择角色';
|
||||
dlg.field_role = -1;
|
||||
dlg.field_auth_type = 0;
|
||||
|
||||
|
||||
// dlg.dom.btn_auth_use_sys_config.removeClass('tp-selected');
|
||||
// dlg.dom.btn_auth_username_password.removeClass('tp-selected');
|
||||
// dlg.dom.btn_auth_username_password_captcha.removeClass('tp-selected');
|
||||
|
@ -930,22 +928,22 @@ $app.create_dlg_edit_user = function () {
|
|||
dlg.dom.edit_qq.val(user.qq);
|
||||
dlg.dom.edit_wechat.val(user.wechat);
|
||||
dlg.dom.edit_desc.val(user.desc);
|
||||
if (user.valid_from === 0 ) {
|
||||
dlg.dom.edit_valid_from.find('input').val('');
|
||||
dlg.dom.edit_valid_to.datetimepicker('setStartDate', '9999-12-12 00:00');
|
||||
}else{
|
||||
if (user.valid_from === 0) {
|
||||
dlg.dom.edit_valid_from.find('input').val('');
|
||||
dlg.dom.edit_valid_to.datetimepicker('setStartDate', '9999-12-12 00:00');
|
||||
} else {
|
||||
var start_time = tp_format_datetime(user.valid_from, 'yyyy-MM-dd HH:mm');
|
||||
dlg.dom.edit_valid_from.find('input').val(start_time);
|
||||
dlg.dom.edit_valid_to.datetimepicker('setStartDate', start_time);
|
||||
dlg.dom.edit_valid_from.find('input').val(start_time);
|
||||
dlg.dom.edit_valid_to.datetimepicker('setStartDate', start_time);
|
||||
}
|
||||
if (user.valid_to === 0 ) {
|
||||
dlg.dom.edit_valid_to.find('input').val('');
|
||||
dlg.dom.edit_valid_from.datetimepicker('setEndDate', '1000-01-01 00:00');
|
||||
}else{
|
||||
if (user.valid_to === 0) {
|
||||
dlg.dom.edit_valid_to.find('input').val('');
|
||||
dlg.dom.edit_valid_from.datetimepicker('setEndDate', '1000-01-01 00:00');
|
||||
} else {
|
||||
var end_time = tp_format_datetime(user.valid_to, 'yyyy-MM-dd HH:mm');
|
||||
dlg.dom.edit_valid_to.find('input').val(end_time);
|
||||
dlg.dom.edit_valid_from.datetimepicker('setEndDate', end_time);
|
||||
}
|
||||
dlg.dom.edit_valid_to.find('input').val(end_time);
|
||||
dlg.dom.edit_valid_from.datetimepicker('setEndDate', end_time);
|
||||
}
|
||||
}
|
||||
dlg.dom.selected_role.text(role_name);
|
||||
|
||||
|
@ -1290,6 +1288,7 @@ $app.create_dlg_ldap_config = function () {
|
|||
dlg.ldap_config = {
|
||||
server: '',
|
||||
port: '',
|
||||
use_ssl: false,
|
||||
domain: '',
|
||||
admin: '',
|
||||
password: '',
|
||||
|
@ -1315,6 +1314,7 @@ $app.create_dlg_ldap_config = function () {
|
|||
attr_surname: $('#edit-ldap-attr-surname'),
|
||||
attr_email: $('#edit-ldap-attr-email'),
|
||||
|
||||
btn_use_ssl: $('#edit-ldap-ssl'),
|
||||
btn_switch_password: $('#btn-switch-ldap-password'),
|
||||
btn_switch_password_icon: $('#btn-switch-ldap-password i'),
|
||||
|
||||
|
@ -1338,6 +1338,10 @@ $app.create_dlg_ldap_config = function () {
|
|||
}
|
||||
});
|
||||
|
||||
// dlg.dom.btn_use_ssl.click(function () {
|
||||
// dlg.ldap_config.use_ssl = $(this).is(':checked')
|
||||
// });
|
||||
|
||||
cb_stack.exec();
|
||||
};
|
||||
|
||||
|
@ -1346,6 +1350,8 @@ $app.create_dlg_ldap_config = function () {
|
|||
dlg.mode = 'set';
|
||||
} else {
|
||||
dlg.ldap_config = $app.options.sys_cfg.ldap;
|
||||
if (_.isUndefined(dlg.ldap_config.use_ssl))
|
||||
dlg.ldap_config.use_ssl = false;
|
||||
|
||||
dlg.mode = 'edit';
|
||||
// dlg.dom.password.val();
|
||||
|
@ -1359,6 +1365,11 @@ $app.create_dlg_ldap_config = function () {
|
|||
dlg.dom.attr_username.val(dlg.ldap_config.attr_username);
|
||||
dlg.dom.attr_surname.val(dlg.ldap_config.attr_surname);
|
||||
dlg.dom.attr_email.val(dlg.ldap_config.attr_email);
|
||||
|
||||
if (dlg.ldap_config.use_ssl)
|
||||
dlg.dom.btn_use_ssl.prop('checked', true);
|
||||
else
|
||||
dlg.dom.btn_use_ssl.prop('checked', false);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1408,6 +1419,9 @@ $app.create_dlg_ldap_config = function () {
|
|||
return false;
|
||||
}
|
||||
|
||||
// dlg.ldap_config.use_ssl = dlg.dom.btn_use_ssl.hasClass('tp-selected');
|
||||
dlg.ldap_config.use_ssl = $(this).is(':checked')
|
||||
|
||||
if (dlg.mode === 'set') {
|
||||
if (tp_is_empty_str(dlg.ldap_config.password)) {
|
||||
dlg.dom.password.focus();
|
||||
|
@ -1582,9 +1596,9 @@ $app.create_dlg_ldap_test_result = function () {
|
|||
h.push('<th style="text-align:left;" class="mono">邮箱</th>');
|
||||
h.push('</thead>');
|
||||
|
||||
var _mktd = function(h, d) {
|
||||
if((!_.isUndefined(d)) && !_.isEmpty(d))
|
||||
h.push('<td style="text-align:left;" class="mono">'+d+'</td>');
|
||||
var _mktd = function (h, d) {
|
||||
if ((!_.isUndefined(d)) && !_.isEmpty(d))
|
||||
h.push('<td style="text-align:left;" class="mono">' + d + '</td>');
|
||||
else
|
||||
h.push('<td></td>');
|
||||
};
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<%!
|
||||
import app.app_ver as app_ver
|
||||
from app import const
|
||||
|
||||
_ver_state = '' if app_ver.TP_STATE_VER == 'release' else '-{}'.format(app_ver.TP_STATE_VER)
|
||||
|
||||
_sidebar = [
|
||||
{
|
||||
'privilege': const.TP_PRIVILEGE_LOGIN_WEB,
|
||||
|
@ -213,10 +216,8 @@
|
|||
|
||||
<hr style="border:none;border-bottom:1px dotted #4a4a4a;margin-bottom:0;"/>
|
||||
<div style="color:#717171;font-size:90%;margin-top:5px;text-align:center;">
|
||||
<div style="color:#717171;font-size:90%;margin-top:5px;"><span style="display:inline-block;width:50px;text-align: right">服务端:</span><span class="mono">v${app_ver.TP_SERVER_VER}</span></div>
|
||||
<div style="color:#717171;font-size:90%;margin-top:5px;"><span style="display:inline-block;width:50px;text-align: right">服务端:</span><span class="mono">v${app_ver.TP_SERVER_VER}${_ver_state}</span></div>
|
||||
<div style="color:#717171;font-size:90%;margin-top:5px;"><span style="display:inline-block;width:50px;text-align: right">助手:</span><span class="mono"><span id="sidebar-tp-assist-ver"><i class="fa fa-cog fa-spin"></i></span></span></div>
|
||||
|
||||
## <div style="font-size:80%;margin-top:5px;text-align:center;"><span class="error">beta版</span></div>
|
||||
</div>
|
||||
<hr style="border:none;border-bottom:1px dotted #4a4a4a;margin-bottom:20px;margin-top:5px;"/>
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
|
||||
<div class="page-content-inner">
|
||||
## 防止页面搜索框被自动填充
|
||||
<label style="display:none;"><span></span><input type="text" name="hidden1" ></label>
|
||||
<label style="display:none;"><span></span><input type="password" name="hidden2" ></label>
|
||||
<label style="display:none;"><span></span><input type="text" name="hidden1"></label>
|
||||
<label style="display:none;"><span></span><input type="password" name="hidden2"></label>
|
||||
|
||||
<!-- begin box -->
|
||||
<div class="box">
|
||||
|
@ -67,7 +67,7 @@
|
|||
<li><a href="javascript:;" data-action="ldap-import"><i class="fas fa-arrow-alt-circle-left fa-fw"></i> 导入LDAP用户</a></li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li><a href="javascript:;" data-action="ldap-config"><i class="fas fa-cog fa-fw"></i> 设置LDAP</a></li>
|
||||
## <li><a href="javascript:;" data-action="ldap-sync"><i class="fas fa-link fa-fw"></i> 同步LDAP</a></li>
|
||||
## <li><a href="javascript:;" data-action="ldap-sync"><i class="fas fa-link fa-fw"></i> 同步LDAP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -236,15 +236,15 @@
|
|||
<input id="edit-user-wechat" type="text" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
<label class="col-sm-2 control-label">生效时间:</label>
|
||||
<div class="col-sm-5">
|
||||
<div class="input-group date" id="edit-user-valid-from">
|
||||
<input type='text' class="form-control" readonly />
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
|
||||
</div>
|
||||
<input type='text' class="form-control" readonly/>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<div class="control-desc">开始</div>
|
||||
|
@ -253,11 +253,11 @@
|
|||
<div class="form-group form-group-sm">
|
||||
<label class="col-sm-2"></label>
|
||||
<div class="col-sm-5">
|
||||
<div class='input-group date' id='edit-user-valid-to'>
|
||||
<input type='text' class="form-control" readonly />
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
|
||||
</div>
|
||||
<div class='input-group date' id='edit-user-valid-to'>
|
||||
<input type='text' class="form-control" readonly/>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<div class="control-desc">结束</div>
|
||||
|
@ -285,9 +285,15 @@
|
|||
<hr class="hr-sm"/>
|
||||
</li>
|
||||
## <li><div id="sec-auth-username-password" class="tp-checkbox">用户名 + 密码</div></li>
|
||||
<li><div id="sec-auth-username-password-captcha" class="tp-checkbox">用户名 + 密码 + 验证码</div></li>
|
||||
|
||||
<li>
|
||||
<div id="sec-auth-username-password-captcha" class="tp-checkbox">用户名 + 密码 + 验证码</div>
|
||||
</li>
|
||||
## <li><div id="sec-auth-username-oath" class="tp-checkbox">用户名 + 身份认证器动态密码</div></li>
|
||||
<li><div id="sec-auth-username-password-oath" class="tp-checkbox">用户名 + 密码 + 身份认证器动态密码</div></li>
|
||||
|
||||
<li>
|
||||
<div id="sec-auth-username-password-oath" class="tp-checkbox">用户名 + 密码 + 身份认证器动态密码</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -465,6 +471,9 @@
|
|||
<input id="edit-ldap-server" type="text" class="form-control"
|
||||
placeholder="LDAP服务器IP或域名"/>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="form-check-label"><input id="edit-ldap-ssl" type="checkbox" class="form-check-input"/> 使用 SSL</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-group-sm">
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: utf8 -*-
|
||||
TP_SERVER_VER = "3.5.6"
|
||||
TP_ASSIST_REQUIRE_VER = "3.5.5"
|
||||
# -*- coding: utf8 -*-
|
||||
TP_SERVER_VER = "3.5.6"
|
||||
TP_ASSIST_REQUIRE_VER = "3.5.5"
|
||||
TP_STATE_VER = "rc6"
|
||||
|
|
|
@ -595,6 +595,8 @@ class AppConfig(BaseAppConfig):
|
|||
self.sys.ldap.server = ''
|
||||
if not self.sys.ldap.is_exists('port'):
|
||||
self.sys.ldap.port = 389
|
||||
if not self.sys.ldap.is_exists('use_ssl'):
|
||||
self.sys.ldap.use = False
|
||||
if not self.sys.ldap.is_exists('domain'):
|
||||
self.sys.ldap.domain = ''
|
||||
if not self.sys.ldap.is_exists('admin'):
|
||||
|
|
|
@ -70,7 +70,7 @@ class DatabaseInit:
|
|||
# name: 配置项名称
|
||||
f.append('`name` varchar(64) NOT NULL')
|
||||
# name: 配置项内容
|
||||
f.append('`value` varchar(255) NOT NULL')
|
||||
f.append('`value` TEXT')
|
||||
|
||||
# 设置主键
|
||||
f.append('PRIMARY KEY (`name` ASC)')
|
||||
|
|
|
@ -119,7 +119,7 @@ def tp_send_mail(recipient, message, subject=None, sender=None, cc=None, bcc=Non
|
|||
except:
|
||||
pass
|
||||
|
||||
if _password is not None:
|
||||
if _password is not None and len(_password) > 0:
|
||||
_smtp.login(_username, _password)
|
||||
|
||||
_smtp.set_debuglevel(0)
|
||||
|
|
|
@ -284,7 +284,6 @@ class DoSaveCfgHandler(TPBaseJsonHandler):
|
|||
tp_cfg().sys.glob.url_proto = _url_proto
|
||||
else:
|
||||
return self.write_json(err)
|
||||
|
||||
|
||||
if 'password' in args:
|
||||
processed = True
|
||||
|
@ -371,6 +370,7 @@ class DoSaveCfgHandler(TPBaseJsonHandler):
|
|||
# _password = _cfg['password']
|
||||
_server = _cfg['server']
|
||||
_port = _cfg['port']
|
||||
_use_ssl = _cfg['use_ssl']
|
||||
_domain = _cfg['domain']
|
||||
_admin = _cfg['admin']
|
||||
_base_dn = _cfg['base_dn']
|
||||
|
@ -391,6 +391,7 @@ class DoSaveCfgHandler(TPBaseJsonHandler):
|
|||
if err == TPE_OK:
|
||||
tp_cfg().sys.ldap.server = _server
|
||||
tp_cfg().sys.ldap.port = _port
|
||||
tp_cfg().sys.ldap.use_ssl = _use_ssl
|
||||
tp_cfg().sys.ldap.domain = _domain
|
||||
tp_cfg().sys.ldap.admin = _admin
|
||||
tp_cfg().sys.ldap.base_dn = _base_dn
|
||||
|
@ -478,7 +479,7 @@ class DoLdapListUserAttrHandler(TPBaseJsonHandler):
|
|||
return self.write_json(TPE_PARAM)
|
||||
|
||||
try:
|
||||
ldap = Ldap(cfg['server'], cfg['port'], cfg['base_dn'])
|
||||
ldap = Ldap(cfg['server'], cfg['port'], cfg['base_dn'], cfg['use_ssl'])
|
||||
ret, data, err_msg = ldap.get_all_attr(cfg['admin'], cfg['password'], cfg['filter'])
|
||||
if ret != TPE_OK:
|
||||
return self.write_json(ret, message=err_msg)
|
||||
|
@ -516,7 +517,7 @@ class DoLdapConfigTestHandler(TPBaseJsonHandler):
|
|||
return self.write_json(TPE_PARAM)
|
||||
|
||||
try:
|
||||
ldap = Ldap(cfg['server'], cfg['port'], cfg['base_dn'])
|
||||
ldap = Ldap(cfg['server'], cfg['port'], cfg['base_dn'], cfg['use_ssl'])
|
||||
ret, data, err_msg = ldap.list_users(
|
||||
cfg['admin'], cfg['password'], cfg['filter'],
|
||||
cfg['attr_username'], cfg['attr_surname'], cfg['attr_email'],
|
||||
|
@ -554,6 +555,7 @@ class DoLdapGetUsersHandler(TPBaseJsonHandler):
|
|||
_password = tp_cfg().sys_ldap_password
|
||||
_server = tp_cfg().sys.ldap.server
|
||||
_port = tp_cfg().sys.ldap.port
|
||||
_use_ssl = tp_cfg().sys.ldap.use_ssl
|
||||
_admin = tp_cfg().sys.ldap.admin
|
||||
_base_dn = tp_cfg().sys.ldap.base_dn
|
||||
_filter = tp_cfg().sys.ldap.filter
|
||||
|
@ -564,7 +566,7 @@ class DoLdapGetUsersHandler(TPBaseJsonHandler):
|
|||
return self.write_json(TPE_PARAM)
|
||||
|
||||
try:
|
||||
ldap = Ldap(_server, _port, _base_dn)
|
||||
ldap = Ldap(_server, _port, _base_dn, _use_ssl)
|
||||
ret, data, err_msg = ldap.list_users(_admin, _password, _filter, _attr_username, _attr_surname, _attr_email)
|
||||
if ret != TPE_OK:
|
||||
return self.write_json(ret, message=err_msg)
|
||||
|
@ -618,6 +620,7 @@ class DoLdapImportHandler(TPBaseJsonHandler):
|
|||
_password = tp_cfg().sys_ldap_password
|
||||
_server = tp_cfg().sys.ldap.server
|
||||
_port = tp_cfg().sys.ldap.port
|
||||
_use_ssl = tp_cfg().sys.ldap.use_ssl
|
||||
_admin = tp_cfg().sys.ldap.admin
|
||||
_base_dn = tp_cfg().sys.ldap.base_dn
|
||||
_filter = tp_cfg().sys.ldap.filter
|
||||
|
@ -628,7 +631,7 @@ class DoLdapImportHandler(TPBaseJsonHandler):
|
|||
return self.write_json(TPE_PARAM)
|
||||
|
||||
try:
|
||||
ldap = Ldap(_server, _port, _base_dn)
|
||||
ldap = Ldap(_server, _port, _base_dn, _use_ssl)
|
||||
ret, data, err_msg = ldap.list_users(_admin, _password, _filter, _attr_username, _attr_surname, _attr_email)
|
||||
|
||||
if ret != TPE_OK:
|
||||
|
|
|
@ -8,8 +8,8 @@ from app.const import *
|
|||
|
||||
|
||||
class Ldap(object):
|
||||
def __init__(self, ldap_host, ldap_port, base_dn):
|
||||
self._server = ldap3.Server(ldap_host, ldap_port, connect_timeout=5, use_ssl=False)
|
||||
def __init__(self, ldap_host, ldap_port, base_dn, use_ssl):
|
||||
self._server = ldap3.Server(ldap_host, ldap_port, connect_timeout=5, use_ssl=use_ssl)
|
||||
self._base_dn = base_dn
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -15,3 +15,4 @@ TP_TPCORE 3.5.5 # 核心服务 tp_core 的版本
|
|||
TP_TPWEB 3.1.0 # web服务 tp_web 的版本(一般除非升级Python,否则不会变化)
|
||||
TP_ASSIST 3.5.6 # 助手版本
|
||||
TP_ASSIST_REQUIRE 3.5.5 # 适配的助手最低版本
|
||||
TP_STATE rc6 # 版本状态,可以是 beta1,rc2 等,用于打包文件名及部分界面。如果是 release 则忽略。
|
||||
|
|
Loading…
Reference in New Issue