Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
1a247d60
Commit
1a247d60
authored
Feb 26, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] sudo命令添加help text
parent
adf8b1f7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
user.py
apps/assets/forms/user.py
+2
-1
tasks.py
apps/assets/tasks.py
+7
-2
django.po
apps/locale/zh/LC_MESSAGES/django.po
+0
-0
No files found.
apps/assets/forms/user.py
View file @
1a247d60
...
@@ -150,5 +150,6 @@ class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm):
...
@@ -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"
)
}
}
apps/assets/tasks.py
View file @
1a247d60
...
@@ -341,6 +341,12 @@ def get_push_system_user_tasks(system_user):
...
@@ -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):
...
@@ -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
,
)
)
}
}
})
})
...
...
apps/locale/zh/LC_MESSAGES/django.po
View file @
1a247d60
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment