From 790877831410ca99c1cf2dc63cae9c34e621fd61 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 12 Nov 2020 17:35:24 +0100 Subject: [PATCH] misc: update settings for py3 and move then into settings.d --- config.py => 10supann-settings.py | 16 +++++++++------- debian/conffiles | 1 - debian/cron.d | 2 +- debian/install | 2 +- load-multiple-federations.sh | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) rename config.py => 10supann-settings.py (90%) diff --git a/config.py b/10supann-settings.py similarity index 90% rename from config.py rename to 10supann-settings.py index 717c780..72f0404 100644 --- a/config.py +++ b/10supann-settings.py @@ -8,11 +8,13 @@ REGISTRATION_OPEN = False A2_REGISTRATION_CAN_CHANGE_PASSWORD = False A2_REGISTRATION_CAN_DELETE_ACCOUNT = False -SAML_SIGNATURE_PUBLIC_KEY = file('/etc/authentic2/cert.pem').read() -SAML_SIGNATURE_PRIVATE_KEY = file('/etc/authentic2/key.pem').read() +with open('/etc/authentic2/cert.pem') as fd: + SAML_SIGNATURE_PUBLIC_KEY = fd.read() -SUPANN_LDAP_EXTRA_ATTRIBUTES = filter(None, - os.environ.get('SUPANN_LDAP_EXTRA_ATTRIBUTES', '').split()) +with open('/etc/authentic2/key.pem') as fd: + SAML_SIGNATURE_PRIVATE_KEY = fd.read() + +SUPANN_LDAP_EXTRA_ATTRIBUTES = list(filter(None, os.environ.get('SUPANN_LDAP_EXTRA_ATTRIBUTES', '').split())) LDAP_AUTH_SETTINGS = [ { @@ -125,9 +127,9 @@ LDAP_AUTH_SETTINGS = [ ] + SUPANN_LDAP_EXTRA_ATTRIBUTES, 'attribute_mappings': (('mail', 'email'),), 'mandatory_attributes_values': { - # edugain support - 'schacHomeOrganization': [os.environ['EDUGAIN_SCHAC_HOME_ORGANIZATION']], - 'schacHomeOrganizationtype': [os.environ['EDUGAIN_SCHAC_HOME_ORGANIZATION_TYPE']], + # edugain support + 'schacHomeOrganization': [os.environ['EDUGAIN_SCHAC_HOME_ORGANIZATION']], + 'schacHomeOrganizationtype': [os.environ['EDUGAIN_SCHAC_HOME_ORGANIZATION_TYPE']], }, } ] diff --git a/debian/conffiles b/debian/conffiles index 6077f46..970cfed 100644 --- a/debian/conffiles +++ b/debian/conffiles @@ -1,2 +1 @@ /etc/authentic2/supann.conf -/etc/authentic2/config.py diff --git a/debian/cron.d b/debian/cron.d index 96ae901..8bc91a8 100644 --- a/debian/cron.d +++ b/debian/cron.d @@ -2,5 +2,5 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root -*/30 * * * * authentic /usr/lib/authentic2-supann/load-multiple-federations.sh +*/30 * * * * authentic2 /usr/lib/authentic2-supann/load-multiple-federations.sh diff --git a/debian/install b/debian/install index ae7ad87..655955a 100644 --- a/debian/install +++ b/debian/install @@ -1,4 +1,4 @@ -config.py /etc/authentic2 +10supann-settings.py /etc/authentic2/settings.d update-renater-meta.sh /usr/lib/authentic2-supann load-multiple-federations.sh /usr/lib/authentic2-supann supann.conf /etc/authentic2 diff --git a/load-multiple-federations.sh b/load-multiple-federations.sh index 0e9914e..73cde46 100755 --- a/load-multiple-federations.sh +++ b/load-multiple-federations.sh @@ -64,10 +64,10 @@ chmod +r $FIXTURE_TMP chmod +r $METADATA_TMP # Load fixture -/usr/bin/authentic2-ctl loaddata -v0 $FIXTURE_TMP +/usr/bin/authentic2-manage loaddata -v0 $FIXTURE_TMP # Load metadata -/usr/bin/authentic2-ctl sync-metadata --source=$SOURCE --sp -v1 $METADATA_TMP +/usr/bin/authentic2-manage sync-metadata --source=$SOURCE --sp -v1 $METADATA_TMP rm -f $METADATA_TMP $FIXTURE_TMP }