Compare commits

...

10 Commits
v4.0 ... v2.9

Author SHA1 Message Date
ibuler
ce2bbf08e7 fix: 修复周期监测任务配置的bug 2021-05-21 10:35:19 +08:00
老广
58c00ca09d Merge pull request #6050 from jumpserver/pr@v2.9@fix_expire_caches
fix: 添加启动失效缓存
2021-04-27 03:12:31 -05:00
xinwen
1e35fee1c9 fix: 添加启动失效缓存 2021-04-27 08:11:10 +00:00
Bai
87189412fe fix: 修改ACL提示支持的协议为: ssh、telnet 2021-04-23 16:35:26 +08:00
Bai
471cb45535 perf: 修改Latest version 2021-04-22 18:52:38 +08:00
Bai
11b0aa3b12 fix: 修复操作应用/应用授权/acl等未记录日志的问题2 2021-04-20 16:47:08 +08:00
ibuler
4b1b63f7b8 fix: 修复i18n一个翻译问题 2021-04-20 13:09:44 +08:00
Bai
512534715b fix: 修复操作应用/应用授权/acl等未记录日志的问题 2021-04-20 00:07:34 -05:00
ibuler
761ff5091a fix(task): 修复推送过期的问题 2021-04-19 22:42:30 -05:00
ibuler
87894df126 fix: 修复创建的系统用户很快过期的问题 2021-04-19 17:01:18 +08:00
12 changed files with 63 additions and 16 deletions

View File

@@ -33,6 +33,9 @@ class LoginACL(BaseACL):
class Meta:
ordering = ('priority', '-date_updated', 'name')
def __str__(self):
return self.name
@property
def action_reject(self):
return self.action == self.ActionChoices.reject

View File

@@ -38,6 +38,9 @@ class LoginAssetACL(BaseACL, OrgModelMixin):
unique_together = ('name', 'org_id')
ordering = ('priority', '-date_updated', 'name')
def __str__(self):
return self.name
@classmethod
def filter(cls, user, asset, system_user, action):
queryset = cls.objects.filter(action=action)

View File

@@ -54,7 +54,7 @@ class LoginAssetACLSystemUsersSerializer(serializers.Serializer):
protocol_group = serializers.ListField(
default=['*'], child=serializers.CharField(max_length=16), label=_('Protocol'),
help_text=protocol_group_help_text.format(
', '.join(SystemUser.ASSET_CATEGORY_PROTOCOLS)
', '.join([SystemUser.PROTOCOL_SSH, SystemUser.PROTOCOL_TELNET])
)
)

View File

@@ -56,8 +56,8 @@ def get_push_unixlike_system_user_tasks(system_user, username=None):
'shell': system_user.shell or Empty,
'state': 'present',
'home': system_user.home or Empty,
'expires': -1,
'groups': groups or Empty,
'expires': 99999,
'comment': comment
}

View File

@@ -27,11 +27,23 @@ json_render = JSONRenderer()
MODELS_NEED_RECORD = (
'User', 'UserGroup', 'Asset', 'Node', 'AdminUser', 'SystemUser',
'Domain', 'Gateway', 'Organization', 'AssetPermission', 'CommandFilter',
'CommandFilterRule', 'License', 'Setting', 'Account', 'SyncInstanceTask',
'Platform', 'ChangeAuthPlan', 'GatherUserTask',
'RemoteApp', 'RemoteAppPermission', 'DatabaseApp', 'DatabaseAppPermission',
# users
'User', 'UserGroup',
# acls
'LoginACL', 'LoginAssetACL',
# 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',
)

View 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()

View File

@@ -1 +1,2 @@

View File

@@ -268,7 +268,7 @@ class Config(dict):
'WINDOWS_SSH_DEFAULT_SHELL': 'cmd',
'FLOWER_URL': "127.0.0.1:5555",
'DEFAULT_ORG_SHOW_ALL_USERS': True,
'PERIOD_TASK_ENABLE': True,
'PERIOD_TASK_ENABLED': True,
'FORCE_SCRIPT_NAME': '',
'LOGIN_CONFIRM_ENABLE': False,
'WINDOWS_SKIP_ALL_MANUAL_PASSWORD': False,

Binary file not shown.

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: JumpServer 0.3.3\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"
"Last-Translator: ibuler <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"
msgstr "自检程序已经在运行,不能重复启动"
#: assets/tasks/push_system_user.py:192
#: assets/tasks/push_system_user.py:193
#: assets/tasks/system_user_connectivity.py:89
msgid "System user is dynamic: {}"
msgstr "系统用户是动态的: {}"
#: assets/tasks/push_system_user.py:232
#: assets/tasks/push_system_user.py:233
msgid "Start push system user for platform: [{}]"
msgstr "推送系统用户到平台: [{}]"
#: assets/tasks/push_system_user.py:233
#: assets/tasks/push_system_user.py:234
#: assets/tasks/system_user_connectivity.py:81
msgid "Hosts count: {}"
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: {}"
msgstr "推送系统用户到入资产: {}"
#: assets/tasks/push_system_user.py:284
#: assets/tasks/push_system_user.py:285
msgid "Push system users to asset: {}({}) => {}"
msgstr "推送系统用户到入资产: {}({}) => {}"
@@ -3036,7 +3036,7 @@ msgstr "正常"
#: terminal/const.py:34
msgid "Offline"
msgstr ""
msgstr "离线"
#: terminal/exceptions.py:8
msgid "Bulk create not support"

View File

@@ -122,7 +122,7 @@ REDIS_PORT: 6379
# USER_LOGIN_SINGLE_MACHINE_ENABLED: False
#
# 启用定时任务
# PERIOD_TASK_ENABLE: True
# PERIOD_TASK_ENABLED: True
#
# 启用二次复合认证配置
# LOGIN_CONFIRM_ENABLE: False

9
jms
View File

@@ -97,6 +97,14 @@ def check_migrations():
# 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():
logging.info("Check database structure change ...")
os.chdir(os.path.join(BASE_DIR, 'apps'))
@@ -116,6 +124,7 @@ def prepare():
check_database_connection()
check_migrations()
upgrade_db()
expire_caches()
def check_pid(pid):