Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
slapos
Commits
f11280ab
Commit
f11280ab
authored
Mar 16, 2017
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5testnode: store shellinabox password in a dedicated file
parent
4cd84414
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
slapos/recipe/shellinabox.py
slapos/recipe/shellinabox.py
+20
-12
software/erp5testnode/instance-default.cfg
software/erp5testnode/instance-default.cfg
+1
-0
software/erp5testnode/software.cfg
software/erp5testnode/software.cfg
+1
-1
No files found.
slapos/recipe/shellinabox.py
View file @
f11280ab
...
@@ -33,19 +33,24 @@ import shlex
...
@@ -33,19 +33,24 @@ import shlex
from
slapos.recipe.librecipe
import
GenericBaseRecipe
from
slapos.recipe.librecipe
import
GenericBaseRecipe
def
login_shell
(
args
):
def
login_shell
(
args
):
password
=
args
[
'password'
]
shellinabox_password_file
=
args
[
'shellinabox-password-file'
]
if
shellinabox_password_file
:
if
(
password
!=
''
):
with
open
(
shellinabox_password_file
,
'r'
)
as
password_file
:
entered_password
=
getpass
()
password
=
password_file
.
read
()
else
:
entered_password
=
''
if
entered_password
!=
password
:
if
(
password
!=
''
):
return
1
entered_password
=
getpass
()
else
:
entered_password
=
''
if
entered_password
!=
password
:
return
1
else
:
commandline
=
shlex
.
split
(
args
[
'shell'
])
path
=
commandline
[
0
]
os
.
execv
(
path
,
commandline
)
else
:
else
:
commandline
=
shlex
.
split
(
args
[
'shell'
])
return
1
path
=
commandline
[
0
]
os
.
execv
(
path
,
commandline
)
def
shellinabox
(
args
):
def
shellinabox
(
args
):
certificate_dir
=
args
[
'certificate_dir'
]
certificate_dir
=
args
[
'certificate_dir'
]
...
@@ -95,12 +100,15 @@ class Recipe(GenericBaseRecipe):
...
@@ -95,12 +100,15 @@ class Recipe(GenericBaseRecipe):
self
.
options
[
'login-shell'
],
self
.
options
[
'login-shell'
],
'%s.login_shell'
%
__name__
,
'%s.login_shell'
%
__name__
,
{
{
'
password'
:
self
.
options
[
'password
'
],
'
shellinabox-password-file'
:
self
.
options
[
'shellinabox-password-file
'
],
'shell'
:
self
.
options
[
'shell'
]
'shell'
:
self
.
options
[
'shell'
]
}
}
)
)
path_list
.
append
(
login_shell
)
path_list
.
append
(
login_shell
)
with
open
(
self
.
options
[
'shellinabox-password-file'
],
'w'
)
as
password_file
:
password_file
.
write
(
self
.
options
[
'password'
])
wrapper
=
self
.
createPythonScript
(
wrapper
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
self
.
options
[
'wrapper'
],
'%s.shellinabox'
%
__name__
,
'%s.shellinabox'
%
__name__
,
...
...
software/erp5testnode/instance-default.cfg
View file @
f11280ab
...
@@ -94,6 +94,7 @@ port = 8080
...
@@ -94,6 +94,7 @@ port = 8080
shell = $${shell:wrapper}
shell = $${shell:wrapper}
wrapper = $${rootdirectory:bin}/shellinaboxd
wrapper = $${rootdirectory:bin}/shellinaboxd
shellinabox-binary = ${shellinabox:location}/bin/shellinaboxd
shellinabox-binary = ${shellinabox:location}/bin/shellinaboxd
shellinabox-password-file = $${rootdirectory:etc}/shellinabox-password
password = $${pwgen:passwd}
password = $${pwgen:passwd}
directory = $${buildout:directory}/
directory = $${buildout:directory}/
login-shell = $${rootdirectory:bin}/login
login-shell = $${rootdirectory:bin}/login
...
...
software/erp5testnode/software.cfg
View file @
f11280ab
...
@@ -56,7 +56,7 @@ recipe = slapos.recipe.template
...
@@ -56,7 +56,7 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-default.cfg
url = ${:_profile_base_location_}/instance-default.cfg
output = ${buildout:directory}/template-default.cfg
output = ${buildout:directory}/template-default.cfg
mode = 0644
mode = 0644
md5sum =
8e171816b6caef52ac75c2f8f6a69fc3
md5sum =
4cff4f92ab230ccf02283bf924e32089
[versions]
[versions]
PyXML = 0.8.5
PyXML = 0.8.5
...
...
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