perf: 修改 telnet 平台 setting

pull/11182/head
ibuler 2023-08-02 17:54:11 +08:00
parent 4ef05a1cd4
commit 41fa1d65ff
8 changed files with 51 additions and 35 deletions

View File

@ -0,0 +1,33 @@
# Generated by Django 4.1.10 on 2023-08-02 09:40
from django.db import migrations
import json
def migrate_telnet_regex(apps, schema_editor):
setting_cls = apps.get_model('settings', 'Setting')
setting = setting_cls.objects.filter(name='TERMINAL_TELNET_REGEX').first()
if not setting:
print("Not found telnet regex setting, skip")
return
try:
value = json.loads(setting.value)
except Exception:
print("Invalid telnet regex setting, skip")
return
platform_protocol_cls = apps.get_model('assets', 'PlatformProtocol')
telnets = platform_protocol_cls.objects.filter(name='telnet')
if telnets.count() > 0:
telnets.update(setting={'success_prompt': value})
print("Migrate telnet regex setting success: ", telnets.count())
class Migration(migrations.Migration):
dependencies = [
('assets', '0122_auto_20230801_1940'),
]
operations = [
migrations.RunPython(migrate_telnet_regex)
]

View File

@ -449,7 +449,6 @@ class Config(dict):
'TERMINAL_ASSET_LIST_PAGE_SIZE': 'auto',
'TERMINAL_SESSION_KEEP_DURATION': 200,
'TERMINAL_HOST_KEY': '',
'TERMINAL_TELNET_REGEX': '',
'TERMINAL_COMMAND_STORAGE': {},
# Luna 页面
# 默认图形化分辨率
@ -554,6 +553,7 @@ class Config(dict):
'TICKET_AUTHORIZE_DEFAULT_TIME': 7,
'TICKET_AUTHORIZE_DEFAULT_TIME_UNIT': 'day',
'PERIOD_TASK_ENABLED': True,
'TERMINAL_TELNET_REGEX': '',
# 导航栏 帮助
'HELP_DOCUMENT_URL': 'https://docs.jumpserver.org/zh/v3/',

View File

@ -82,7 +82,7 @@ TERMINAL_ASSET_LIST_PAGE_SIZE = CONFIG.TERMINAL_ASSET_LIST_PAGE_SIZE
TERMINAL_SESSION_KEEP_DURATION = CONFIG.TERMINAL_SESSION_KEEP_DURATION
TERMINAL_HOST_KEY = CONFIG.TERMINAL_HOST_KEY
TERMINAL_HEADER_TITLE = CONFIG.TERMINAL_HEADER_TITLE
TERMINAL_TELNET_REGEX = CONFIG.TERMINAL_TELNET_REGEX
# TERMINAL_TELNET_REGEX = CONFIG.TERMINAL_TELNET_REGEX
# 默认图形化分辨率
TERMINAL_GRAPHICAL_RESOLUTION = CONFIG.TERMINAL_GRAPHICAL_RESOLUTION

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:538beabe7c224b203bbc0ebaf191509a8f407f6b3e8194038fc203bde10d6d5a
size 150250
oid sha256:d9e79f70d055fa4d3fda971820bcd0eb186a8806d91346c7038add4ee89d647a
size 151115

View File

@ -1200,34 +1200,28 @@ msgid "AD domain"
msgstr "AD ドメイン"
#: assets/const/protocol.py:88
#, fuzzy
#| msgid "Username attr"
msgid "Username prompt"
msgstr "ユーザー名のプロパティ"
msgstr "ユーザー名プロンプト"
#: assets/const/protocol.py:89
msgid "We will send username when we see this prompt"
msgstr ""
msgstr "このプロンプトが表示されたらユーザー名を送信します"
#: assets/const/protocol.py:94
#, fuzzy
#| msgid "Password auth"
msgid "Password prompt"
msgstr "パスワード認証"
msgstr "パスワードプロンプト"
#: assets/const/protocol.py:95
msgid "We will send password when we see this prompt"
msgstr ""
msgstr "このプロンプトが表示されたらパスワードを送信します"
#: assets/const/protocol.py:100
#, fuzzy
#| msgid "Success"
msgid "Success prompt"
msgstr "成功"
msgstr "成功プロンプト"
#: assets/const/protocol.py:101
msgid "We will consider login success when we see this prompt"
msgstr ""
msgstr "このプロンプトが表示されたらログイン成功とみなします"
#: assets/const/protocol.py:112 assets/models/asset/database.py:10
#: settings/serializers/email.py:37

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2cf5749656bd07818b67191c2f665246e903d74e76c49ebcdec6004322f75314
size 122767
oid sha256:f70c68e6f9f5cd621ae5ff04e73bb882d4849d3750a8c34f586dc3cc74adfca4
size 123431

View File

@ -1193,34 +1193,28 @@ msgid "AD domain"
msgstr "AD 网域"
#: assets/const/protocol.py:88
#, fuzzy
#| msgid "Username attr"
msgid "Username prompt"
msgstr "用户名属性"
msgstr "用户名提示"
#: assets/const/protocol.py:89
msgid "We will send username when we see this prompt"
msgstr ""
msgstr "当我们看到这个提示时,我们将发送用户名"
#: assets/const/protocol.py:94
#, fuzzy
#| msgid "Password auth"
msgid "Password prompt"
msgstr "密码认证"
msgstr "密码提示"
#: assets/const/protocol.py:95
msgid "We will send password when we see this prompt"
msgstr ""
msgstr "当我们看到这个提示时,我们将发送密码"
#: assets/const/protocol.py:100
#, fuzzy
#| msgid "Success"
msgid "Success prompt"
msgstr "成功"
msgstr "成功提示"
#: assets/const/protocol.py:101
msgid "We will consider login success when we see this prompt"
msgstr ""
msgstr "当我们看到这个提示时,我们将认为登录成功"
#: assets/const/protocol.py:112 assets/models/asset/database.py:10
#: settings/serializers/email.py:37

View File

@ -30,11 +30,6 @@ class TerminalSettingSerializer(serializers.Serializer):
TERMINAL_ASSET_LIST_PAGE_SIZE = serializers.ChoiceField(
PAGE_SIZE_CHOICES, required=False, label=_('List page size')
)
TERMINAL_TELNET_REGEX = serializers.CharField(
allow_blank=True, max_length=1024, required=False, label=_('Telnet login regex'),
help_text=_("Tips: The login success message varies with devices. "
"if you cannot log in to the device through Telnet, set this parameter")
)
TERMINAL_MAGNUS_ENABLED = serializers.BooleanField(label=_("Enable database proxy"))
TERMINAL_RAZOR_ENABLED = serializers.BooleanField(label=_("Enable Razor"))
TERMINAL_KOKO_SSH_ENABLED = serializers.BooleanField(label=_("Enable SSH Client"))