def check_arvados_token(requested_username, token):
auth_log("%s %s" % (requested_username, token))
- ARVADOS_API_HOST='4xphq.arvadosapi.com' ## FIXME replace with puppet
- # BUG: hostname stored on the API is just "foo.shell", not "foo.shell.zzzzz.arvadosapi.com"!
- my_hostname='shell' ## FIXME replace with puppet
try:
- arv = arvados.api('v1',host=ARVADOS_API_HOST, token=token, cache=None)
+ f=file('/etc/default/arvados_pam')
+ config=dict([l for l in f.readlines() if not l.startswith('#') or l.strip()==""])
+ arvados_api_host=config['ARVADOS_API_HOST'].strip()
+ hostname=config['HOSTNAME'].strip()
+ except Exception as e:
+ auth_log("problem getting default values" % (str(e)))
+
+ try:
+ arv = arvados.api('v1',host=arvados_api_host, token=token, cache=None)
except Exception as e:
auth_log(str(e))
return False
try:
- matches = arv.virtual_machines().list(filters=[['hostname','=',my_hostname]]).execute()['items']
+ matches = arv.virtual_machines().list(filters=[['hostname','=',hostname]]).execute()['items']
except Exception as e:
auth_log(str(e))
return False
if len(matches) != 1:
- auth_log("libpam_arvados could not dertermine vm uuid for '%s'" % my_hostname)
+ auth_log("libpam_arvados could not dertermine vm uuid for '%s'" % hostname)
return False
this_vm_uuid = matches[0]['uuid']
--- /dev/null
+# Default values for libpam arvados module
+#
+# ARVADOS_API_HOST should be te api hosts.
+# should be reachable, and will be called
+# from arvados_pam.py using Arvados Python SDK
+ARVADOS_API_HOST=zzzzz.arvadosapi.com
+
+# HOSTNAME is the hostname as is stored in the API object
+# something like "foo.shell" or "shell", but not"foo.shell.zzzzz.arvadosapi.com"!
+HOSTNAME=shell