mirror of https://github.com/jumpserver/jumpserver
[Update] sudo命令添加help text
parent
adf8b1f7aa
commit
1a247d60e7
|
@ -150,5 +150,6 @@ class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm):
|
||||||
'priority': _('1-100, High level will be using login asset as default, '
|
'priority': _('1-100, High level will be using login asset as default, '
|
||||||
'if user was granted more than 2 system user'),
|
'if user was granted more than 2 system user'),
|
||||||
'login_mode': _('If you choose manual login mode, you do not '
|
'login_mode': _('If you choose manual login mode, you do not '
|
||||||
'need to fill in the username and password.')
|
'need to fill in the username and password.'),
|
||||||
|
'sudo': _("Use comma split multi command, ex: /bin/whoami,/bin/ifconfig")
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,6 +341,12 @@ def get_push_system_user_tasks(system_user):
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if system_user.sudo:
|
if system_user.sudo:
|
||||||
|
sudo = system_user.sudo.replace('\r\n', '\n').replace('\r', '\n')
|
||||||
|
sudo_list = sudo.split('\n')
|
||||||
|
sudo_tmp = []
|
||||||
|
for s in sudo_list:
|
||||||
|
sudo_tmp.append(s.strip(','))
|
||||||
|
sudo = ','.join(sudo_tmp)
|
||||||
tasks.append({
|
tasks.append({
|
||||||
'name': 'Set {} sudo setting'.format(system_user.username),
|
'name': 'Set {} sudo setting'.format(system_user.username),
|
||||||
'action': {
|
'action': {
|
||||||
|
@ -348,8 +354,7 @@ def get_push_system_user_tasks(system_user):
|
||||||
'args': "dest=/etc/sudoers state=present regexp='^{0} ALL=' "
|
'args': "dest=/etc/sudoers state=present regexp='^{0} ALL=' "
|
||||||
"line='{0} ALL=(ALL) NOPASSWD: {1}' "
|
"line='{0} ALL=(ALL) NOPASSWD: {1}' "
|
||||||
"validate='visudo -cf %s'".format(
|
"validate='visudo -cf %s'".format(
|
||||||
system_user.username,
|
system_user.username, sudo,
|
||||||
system_user.sudo,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue