From ed40b871dcca74dc14cd0b7ac5d9d824e7dceaf4 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sat, 11 Jul 2020 17:30:25 +0200 Subject: [PATCH] Mailman3: Working cas --- roles/mailman3/tasks/main.yml | 11 ++++++++--- roles/mailman3/templates/mailman3/mailman-web.py.j2 | 10 ++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/roles/mailman3/tasks/main.yml b/roles/mailman3/tasks/main.yml index 9cd50c03..3c2ade00 100644 --- a/roles/mailman3/tasks/main.yml +++ b/roles/mailman3/tasks/main.yml @@ -1,12 +1,16 @@ --- +# You will need to do after: sudo pip3 install django-allauth-cas +# Yes, it is horrible but we need Debian Python3 to see this django app. - name: Install mailman3 apt: update_cache: true name: - mailman3-full - nginx - - dbconfig-no-thanks + - dbconfig-no-thanks # Do not autoconfigure database - postgresql + - python3-pip # CAS + - python3-lxml # CAS install_recommends: false register: apt_result retries: 3 @@ -15,7 +19,7 @@ # You will need to setup postgres # sudo -u postgres createuser -P mailman3 # sudo -u postgres createdb -O mailman3 mailman3 -# Test with : psql -U mailman3 -W -d mailman3 -h localhost +# Test with: psql -U mailman3 -W -d mailman3 -h localhost - name: Configure mailman3 template: src: mailman3/mailman.cfg.j2 @@ -28,7 +32,8 @@ # You will need to setup postgres # sudo -u postgres createuser -P mailman3web # sudo -u postgres createdb -O mailman3web mailman3web -# Test with : psql -U mailman3web -W -d mailman3web -h localhost +# Test with: psql -U mailman3web -W -d mailman3web -h localhost +# Then migrate data: sudo /usr/share/mailman3-web/manage.py migrate - name: Configure mailman3-web template: src: mailman3/mailman-web.py.j2 diff --git a/roles/mailman3/templates/mailman3/mailman-web.py.j2 b/roles/mailman3/templates/mailman3/mailman-web.py.j2 index e93956eb..0152d385 100644 --- a/roles/mailman3/templates/mailman3/mailman-web.py.j2 +++ b/roles/mailman3/templates/mailman3/mailman-web.py.j2 @@ -30,7 +30,12 @@ MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1') # Application definition +# Add allauth_cas_crans path +import sys +sys.path.insert(0, "/usr/scripts/mailman") + INSTALLED_APPS = ( + 'mailman_theme_crans', # override templates 'hyperkitty', 'postorius', 'django_mailman3', @@ -53,6 +58,8 @@ INSTALLED_APPS = ( 'allauth', 'allauth.account', 'allauth.socialaccount', + 'allauth_cas', + 'allauth_cas_crans', #'django_mailman3.lib.auth.fedora', #'allauth.socialaccount.providers.openid', #'allauth.socialaccount.providers.github', @@ -156,6 +163,7 @@ ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https" # Social auth # SOCIALACCOUNT_PROVIDERS = { + 'crans': {} #'openid': { # 'SERVERS': [ # dict(id='yahoo', @@ -191,3 +199,5 @@ COMPRESS_OFFLINE = True POSTORIUS_TEMPLATE_BASE_URL = 'http://localhost/mailman3/' +# Use Crans SMTP for Django mails +EMAIL_HOST = 'smtp.crans.org'