mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
IE: Move IPython-specific password hashing out of framework into plugin.
See dicussion here - https://github.com/erasche/galaxy/commit/23459f318507255a2bb1d1fb647e1581bd2090e1.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<%
|
||||
import os
|
||||
import shutil
|
||||
import hashlib
|
||||
|
||||
# Sets ID and sets up a lot of other variables
|
||||
ie_request.load_deploy_config()
|
||||
@@ -10,6 +11,13 @@ ie_request.attr.docker_port = 6789
|
||||
# Create tempdir in galaxy
|
||||
temp_dir = ie_request.temp_dir
|
||||
|
||||
if ie_request.attr.PASSWORD_AUTH:
|
||||
m = hashlib.sha1()
|
||||
m.update( ie_request.notebook_pw + ie_request.notebook_pw_salt )
|
||||
PASSWORD = 'sha1:%s:%s' % (ie_request.notebook_pw_salt, m.hexdigest())
|
||||
else:
|
||||
PASSWORD = "none"
|
||||
|
||||
## IPython Specific
|
||||
# Prepare an empty notebook
|
||||
notebook_id = ie_request.generate_hex(64)
|
||||
@@ -32,7 +40,9 @@ notebook_login_url = ie_request.url_template('${PROXY_URL}/ipython/${PORT}/login
|
||||
|
||||
|
||||
# Add all environment variables collected from Galaxy's IE infrastructure
|
||||
ie_request.launch()
|
||||
ie_request.launch(env_override={
|
||||
'notebook_password': PASSWORD,
|
||||
})
|
||||
|
||||
%>
|
||||
<html>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import ConfigParser
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
import random
|
||||
import tempfile
|
||||
@@ -41,6 +40,8 @@ class InteractiveEnviornmentRequest(object):
|
||||
self.attr.HOST = trans.request.host.rsplit(':', 1)[0]
|
||||
self.attr.PORT = self.attr.proxy_request[ 'proxied_port' ]
|
||||
|
||||
# Generate per-request passwords the IE plugin can use to configure
|
||||
# the destination container.
|
||||
self.notebook_pw_salt = self.generate_password(length=12)
|
||||
self.notebook_pw = self.generate_password(length=24)
|
||||
|
||||
@@ -100,16 +101,6 @@ class InteractiveEnviornmentRequest(object):
|
||||
# Galaxy paster port is deprecated
|
||||
conf_file['galaxy_paster_port'] = conf_file['galaxy_web_port']
|
||||
|
||||
if self.attr.PASSWORD_AUTH:
|
||||
# Generate a random password + salt
|
||||
m = hashlib.sha1()
|
||||
m.update( self.notebook_pw + self.notebook_pw_salt )
|
||||
conf_file['notebook_password'] = 'sha1:%s:%s' % (self.notebook_pw_salt, m.hexdigest())
|
||||
# Should we use password based connection or "default" connection style in galaxy
|
||||
else:
|
||||
notebook_pw = "None"
|
||||
|
||||
self.attr.notebook_pw = notebook_pw
|
||||
return conf_file
|
||||
|
||||
def generate_hex(self, length):
|
||||
|
||||
Reference in New Issue
Block a user