Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
4675c289
Commit
4675c289
authored
Sep 23, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapformat: set login shell for slapuser and lock login by password
parent
5c7ca228
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
slapos/format.py
slapos/format.py
+5
-2
No files found.
slapos/format.py
View file @
4675c289
...
@@ -644,6 +644,7 @@ class User(object):
...
@@ -644,6 +644,7 @@ class User(object):
user_name: string, the name of the user, who will have is home in
user_name: string, the name of the user, who will have is home in
"""
"""
self
.
name
=
str
(
user_name
)
self
.
name
=
str
(
user_name
)
self
.
shell
=
'/bin/sh'
self
.
additional_group_list
=
additional_group_list
self
.
additional_group_list
=
additional_group_list
def
__getinitargs__
(
self
):
def
__getinitargs__
(
self
):
...
@@ -669,7 +670,7 @@ class User(object):
...
@@ -669,7 +670,7 @@ class User(object):
except
KeyError
:
except
KeyError
:
callAndRead
([
'groupadd'
,
grpname
])
callAndRead
([
'groupadd'
,
grpname
])
user_parameter_list
=
[
'-d'
,
self
.
path
,
'-g'
,
self
.
name
]
user_parameter_list
=
[
'-d'
,
self
.
path
,
'-g'
,
self
.
name
,
'-s'
,
self
.
shell
]
if
self
.
additional_group_list
is
not
None
:
if
self
.
additional_group_list
is
not
None
:
user_parameter_list
.
extend
([
'-G'
,
','
.
join
(
self
.
additional_group_list
)])
user_parameter_list
.
extend
([
'-G'
,
','
.
join
(
self
.
additional_group_list
)])
user_parameter_list
.
append
(
self
.
name
)
user_parameter_list
.
append
(
self
.
name
)
...
@@ -680,6 +681,8 @@ class User(object):
...
@@ -680,6 +681,8 @@ class User(object):
callAndRead
([
'useradd'
]
+
user_parameter_list
)
callAndRead
([
'useradd'
]
+
user_parameter_list
)
else
:
else
:
callAndRead
([
'usermod'
]
+
user_parameter_list
)
callAndRead
([
'usermod'
]
+
user_parameter_list
)
# lock the password of user
callAndRead
([
'passwd'
,
'-l'
,
self
.
name
])
return
True
return
True
...
@@ -1342,7 +1345,7 @@ class FormatConfig(object):
...
@@ -1342,7 +1345,7 @@ class FormatConfig(object):
if
not
self
.
dry_run
:
if
not
self
.
dry_run
:
if
self
.
alter_user
:
if
self
.
alter_user
:
self
.
checkRequiredBinary
([
'groupadd'
,
'useradd'
,
'usermod'
])
self
.
checkRequiredBinary
([
'groupadd'
,
'useradd'
,
'usermod'
,
'passwd'
])
if
self
.
create_tap
:
if
self
.
create_tap
:
self
.
checkRequiredBinary
([[
'tunctl'
,
'-d'
]])
self
.
checkRequiredBinary
([[
'tunctl'
,
'-d'
]])
if
self
.
tap_gateway_interface
:
if
self
.
tap_gateway_interface
:
...
...
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