Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

系统用户推送逻辑问题 #2753

Open
SgtDaJim opened this issue May 30, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@SgtDaJim
Copy link

commented May 30, 2019

[简述你的问题]
在jumpserver/apps/assets/tasks.py,get_push_system_user_tasks方法中:

if system_user.password:
        tasks.append({
            'name': 'Add user {}'.format(system_user.username),
            'action': {
                'module': 'user',
                'args': 'name={} shell={} state=present password={}'.format(
                    system_user.username, system_user.shell,
                    encrypt_password(system_user.password, salt="K3mIlKK"),
                ),
            }
        })
        tasks.extend([
            {
               'name': 'Check home dir exists',
               'action': {
                   'module': 'stat',
                   'args': 'path=/home/{}'.format(system_user.username)
               },
               'register': 'home_existed'
            },
            {
                'name': "Set home dir permission",
                'action': {
                    'module': 'file',
                    'args': "path=/home/{0} owner={0} group={0} mode=700".format(system_user.username)
                },
                'when': 'home_existed.stat.exists == true'
            }
        ])

这个逻辑感觉有问题。当password为None时,就不会创建新用户了,即使有设置密钥也没用。
正确逻辑不应该是先保证user存在,然后如果password不为None,就设置密码吗?

使用版本

[请提供你使用的Jumpserver版本 1.x.x 注: 0.3.x不再提供支持]
1.4.10

[注:] 完成后请关闭 issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.