From 9fa6b3e38736b15abcafaf81a4333d0f95218fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=B9=BF?= Date: Fri, 27 Apr 2018 21:23:18 +0800 Subject: [PATCH 1/5] =?UTF-8?q?[Update]=20=E6=9A=82=E6=97=B6=E9=9A=90?= =?UTF-8?q?=E8=97=8Frdp=E7=9A=84session=EF=BC=8C=E7=AD=89=E5=BE=85windows?= =?UTF-8?q?=E5=BD=95=E5=83=8F=E6=92=AD=E6=94=BE=20(#1276)=20(#1278)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/views/session.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/terminal/views/session.py b/apps/terminal/views/session.py index 3b66baff7..24e323647 100644 --- a/apps/terminal/views/session.py +++ b/apps/terminal/views/session.py @@ -47,7 +47,8 @@ class SessionListView(AdminUserRequiredMixin, DatetimeSearchMixin, ListView): filter_kwargs['system_user'] = self.system_user if filter_kwargs: self.queryset = self.queryset.filter(**filter_kwargs) - return self.queryset + # Todo: 暂时隐藏rdp + return self.queryset.filter(protocol='ssh') def get_context_data(self, **kwargs): context = { From 966123e4c63cb3ad044a7e6feb204f6e0287d31d Mon Sep 17 00:00:00 2001 From: zhangbohan Date: Thu, 3 May 2018 22:48:24 +0800 Subject: [PATCH 2/5] =?UTF-8?q?README=E5=8A=9F=E8=83=BD=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e44a23f9c..a0cce780d 100644 --- a/README.md +++ b/README.md @@ -19,14 +19,8 @@ Jumpserver采纳分布式架构,支持多机房跨区域部署,中心节点 ---- ### 功能 - - 统一认证 - - 资产管理 - - 统一授权 - - 审计 - - 支持LDAP认证 - - Web terminal - - SSH Server - - 支持Windows RDP + + ![Jumpserver功能](https://jumpserver-release.oss-cn-hangzhou.aliyuncs.com/Jumpserver%201.3%20%E5%8A%9F%E8%83%BD%E8%A1%A8%E6%A0%BC.001.jpeg "Jumpserver功能") ### 开始使用 From 7a27021d3d9fa294c8a6bc486d144c4d5b7fa27b Mon Sep 17 00:00:00 2001 From: zhangbohan Date: Thu, 3 May 2018 23:02:12 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=9B=BE=E7=89=87=E8=B0=83=E5=B0=8F?= =?UTF-8?q?=E4=B8=80=E4=BA=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a0cce780d..df8324761 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Jumpserver采纳分布式架构,支持多机房跨区域部署,中心节点 ### 功能 - ![Jumpserver功能](https://jumpserver-release.oss-cn-hangzhou.aliyuncs.com/Jumpserver%201.3%20%E5%8A%9F%E8%83%BD%E8%A1%A8%E6%A0%BC.001.jpeg "Jumpserver功能") + ![Jumpserver功能](https://jumpserver-release.oss-cn-hangzhou.aliyuncs.com/Jumpserver13.jpg "Jumpserver功能") ### 开始使用 From e630321e55bd1f8b165f8b5e5651d4995f1232de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=B9=BF?= Date: Fri, 4 May 2018 15:04:39 +0800 Subject: [PATCH 4/5] Perms return (#1293) (#1294) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Update] 修改版本号 * [Update] 默认关闭定时任务 * [Update] 修改授权列表创建api,返回id * [Update] 修改用户名校验规则 --- apps/assets/tasks.py | 2 +- apps/common/validators.py | 2 +- apps/perms/serializers.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/assets/tasks.py b/apps/assets/tasks.py index dd660bc42..f1773df11 100644 --- a/apps/assets/tasks.py +++ b/apps/assets/tasks.py @@ -22,7 +22,7 @@ TIMEOUT = 60 logger = get_logger(__file__) CACHE_MAX_TIME = 60*60*60 disk_pattern = re.compile(r'^hd|sd|xvd|vd') -PERIOD_TASK = os.environ.get("PERIOD_TASK", "on") +PERIOD_TASK = os.environ.get("PERIOD_TASK", "off") @shared_task diff --git a/apps/common/validators.py b/apps/common/validators.py index 9a4c1e501..b273bd1de 100644 --- a/apps/common/validators.py +++ b/apps/common/validators.py @@ -4,4 +4,4 @@ from django.core.validators import RegexValidator from django.utils.translation import ugettext_lazy as _ -alphanumeric = RegexValidator(r'^[0-9a-zA-Z_-]*$', _('Special char not allowed')) \ No newline at end of file +alphanumeric = RegexValidator(r'^[0-9a-zA-Z_@\-\.]*$', _('Special char not allowed')) \ No newline at end of file diff --git a/apps/perms/serializers.py b/apps/perms/serializers.py index baa823a6f..0f0419eff 100644 --- a/apps/perms/serializers.py +++ b/apps/perms/serializers.py @@ -9,7 +9,7 @@ from common.fields import StringManyToManyField class AssetPermissionCreateUpdateSerializer(serializers.ModelSerializer): class Meta: model = AssetPermission - exclude = ('id', 'created_by', 'date_created') + exclude = ('created_by', 'date_created') class AssetPermissionListSerializer(serializers.ModelSerializer): From dfd98f8aea9b01b92a9cd297a1b239f489dfb4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=B9=BF?= Date: Tue, 8 May 2018 09:06:33 +0800 Subject: [PATCH 5/5] Dev (#1299) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Update] 修改版本号 * [Update] 默认关闭定时任务 * [Update] 修改授权列表创建api,返回id * [Update] 修改用户名校验规则 * Perms return (#1293) * [Update] 修改版本号 * [Update] 默认关闭定时任务 * [Update] 修改授权列表创建api,返回id * [Update] 修改用户名校验规则 * [Update] 添加ldap auth timeout时间 * [Update] 修改replay api (#1298) --- apps/jumpserver/settings.py | 3 ++ apps/terminal/api.py | 50 ++++++++++++---------------------- apps/terminal/views/session.py | 3 +- 3 files changed, 22 insertions(+), 34 deletions(-) diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index 0afcd4e72..b75b73ec9 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -329,6 +329,9 @@ AUTH_LDAP_GROUP_SEARCH_FILTER = CONFIG.AUTH_LDAP_GROUP_SEARCH_FILTER AUTH_LDAP_GROUP_SEARCH = LDAPSearch( AUTH_LDAP_GROUP_SEARCH_OU, ldap.SCOPE_SUBTREE, AUTH_LDAP_GROUP_SEARCH_FILTER ) +AUTH_LDAP_CONNECTION_OPTIONS = { + ldap.TIMEOUT: 5 +} AUTH_LDAP_ALWAYS_UPDATE_USER = True AUTH_LDAP_BACKEND = 'django_auth_ldap.backend.LDAPBackend' diff --git a/apps/terminal/api.py b/apps/terminal/api.py index a964e9729..eb4b6400a 100644 --- a/apps/terminal/api.py +++ b/apps/terminal/api.py @@ -304,40 +304,24 @@ class SessionReplayViewSet(viewsets.ViewSet): return HttpResponseNotFound() -class SessionReplayV2ViewSet(viewsets.ViewSet): +class SessionReplayV2ViewSet(SessionReplayViewSet): serializer_class = ReplaySerializer permission_classes = (IsSuperUserOrAppUser,) session = None - def gen_session_path(self): - date = self.session.date_start.strftime('%Y-%m-%d') - replay = { - "id": self.session.id, - # "width": 100, - # "heith": 100 - } - if self.session.protocol == "ssh": - replay['type'] = "json" - replay['path'] = os.path.join(date, str(self.session.id) + '.gz') - return replay - elif self.session.protocol == "rdp": - replay['type'] = "mp4" - replay['path'] = os.path.join(date, str(self.session.id) + '.mp4') - return replay - else: - return replay - def retrieve(self, request, *args, **kwargs): session_id = kwargs.get('pk') self.session = get_object_or_404(Session, id=session_id) - replay = self.gen_session_path() - - if replay.get("path", "") == "": - return HttpResponseNotFound() + path = self.gen_session_path() + data = { + 'type': 'guacamole' if self.session.protocol == 'rdp' else 'json', + 'src': '', + } - if default_storage.exists(replay["path"]): - replay["src"] = default_storage.url(replay["path"]) - return Response(replay) + if default_storage.exists(path): + url = default_storage.url(path) + data['src'] = url + return Response(data) else: configs = settings.TERMINAL_REPLAY_STORAGE.items() if not configs: @@ -345,13 +329,15 @@ class SessionReplayV2ViewSet(viewsets.ViewSet): for name, config in configs: client = jms_storage.init(config) + date = self.session.date_start.strftime('%Y-%m-%d') + file_path = os.path.join(date, str(self.session.id) + '.replay.gz') + target_path = default_storage.base_location + '/' + path - target_path = default_storage.base_location + '/' + replay["path"] - - if client and client.has_file(replay["path"]) and \ - client.download_file(replay["path"], target_path): - replay["src"] = default_storage.url(replay["path"]) - return Response(replay) + if client and client.has_file(file_path) and \ + client.download_file(file_path, target_path): + url = default_storage.url(path) + data['src'] = url + return Response(data) return HttpResponseNotFound() diff --git a/apps/terminal/views/session.py b/apps/terminal/views/session.py index 24e323647..3b66baff7 100644 --- a/apps/terminal/views/session.py +++ b/apps/terminal/views/session.py @@ -47,8 +47,7 @@ class SessionListView(AdminUserRequiredMixin, DatetimeSearchMixin, ListView): filter_kwargs['system_user'] = self.system_user if filter_kwargs: self.queryset = self.queryset.filter(**filter_kwargs) - # Todo: 暂时隐藏rdp - return self.queryset.filter(protocol='ssh') + return self.queryset def get_context_data(self, **kwargs): context = {