Compare commits

...

29 Commits

Author SHA1 Message Date
fit2bot
15491f6335 feat: Update v3.10.9 2024-04-23 19:40:34 +08:00
Aaron3S
4f287925f3 fix: 修复执行快捷命令时 local_connection 没有被正确设置 2024-04-23 19:06:53 +08:00
Bai
422478f9fb fix: Adhoc support mariadb with module of mysql 2024-04-23 18:56:49 +08:00
吴小白
a748a5f421 perf: 镜像添加 nc 命令 2024-04-23 16:53:07 +08:00
Bai
6f89fa245c fix: 修改配置 RECEPTOR_ENABLED=False 默认 2024-04-23 16:52:25 +08:00
Bai
31c5d9e717 fix: 修改配置 RECEPTOR_ENABLED 2024-04-23 15:02:40 +08:00
Aaron3S
a3a907e9bb feat: 修改 receptor 容器通信地址 2024-04-23 13:12:00 +08:00
Bai
361b367e30 perf: 优化 Web 资产详情时根据 autofill 类型返回对应的 spec_info 信息 2024-04-23 13:11:41 +08:00
jiangweidong
08bd628589 perf: 优化会话过期500问题 2024-04-23 13:11:15 +08:00
Bai
67277dd622 fix: 修复仪表盘会话排序数量都是 1 的问题 2024-04-22 19:42:33 +08:00
Bryan
82e7f020ea Merge pull request #13094 from jumpserver/dev
v3.10.9 (dev to master)
2024-04-22 19:39:53 +08:00
Bryan
f20b9e01ab Merge pull request #13062 from jumpserver/dev
v3.10.8 dev to master
2024-04-18 18:01:20 +08:00
Bryan
8cf8a3701b Merge pull request #13059 from jumpserver/dev
v3.10.8
2024-04-18 17:16:37 +08:00
Bryan
7ba24293d1 Merge pull request #12736 from jumpserver/pr@dev@master_fix
fix: 解决冲突
2024-02-29 16:38:43 +08:00
Bai
f10114c9ed fix: 解决冲突 2024-02-29 16:37:10 +08:00
Bryan
cf31cbfb07 Merge pull request #12729 from jumpserver/dev
v3.10.4
2024-02-29 16:19:59 +08:00
wangruidong
0edad24d5d fix: 资产过期消息提示发送失败 2024-02-04 11:41:48 +08:00
ibuler
1f1c1a9157 fix: 修复定时检测用户是否活跃任务无法执行的问题 2024-01-23 09:28:38 +00:00
feng
6c9d271ae1 fix: redis 密码有特殊字符celery beat启动失败 2024-01-22 06:18:34 +00:00
Bai
6ff852e225 perf: 修复 Count 时没有去重的问题 2024-01-22 06:16:25 +00:00
Bryan
baa75dc735 Merge pull request #12566 from jumpserver/master
v3.10.2
2024-01-17 07:34:28 -04:00
Bryan
8a9f0436b8 Merge pull request #12565 from jumpserver/dev
v3.10.2
2024-01-17 07:23:30 -04:00
Bryan
a9620a3cbe Merge pull request #12461 from jumpserver/master
v3.10.1
2023-12-29 11:33:05 +05:00
Bryan
769e7dc8a0 Merge pull request #12460 from jumpserver/dev
v3.10.1
2023-12-29 11:20:36 +05:00
Bryan
2a70449411 Merge pull request #12458 from jumpserver/dev
v3.10.1
2023-12-29 11:01:13 +05:00
Bryan
8df720f19e Merge pull request #12401 from jumpserver/dev
v3.10
2023-12-21 15:14:19 +05:00
老广
dabbb45f6e Merge pull request #12144 from jumpserver/dev
v3.9.0
2023-11-16 18:23:05 +08:00
Bryan
ce24c1c3fd Merge pull request #11914 from jumpserver/dev
v3.8.0
2023-10-19 03:37:39 -05:00
Bryan
3c54c82ce9 Merge pull request #11636 from jumpserver/dev
v3.7.0
2023-09-21 17:02:48 +08:00
13 changed files with 57 additions and 13 deletions

View File

@@ -87,6 +87,7 @@ ARG TOOLS=" \
default-mysql-client \
iputils-ping \
locales \
netcat-openbsd \
nmap \
openssh-client \
patch \

1
GITSHA Normal file
View File

@@ -0,0 +1 @@
4f287925f33da98c3f3a9b42dc7eacd2f990ad53

View File

@@ -22,6 +22,36 @@ class WebSpecSerializer(serializers.ModelSerializer):
'submit_selector', 'script'
]
def get_fields(self):
fields = super().get_fields()
if self.is_retrieve():
# 查看 Web 资产详情时
self.pop_fields_if_need(fields)
return fields
def is_retrieve(self):
try:
self.context.get('request').method and self.parent.instance.web
return True
except Exception:
return False
def pop_fields_if_need(self, fields):
fields_script = ['script']
fields_basic = ['username_selector', 'password_selector', 'submit_selector']
autofill = self.parent.instance.web.autofill
pop_fields_mapper = {
FillType.no: fields_script + fields_basic,
FillType.basic: fields_script,
FillType.script: fields_basic,
}
fields_pop = pop_fields_mapper.get(autofill, [])
for f in fields_pop:
fields.pop(f, None)
return fields
category_spec_serializer_map = {
'database': DatabaseSpecSerializer,

View File

@@ -50,7 +50,10 @@ class MFASendCodeApi(AuthMixin, CreateAPIView):
mfa_type = serializer.validated_data['type']
if not username:
user = self.get_user_from_session()
try:
user = self.get_user_from_session()
except errors.SessionEmptyError as e:
raise ValidationError({'error': e})
else:
user = self.get_user_from_db(username)

View File

@@ -617,9 +617,9 @@ class Config(dict):
'TICKET_APPLY_ASSET_SCOPE': 'all',
# Ansible Receptor
'ANSIBLE_RECEPTOR_ENABLED': True,
'RECEPTOR_ENABLED': False,
'ANSIBLE_RECEPTOR_GATEWAY_PROXY_HOST': 'jms_celery',
'ANSIBLE_RECEPTOR_TCP_LISTEN_ADDRESS': 'jms_receptor:7521'
'ANSIBLE_RECEPTOR_TCP_LISTEN_ADDRESS': 'receptor:7521'
}

View File

@@ -8,7 +8,7 @@ __all__ = ['BASE_DIR', 'PROJECT_DIR', 'VERSION', 'CONFIG']
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_DIR = os.path.dirname(BASE_DIR)
VERSION = '2.0.0'
VERSION = 'v3.10.9'
CONFIG = ConfigManager.load_user_config()

View File

@@ -232,6 +232,6 @@ FILE_UPLOAD_SIZE_LIMIT_MB = CONFIG.FILE_UPLOAD_SIZE_LIMIT_MB
TICKET_APPLY_ASSET_SCOPE = CONFIG.TICKET_APPLY_ASSET_SCOPE
# Ansible Receptor
ANSIBLE_RECEPTOR_ENABLED = CONFIG.ANSIBLE_RECEPTOR_ENABLED
RECEPTOR_ENABLED = CONFIG.RECEPTOR_ENABLED
ANSIBLE_RECEPTOR_GATEWAY_PROXY_HOST = CONFIG.ANSIBLE_RECEPTOR_GATEWAY_PROXY_HOST
ANSIBLE_RECEPTOR_TCP_LISTEN_ADDRESS = CONFIG.ANSIBLE_RECEPTOR_TCP_LISTEN_ADDRESS

View File

@@ -15,7 +15,7 @@ class _LazyRunnerInterface(LazyObject):
@staticmethod
def make_interface():
runner_type = AnsibleReceptorRunner \
if settings.ANSIBLE_RECEPTOR_ENABLED else AnsibleNativeRunner
if settings.RECEPTOR_ENABLED else AnsibleNativeRunner
gateway_host = settings.ANSIBLE_RECEPTOR_GATEWAY_PROXY_HOST \
if settings.ANSIBLE_RECEPTOR_GATEWAY_PROXY_HOST else '127.0.0.1'
return RunnerInterface(runner_type=runner_type, gateway_proxy_host=gateway_host)

View File

@@ -14,8 +14,10 @@ __all__ = ['AdHocRunner', 'PlaybookRunner', 'SuperPlaybookRunner', 'UploadFileRu
class AdHocRunner:
cmd_modules_choices = ('shell', 'raw', 'command', 'script', 'win_shell')
need_local_connection_modules_choices = ("mysql", "postgresql", "sqlserver", "huawei")
def __init__(self, inventory, module, module_args='', pattern='*', project_dir='/tmp/', extra_vars=None,
def __init__(self, inventory, job_module, module, module_args='', pattern='*', project_dir='/tmp/',
extra_vars=None,
dry_run=False, timeout=-1):
if extra_vars is None:
extra_vars = {}
@@ -23,6 +25,7 @@ class AdHocRunner:
self.inventory = inventory
self.pattern = pattern
self.module = module
self.job_module = job_module
self.module_args = module_args
self.project_dir = project_dir
self.cb = DefaultCallback()
@@ -30,8 +33,7 @@ class AdHocRunner:
self.extra_vars = extra_vars
self.dry_run = dry_run
self.timeout = timeout
# enable local connection
self.extra_vars.update({"LOCAL_CONNECTION_ENABLED": "1"})
self.envs = {}
def check_module(self):
if self.module not in self.cmd_modules_choices:
@@ -40,8 +42,13 @@ class AdHocRunner:
raise CommandInBlackListException(
"Command is rejected by black list: {}".format(self.module_args.split()[0]))
def set_local_connection(self):
if self.job_module in self.need_local_connection_modules_choices:
self.envs.update({"LOCAL_CONNECTION_ENABLED": "1"})
def run(self, verbosity=0, **kwargs):
self.check_module()
self.set_local_connection()
verbosity = get_ansible_log_verbosity(verbosity)
if not os.path.exists(self.project_dir):
@@ -53,6 +60,7 @@ class AdHocRunner:
interface.run(
timeout=self.timeout if self.timeout > 0 else None,
extravars=self.extra_vars,
envvars=self.envs,
host_pattern=self.pattern,
private_data_dir=self.project_dir,
inventory=self.inventory,

View File

@@ -67,6 +67,7 @@ class JMSPermedInventory(JMSInventory):
protocol_supported_modules_mapping = {
'mysql': ['mysql'],
'mariadb': ['mysql'],
'postgresql': ['postgresql'],
'sqlserver': ['sqlserver'],
'ssh': ['shell', 'python', 'win_shell', 'raw', 'huawei'],
@@ -77,7 +78,7 @@ class JMSPermedInventory(JMSInventory):
host['error'] = "Module {} is not suitable for this asset".format(self.module)
return host
if protocol.name in ('mysql', 'postgresql', 'sqlserver'):
if protocol.name in ('mariadb', 'mysql', 'postgresql', 'sqlserver'):
host['login_host'] = asset.address
host['login_port'] = protocol.port
host['login_user'] = account.username
@@ -333,6 +334,7 @@ class JobExecution(JMSOrgBaseModel):
runner = AdHocRunner(
self.inventory_path,
self.job.module,
module,
timeout=self.current_job.timeout,
module_args=args,

View File

@@ -120,7 +120,7 @@
function onError (responseText, responseJson, status) {
setTimeout(function () {
toastr.error(responseJson.detail);
toastr.error(responseJson.detail || responseJson.error);
});
};

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "jumpserver"
version = "v3.9"
version = "v3.10.9"
description = "广受欢迎的开源堡垒机"
authors = ["ibuler <ibuler@qq.com>"]
license = "GPLv3"

View File

@@ -75,7 +75,6 @@ class ReceptorService:
print("\n- PID file is corrupted, starting Receptor...")
os.remove(self.pid_file)
os.environ.update({'LOCAL_CONNECTION_ENABLED': '1'})
os.environ.setdefault('ANSIBLE_LIBRARY', DEFAULT_ANSIBLE_MODULES_DIR)
os.environ.update({'PYTHONPATH': APPS_DIR})
process = subprocess.Popen(self.receptor_command)