Skip to content
Snippets Groups Projects
Commit 2ee7627e authored by Chris Hines's avatar Chris Hines
Browse files

Merge pull request #126 from CVL-GitHub/hpcidbranch8

add MANPATH as per Simon's request
parents c7edb014 06cf65ad
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,10 @@
- name: install karaage3-wsgi.conf
template: src=kg-idps.j2 dest=/usr/bin/kg-idps mode=755
sudo: true
- name: install shibboleth cache file
template: src=metadata.aaf.xml.j2 dest=/tmp/metadata.aaf.xml
-
name: "enabling Karaage configuration"
shell: a2enconf karaage3-wsgi
......@@ -138,10 +142,11 @@
sudo: true
when: karaage_db_init.stdout.find("0") == 0
#-
# name: "Create IDP institutes (disable it as cache is not available)"
# shell: kg-idps
# sudo: true
-
name: "Create IDP institutes (disable it as cache is not available)"
shell: kg-idps /tmp/metadata.aaf.xml
sudo: true
when: karaage_db_init.stdout.find("0") == 0
- name: install postfix
apt: name=postfix state=present
......
......@@ -38,3 +38,17 @@ ShibUseHeaders On
require valid-user
</Location>
<Location /karaage/projects/joinprojects/>
AuthType Shibboleth
ShibRequireSession On
ShibUseHeaders On
require valid-user
</Location>
<Location /karaage/profile/slogin>
AuthType Shibboleth
ShibRequireSession On
ShibUseHeaders On
require valid-user
</Location>
#!/usr/bin/python
import os
import os, sys, re, traceback
import django
os.environ['DJANGO_SETTINGS_MODULE'] = "karaage.conf.settings"
def get_idps_from_metadata():
DEFAULT_CACHE_FILE = "/var/cache/shibboleth/metadata.aaf.xml"
def get_idps_from_metadata(cache_path):
import xml.etree.ElementTree as ET
tree = ET.parse('/var/cache/shibboleth/metadata.aaf.xml')
tree = ET.parse(cache_path)
root=tree.getroot()
idps=[]
for entity in root.findall("{urn:oasis:names:tc:SAML:2.0:metadata}EntityDescriptor"):
......@@ -21,56 +23,37 @@ def get_idps_from_metadata():
return idps
def get_next_idp_group():
from karaage.people.models import Group
i=-1
available=False
nextgroup=None
groupname='idpgroup{idx}'
while not available:
i=i+1
try:
group =Group.objects.get(name=groupname.format(idx=i))
except Group.DoesNotExist:
available=True
nextgroup=groupname.format(idx=i)
return nextgroup
def get_group_name(groupname):
return re.sub('[!@#=$\s+]', "", groupname).lower()
def get_or_create_idp(entityID,name):
print "get_or_create %s"%name
from karaage.institutes.forms import InstituteForm
from karaage.institutes.models import Institute
from karaage.people.models import Group
try:
Institute.objects.get(saml_entityid=entityID)
institute = Institute.objects.get(saml_entityid=entityID)
return
except Institute.DoesNotExist:
print "does not exists, creating"
groupname=get_next_idp_group()
group, _ =Group.objects.get_or_create(name=groupname)
institute=Institute(name=name,group=group,saml_entityid=entityID,is_active=True)
institute.save()
#
# d={}
# d['name']=name
# d['group_id']=group
# d['saml_entityid']=entityID
# d['is_active']=True
# form=InstituteForm(d)
# if form.is_valid():
# print "tying to save"
# form.save()
# else:
# print "form not valid"
# print dir(form)
# #print "not actually saving my form"
try:
groupname = get_group_name(name)
group, _ =Group.objects.get_or_create(name = groupname)
if group:
institute = Institute(name = name, group = group, saml_entityid = entityID, is_active = True)
if institute:
institute.save()
except:
print "Exception: %s" %(traceback.format_exc())
django.setup()
idps = get_idps_from_metadata()
for idp in idps:
try:
def main(argv):
if len(sys.argv) > 1:
cache_path = argv[0]
else:
cache_path = DEFAULT_CACHE_FILE
django.setup()
idps = get_idps_from_metadata(cache_path)
for idp in idps:
get_or_create_idp(entityID=idp['entityID'],name=idp['name'])
except:
pass
if __name__ == '__main__':
main(sys.argv[1:])
This diff is collapsed.
......@@ -78,18 +78,6 @@ ADMINS = (
# link notifications when BrokenLinkEmailsMiddleware is enabled.
MANAGERS = ADMINS
{% if defaultProject is defined and defaultMachineCategory is defined %}
DEFAULT_PROJECT_PID = "{{ defaultProject }}"
DEFAULT_MACHINE_CATEGORY_NAME = "{{ defaultMachineCategory }}"
{% endif %}
DEFAULT_INSTITUTE_NAME = "Monash University"
DEFAULT_PROJECTS = [
{"project_name": "MCC2", "pid": "pMcc2", "institute_name": "Monash University"},
{"project_name": "MCC3", "pid": "pMcc3", "institute_name": "Monash University"},
{"project_name": "MASSIVE", "pid": "pMassive", "institute_name": "Monash University"},
{"project_name": "CVL", "pid": "pCvl", "institute_name": "Monash University"}
]
# A dictionary containing the settings for all databases to be used with
# Django. It is a nested dictionary whose contents maps database aliases to a
# dictionary containing the options for an individual database.
......@@ -316,7 +304,7 @@ SHIB_SUPPORTED = True
#
# default: ALLOW_REGISTRATIONS = False
#
# ALLOW_REGISTRATIONS = True
ALLOW_REGISTRATIONS = True
# Do we allow any logged in user to access all usage information?
#
......
......@@ -12,7 +12,8 @@ filter_groups = slurm, munge
[domain/{{ ldapDomain }}]
ldap_referrals = false
cache_credentials = false
entry_cache_timeout=3600
entry_cache_timeout=60480
memcache_timeout=60480
entry_cache_nowait_percentage=50
enumerate = true
......
......@@ -4,3 +4,5 @@ export PATH={{ munge_dir }}/bin:{{ slurm_dir }}/bin:{{ slurm_dir }}/sbin:{{ nhc_
export LD_LIBRARY_PATH={{ munge_dir }}/lib:{{ slurm_dir }}/lib:{{ slurm_dir }}/lib/slurm:$LD_LIBRARY_PATH
export SLURM_SERVER_HOME={{ slurm_dir }}
export MANPATH={{ slurm_dir }}/share/man:$MANPATH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment