diff --git a/apps/assets/migrations/0123_auto_20230802_1740.py b/apps/assets/migrations/0123_auto_20230802_1740.py new file mode 100644 index 000000000..904b9f379 --- /dev/null +++ b/apps/assets/migrations/0123_auto_20230802_1740.py @@ -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) + ] diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index 98a6477d4..eb339f8a1 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -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/', diff --git a/apps/jumpserver/settings/custom.py b/apps/jumpserver/settings/custom.py index 16d503f1c..71c90cef3 100644 --- a/apps/jumpserver/settings/custom.py +++ b/apps/jumpserver/settings/custom.py @@ -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 diff --git a/apps/locale/ja/LC_MESSAGES/django.mo b/apps/locale/ja/LC_MESSAGES/django.mo index e2cc899ec..4b1734de2 100644 --- a/apps/locale/ja/LC_MESSAGES/django.mo +++ b/apps/locale/ja/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:538beabe7c224b203bbc0ebaf191509a8f407f6b3e8194038fc203bde10d6d5a -size 150250 +oid sha256:d9e79f70d055fa4d3fda971820bcd0eb186a8806d91346c7038add4ee89d647a +size 151115 diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index b4b3b2634..3c45e852b 100644 --- a/apps/locale/ja/LC_MESSAGES/django.po +++ b/apps/locale/ja/LC_MESSAGES/django.po @@ -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 diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index 00fe60499..da572bc13 100644 --- a/apps/locale/zh/LC_MESSAGES/django.mo +++ b/apps/locale/zh/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2cf5749656bd07818b67191c2f665246e903d74e76c49ebcdec6004322f75314 -size 122767 +oid sha256:f70c68e6f9f5cd621ae5ff04e73bb882d4849d3750a8c34f586dc3cc74adfca4 +size 123431 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 9c21b13d7..2136158ea 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -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 diff --git a/apps/settings/serializers/terminal.py b/apps/settings/serializers/terminal.py index 86465009e..ea1412cd1 100644 --- a/apps/settings/serializers/terminal.py +++ b/apps/settings/serializers/terminal.py @@ -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"))