X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/cfed63e6644aa489939f40a1ceff5b41e847aeca..4016733ded1999911d7e5f4df21ec66624d39c5c:/code/main.py diff --git a/code/main.py b/code/main.py index cd37c0e..a324306 100755 --- a/code/main.py +++ b/code/main.py @@ -246,7 +246,7 @@ def vnc(username, state, path, fields): """ machine = validation.Validate(username, state, machine_id=fields.getfirst('machine_id')).machine - token = controls.remctl('control', machine.name, 'vnctoken').strip() + token = controls.vnctoken(machine) host = controls.listHost(machine) if host: port = 10003 + [h.hostname for h in config.hosts].index(host) @@ -388,7 +388,6 @@ def modifyDict(username, state, fields): session.save_or_update(machine) if update_acl: - print >> sys.stderr, machine, machine.administrator cache_acls.refreshMachine(machine) session.commit() except: @@ -427,11 +426,24 @@ def helpHandler(username, state, path, fields): simple = fields.getfirst('simple') subjects = fields.getlist('subject') - help_mapping = {'ParaVM Console': """ + help_mapping = { + 'Autoinstalls': """ +The autoinstaller builds a minimal Debian or Ubuntu system to run as a +ParaVM. You can access the resulting system by logging into the serial console server +with your Kerberos tickets; there is no root password so sshd will +refuse login.

+ +

Under the covers, the autoinstaller uses our own patched version of +xen-create-image, which is a tool based on debootstrap. If you log +into the serial console while the install is running, you can watch +it. +""", + 'ParaVM Console': """ ParaVM machines do not support local console access over VNC. To access the serial console of these machines, you can SSH with Kerberos -to console.%s, using the name of the machine as your -username.""" % config.dns.domains[0], +to %s, using the name of the machine as your +username.""" % config.console.hostname, 'HVM/ParaVM': """ HVM machines use the virtualization features of the processor, while ParaVM machines use Xen's emulation of virtualization features. You @@ -633,7 +645,8 @@ Subject: %s %s """ % (to, config.web.hostname, subject, body) - p = subprocess.Popen(['/usr/sbin/sendmail', to], stdin=subprocess.PIPE) + p = subprocess.Popen(['/usr/sbin/sendmail', '-f', to, to], + stdin=subprocess.PIPE) p.stdin.write(mail) p.stdin.close() p.wait() @@ -652,7 +665,18 @@ def show_error(op, username, fields, err, emsg, traceback): def getUser(environ): """Return the current user based on the SSL environment variables""" - return environ.get('REMOTE_USER', None) + user = environ.get('REMOTE_USER') + if user is None: + return + + if environ.get('AUTH_TYPE') == 'Negotiate': + # Convert the krb5 principal into a krb4 username + if not user.endswith('@%s' % config.authn[0].realm): + return + else: + return user.split('@')[0].replace('/', '.') + else: + return user def handler(username, state, path, fields): operation, path = pathSplit(path)