From e1b3851be392eafaa2d19931bd7c6503c4ac43f7 Mon Sep 17 00:00:00 2001 From: halo Date: Sat, 16 Jul 2022 20:44:32 +0800 Subject: [PATCH 1/5] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=B5=84?= =?UTF-8?q?=E4=BA=A7=E8=8A=82=E7=82=B9=E6=90=9C=E7=B4=A2=EF=BC=8C=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=85=A8=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/api/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/assets/api/node.py b/apps/assets/api/node.py index 3d5d22178..2bb77b60c 100644 --- a/apps/assets/api/node.py +++ b/apps/assets/api/node.py @@ -43,7 +43,7 @@ __all__ = [ class NodeViewSet(SuggestionMixin, OrgBulkModelViewSet): model = Node filterset_fields = ('value', 'key', 'id') - search_fields = ('value',) + search_fields = ('full_value',) serializer_class = serializers.NodeSerializer rbac_perms = { 'match': 'assets.match_node', From de61e780e3db3240216d0740b4e24706a182c565 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 18 Jul 2022 10:33:21 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E7=9A=84=E7=BF=BB=E8=AF=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/locale/ja/LC_MESSAGES/django.po | 2 +- apps/locale/zh/LC_MESSAGES/django.po | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index 1ade4540a..54c5c70f0 100644 --- a/apps/locale/ja/LC_MESSAGES/django.po +++ b/apps/locale/ja/LC_MESSAGES/django.po @@ -4959,7 +4959,7 @@ msgstr "リンク期限切れ" #: terminal/models/sharing.py:68 msgid "User not allowed to join" -msgstr "IPは許可されていません" +msgstr "ユーザーはセッションに参加できません" #: terminal/models/sharing.py:85 terminal/serializers/sharing.py:59 msgid "Joiner" diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 6f50d5c61..15cb33b57 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -4883,7 +4883,7 @@ msgstr "链接过期" #: terminal/models/sharing.py:68 msgid "User not allowed to join" -msgstr "来源 IP 不被允许登录" +msgstr "该用户无权加入会话" #: terminal/models/sharing.py:85 terminal/serializers/sharing.py:59 msgid "Joiner" From 2ca72a4bff6b9327f9d8092047a276c3e15a4949 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 18 Jul 2022 11:23:45 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=AA=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=94=A8=E6=88=B7=EF=BC=8C=E6=97=A0=E6=B3=95=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=85=B1=E4=BA=AB=E4=BC=9A=E8=AF=9D=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/models/sharing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/terminal/models/sharing.py b/apps/terminal/models/sharing.py index 6976b09cf..8675ced01 100644 --- a/apps/terminal/models/sharing.py +++ b/apps/terminal/models/sharing.py @@ -43,6 +43,8 @@ class SessionSharing(CommonModelMixin, OrgModelMixin): return 'Creator: {}'.format(self.creator) def users_display(self): + if not self.users: + return [] with tmp_to_root_org(): user_ids = self.users.split(',') users = User.objects.filter(id__in=user_ids) From 5055d140fd34a04b68aff41e581097d6af14f8c4 Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Mon, 18 Jul 2022 11:29:02 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dhost=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/api/connection_token.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/authentication/api/connection_token.py b/apps/authentication/api/connection_token.py index f0a7e0a63..60b91e4db 100644 --- a/apps/authentication/api/connection_token.py +++ b/apps/authentication/api/connection_token.py @@ -91,6 +91,11 @@ class ConnectionTokenMixin: "config": rdp_config } + def get_host(self, endpoint): + if not endpoint.host: + return self.request.get_host() + return endpoint.host + def get_rdp_file_info(self, token: ConnectionToken): rdp_options = { 'full address:s': '', @@ -140,7 +145,9 @@ class ConnectionTokenMixin: endpoint = self.get_smart_endpoint( protocol='rdp', asset=token.asset, application=token.application ) - rdp_options['full address:s'] = f'{endpoint.host}:{endpoint.rdp_port}' + # TODO 暂时获取一下host,后续优化 + host = self.get_host(endpoint) + rdp_options['full address:s'] = f'{host}:{endpoint.rdp_port}' # 设置用户名 rdp_options['username:s'] = '{}|{}'.format(token.user.username, str(token.id)) @@ -192,8 +199,10 @@ class ConnectionTokenMixin: endpoint = self.get_smart_endpoint( protocol='ssh', asset=token.asset, application=token.application ) + # TODO 暂时获取一下host,后续优化 + host = self.get_host(endpoint) data = { - 'ip': endpoint.host, + 'ip': host, 'port': str(endpoint.ssh_port), 'username': 'JMS-{}'.format(str(token.id)), 'password': token.secret From af5295d30eb15eec943d2fe2e6a18c66ea136145 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Mon, 18 Jul 2022 11:53:47 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20django=20=E8=BF=98=E5=8E=9F=20(#8609?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng626 <1304903146@qq.com> --- requirements/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 75e397656..afe9b7179 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -62,7 +62,7 @@ jsonfield2==4.0.0.post0 geoip2==4.5.0 ipip-ipdb==1.6.1 # Django environment -Django==3.2.14 +Django==3.2.13 django-bootstrap3==14.2.0 django-filter==2.4.0 django-formtools==2.2