mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-12-15 08:32:48 +00:00
Compare commits
10 Commits
pr@dev@ter
...
v2.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce2bbf08e7 | ||
|
|
58c00ca09d | ||
|
|
1e35fee1c9 | ||
|
|
87189412fe | ||
|
|
471cb45535 | ||
|
|
11b0aa3b12 | ||
|
|
4b1b63f7b8 | ||
|
|
512534715b | ||
|
|
761ff5091a | ||
|
|
87894df126 |
@@ -33,6 +33,9 @@ class LoginACL(BaseACL):
|
|||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('priority', '-date_updated', 'name')
|
ordering = ('priority', '-date_updated', 'name')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def action_reject(self):
|
def action_reject(self):
|
||||||
return self.action == self.ActionChoices.reject
|
return self.action == self.ActionChoices.reject
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ class LoginAssetACL(BaseACL, OrgModelMixin):
|
|||||||
unique_together = ('name', 'org_id')
|
unique_together = ('name', 'org_id')
|
||||||
ordering = ('priority', '-date_updated', 'name')
|
ordering = ('priority', '-date_updated', 'name')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def filter(cls, user, asset, system_user, action):
|
def filter(cls, user, asset, system_user, action):
|
||||||
queryset = cls.objects.filter(action=action)
|
queryset = cls.objects.filter(action=action)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class LoginAssetACLSystemUsersSerializer(serializers.Serializer):
|
|||||||
protocol_group = serializers.ListField(
|
protocol_group = serializers.ListField(
|
||||||
default=['*'], child=serializers.CharField(max_length=16), label=_('Protocol'),
|
default=['*'], child=serializers.CharField(max_length=16), label=_('Protocol'),
|
||||||
help_text=protocol_group_help_text.format(
|
help_text=protocol_group_help_text.format(
|
||||||
', '.join(SystemUser.ASSET_CATEGORY_PROTOCOLS)
|
', '.join([SystemUser.PROTOCOL_SSH, SystemUser.PROTOCOL_TELNET])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ def get_push_unixlike_system_user_tasks(system_user, username=None):
|
|||||||
'shell': system_user.shell or Empty,
|
'shell': system_user.shell or Empty,
|
||||||
'state': 'present',
|
'state': 'present',
|
||||||
'home': system_user.home or Empty,
|
'home': system_user.home or Empty,
|
||||||
|
'expires': -1,
|
||||||
'groups': groups or Empty,
|
'groups': groups or Empty,
|
||||||
'expires': 99999,
|
|
||||||
'comment': comment
|
'comment': comment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,23 @@ json_render = JSONRenderer()
|
|||||||
|
|
||||||
|
|
||||||
MODELS_NEED_RECORD = (
|
MODELS_NEED_RECORD = (
|
||||||
'User', 'UserGroup', 'Asset', 'Node', 'AdminUser', 'SystemUser',
|
# users
|
||||||
'Domain', 'Gateway', 'Organization', 'AssetPermission', 'CommandFilter',
|
'User', 'UserGroup',
|
||||||
'CommandFilterRule', 'License', 'Setting', 'Account', 'SyncInstanceTask',
|
# acls
|
||||||
'Platform', 'ChangeAuthPlan', 'GatherUserTask',
|
'LoginACL', 'LoginAssetACL',
|
||||||
'RemoteApp', 'RemoteAppPermission', 'DatabaseApp', 'DatabaseAppPermission',
|
# assets
|
||||||
|
'Asset', 'Node', 'AdminUser', 'SystemUser', 'Domain', 'Gateway', 'CommandFilterRule',
|
||||||
|
'CommandFilter', 'Platform',
|
||||||
|
# applications
|
||||||
|
'Application',
|
||||||
|
# orgs
|
||||||
|
'Organization',
|
||||||
|
# settings
|
||||||
|
'Setting',
|
||||||
|
# perms
|
||||||
|
'AssetPermission', 'ApplicationPermission',
|
||||||
|
# xpack
|
||||||
|
'License', 'Account', 'SyncInstanceTask', 'ChangeAuthPlan', 'GatherUserTask',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
19
apps/common/management/commands/expire_caches.py
Normal file
19
apps/common/management/commands/expire_caches.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
from assets.signals_handler.node_assets_mapping import expire_node_assets_mapping_for_memory
|
||||||
|
from orgs.models import Organization
|
||||||
|
|
||||||
|
|
||||||
|
def expire_node_assets_mapping():
|
||||||
|
org_ids = Organization.objects.all().values_list('id', flat=True)
|
||||||
|
org_ids = [*org_ids, '00000000-0000-0000-0000-000000000000']
|
||||||
|
|
||||||
|
for org_id in org_ids:
|
||||||
|
expire_node_assets_mapping_for_memory(org_id)
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
help = 'Expire caches'
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
expire_node_assets_mapping()
|
||||||
@@ -1 +1,2 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ class Config(dict):
|
|||||||
'WINDOWS_SSH_DEFAULT_SHELL': 'cmd',
|
'WINDOWS_SSH_DEFAULT_SHELL': 'cmd',
|
||||||
'FLOWER_URL': "127.0.0.1:5555",
|
'FLOWER_URL': "127.0.0.1:5555",
|
||||||
'DEFAULT_ORG_SHOW_ALL_USERS': True,
|
'DEFAULT_ORG_SHOW_ALL_USERS': True,
|
||||||
'PERIOD_TASK_ENABLE': True,
|
'PERIOD_TASK_ENABLED': True,
|
||||||
'FORCE_SCRIPT_NAME': '',
|
'FORCE_SCRIPT_NAME': '',
|
||||||
'LOGIN_CONFIRM_ENABLE': False,
|
'LOGIN_CONFIRM_ENABLE': False,
|
||||||
'WINDOWS_SKIP_ALL_MANUAL_PASSWORD': False,
|
'WINDOWS_SKIP_ALL_MANUAL_PASSWORD': False,
|
||||||
|
|||||||
Binary file not shown.
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: JumpServer 0.3.3\n"
|
"Project-Id-Version: JumpServer 0.3.3\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2021-04-14 17:52+0800\n"
|
"POT-Creation-Date: 2021-04-20 11:56+0800\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
||||||
"Language-Team: JumpServer team<ibuler@qq.com>\n"
|
"Language-Team: JumpServer team<ibuler@qq.com>\n"
|
||||||
@@ -984,25 +984,25 @@ msgid ""
|
|||||||
"The task of self-checking is already running and cannot be started repeatedly"
|
"The task of self-checking is already running and cannot be started repeatedly"
|
||||||
msgstr "自检程序已经在运行,不能重复启动"
|
msgstr "自检程序已经在运行,不能重复启动"
|
||||||
|
|
||||||
#: assets/tasks/push_system_user.py:192
|
#: assets/tasks/push_system_user.py:193
|
||||||
#: assets/tasks/system_user_connectivity.py:89
|
#: assets/tasks/system_user_connectivity.py:89
|
||||||
msgid "System user is dynamic: {}"
|
msgid "System user is dynamic: {}"
|
||||||
msgstr "系统用户是动态的: {}"
|
msgstr "系统用户是动态的: {}"
|
||||||
|
|
||||||
#: assets/tasks/push_system_user.py:232
|
#: assets/tasks/push_system_user.py:233
|
||||||
msgid "Start push system user for platform: [{}]"
|
msgid "Start push system user for platform: [{}]"
|
||||||
msgstr "推送系统用户到平台: [{}]"
|
msgstr "推送系统用户到平台: [{}]"
|
||||||
|
|
||||||
#: assets/tasks/push_system_user.py:233
|
#: assets/tasks/push_system_user.py:234
|
||||||
#: assets/tasks/system_user_connectivity.py:81
|
#: assets/tasks/system_user_connectivity.py:81
|
||||||
msgid "Hosts count: {}"
|
msgid "Hosts count: {}"
|
||||||
msgstr "主机数量: {}"
|
msgstr "主机数量: {}"
|
||||||
|
|
||||||
#: assets/tasks/push_system_user.py:272 assets/tasks/push_system_user.py:298
|
#: assets/tasks/push_system_user.py:273 assets/tasks/push_system_user.py:299
|
||||||
msgid "Push system users to assets: {}"
|
msgid "Push system users to assets: {}"
|
||||||
msgstr "推送系统用户到入资产: {}"
|
msgstr "推送系统用户到入资产: {}"
|
||||||
|
|
||||||
#: assets/tasks/push_system_user.py:284
|
#: assets/tasks/push_system_user.py:285
|
||||||
msgid "Push system users to asset: {}({}) => {}"
|
msgid "Push system users to asset: {}({}) => {}"
|
||||||
msgstr "推送系统用户到入资产: {}({}) => {}"
|
msgstr "推送系统用户到入资产: {}({}) => {}"
|
||||||
|
|
||||||
@@ -3036,7 +3036,7 @@ msgstr "正常"
|
|||||||
|
|
||||||
#: terminal/const.py:34
|
#: terminal/const.py:34
|
||||||
msgid "Offline"
|
msgid "Offline"
|
||||||
msgstr ""
|
msgstr "离线"
|
||||||
|
|
||||||
#: terminal/exceptions.py:8
|
#: terminal/exceptions.py:8
|
||||||
msgid "Bulk create not support"
|
msgid "Bulk create not support"
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ REDIS_PORT: 6379
|
|||||||
# USER_LOGIN_SINGLE_MACHINE_ENABLED: False
|
# USER_LOGIN_SINGLE_MACHINE_ENABLED: False
|
||||||
#
|
#
|
||||||
# 启用定时任务
|
# 启用定时任务
|
||||||
# PERIOD_TASK_ENABLE: True
|
# PERIOD_TASK_ENABLED: True
|
||||||
#
|
#
|
||||||
# 启用二次复合认证配置
|
# 启用二次复合认证配置
|
||||||
# LOGIN_CONFIRM_ENABLE: False
|
# LOGIN_CONFIRM_ENABLE: False
|
||||||
|
|||||||
9
jms
9
jms
@@ -97,6 +97,14 @@ def check_migrations():
|
|||||||
# sys.exit(1)
|
# sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def expire_caches():
|
||||||
|
apps_dir = os.path.join(BASE_DIR, 'apps')
|
||||||
|
code = subprocess.call("python manage.py expire_caches", shell=True, cwd=apps_dir)
|
||||||
|
|
||||||
|
if code == 1:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def perform_db_migrate():
|
def perform_db_migrate():
|
||||||
logging.info("Check database structure change ...")
|
logging.info("Check database structure change ...")
|
||||||
os.chdir(os.path.join(BASE_DIR, 'apps'))
|
os.chdir(os.path.join(BASE_DIR, 'apps'))
|
||||||
@@ -116,6 +124,7 @@ def prepare():
|
|||||||
check_database_connection()
|
check_database_connection()
|
||||||
check_migrations()
|
check_migrations()
|
||||||
upgrade_db()
|
upgrade_db()
|
||||||
|
expire_caches()
|
||||||
|
|
||||||
|
|
||||||
def check_pid(pid):
|
def check_pid(pid):
|
||||||
|
|||||||
Reference in New Issue
Block a user