Commit f11280ab authored by Sebastien Robin's avatar Sebastien Robin

erp5testnode: store shellinabox password in a dedicated file

parent 4cd84414
......@@ -33,7 +33,10 @@ import shlex
from slapos.recipe.librecipe import GenericBaseRecipe
def login_shell(args):
password = args['password']
shellinabox_password_file = args['shellinabox-password-file']
if shellinabox_password_file:
with open(shellinabox_password_file, 'r') as password_file:
password = password_file.read()
if (password != ''):
entered_password = getpass()
......@@ -46,6 +49,8 @@ def login_shell(args):
commandline = shlex.split(args['shell'])
path = commandline[0]
os.execv(path, commandline)
else:
return 1
def shellinabox(args):
certificate_dir = args['certificate_dir']
......@@ -95,12 +100,15 @@ class Recipe(GenericBaseRecipe):
self.options['login-shell'],
'%s.login_shell' % __name__,
{
'password': self.options['password'],
'shellinabox-password-file': self.options['shellinabox-password-file'],
'shell': self.options['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(
self.options['wrapper'],
'%s.shellinabox' % __name__,
......
......@@ -94,6 +94,7 @@ port = 8080
shell = $${shell:wrapper}
wrapper = $${rootdirectory:bin}/shellinaboxd
shellinabox-binary = ${shellinabox:location}/bin/shellinaboxd
shellinabox-password-file = $${rootdirectory:etc}/shellinabox-password
password = $${pwgen:passwd}
directory = $${buildout:directory}/
login-shell = $${rootdirectory:bin}/login
......
......@@ -56,7 +56,7 @@ recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-default.cfg
output = ${buildout:directory}/template-default.cfg
mode = 0644
md5sum = 8e171816b6caef52ac75c2f8f6a69fc3
md5sum = 4cff4f92ab230ccf02283bf924e32089
[versions]
PyXML = 0.8.5
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment