From 5d1eb88a2e0b3e224b3d3488683f54989d2f70c1 Mon Sep 17 00:00:00 2001 From: ljf Date: Fri, 15 Jul 2022 22:51:40 +0200 Subject: [PATCH] Some steps was missing in install --- doc/DISCLAIMER.md | 53 +------------------- manifest.json | 10 +++- scripts/install | 21 ++++++++ sources/hooks/conf_regen/98-postfix_mailman3 | 2 +- 4 files changed, 33 insertions(+), 53 deletions(-) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 0359a49..b1cacf5 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -6,58 +6,9 @@ * Users can also just sign up themselves to manage details * Users can use mailing lists without signing up? -## Post-installation steps +Classical admin is available on the page: https://myyunohost.org/ -### Setup Admin User - -You must [configure the admin user](http://docs.mailman3.org/en/latest/config-web.html#setting-up-admin-account): - -```bash -$ cd /usr/share/mailman3-web -$ python3 manage.py createsuperuser -``` - -You should then attempt to log in with this user account in the web UI. Once you've logged in, a confirmation mail will be sent to your email address that you specified. Therefore, you should have something like [Rainloop](https://github.com/YunoHost-Apps/rainloop_ynh) installed to view mail on your YunoHost installation. - -### Setup your main domain - -You'll need to log in as administrator and visit the `/admin/site/site`. - -If you're Mailman3 is setup on `https://myyunohost.org` then that would be the following: - -> https://myyunohost.org/admin/site/site - -### Configure incoming mail - -Mailman3 implements an LMTP server for receiving mail from Postfix. This means that Mailman3 doesn't need anything from Dovecot. This is important to understand because Dovecot is the default YunoHost local delivery agent. Therefore, the default YunoHost Postfix configuration uses Dovecot. So, in order to deliver incoming mail, we need to override which delivery agent handles which mails based on the addresses. In other words, if you create a mailing list "mylist@myyunohost.org" you want Mailman3's LMTP server to receive this, *not* Dovecot, becaues Dovecot only delivers to LDAP created user accounts. - -You'll need to add this to your Postfix configuration: - -```bash -owner_request_special = no - -transport_maps = - hash:/var/lib/mailman3/data/postfix_lmtp - -local_recipient_maps = - hash:/var/lib/mailman3/data/postfix_lmtp - -virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf, hash:/var/lib/mailman3/data/postfix_lmtp -``` - -And then run: - -```bash -$ sudo -su list mailman aliases -``` - -This is unfortunately a manual step at this point because the package remains experimental. Once it matures, this will be integrated into a hook or the default Postfix configuration. For now, remember that when you run `yunohost tools regen-conf postfix` or if any installation invokes `regen-conf`, your Postfix configuration will not be changed because it has diverged from the default configuration. This may cause you problems if YunoHost core expects that there is some new value in your Postfix configuration. - -### Configure outgoing mail - -Postfix relies on using SMTP which should be configured in your `/etc/postfix/main.cf`. - -You should make sure that you have outgoing mail working before getting started with Mailman 3. +Django admin on: https://myyunohost.org/admin/ ## General Configuration diff --git a/manifest.json b/manifest.json index 0cb3d5d..72ca265 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Electronic mailing lists manager", "fr": "Un gestionnaire de liste de discussion par email" }, - "version": "1.0~ynh1", + "version": "1.0~ynh2", "url": "http://www.list.org/", "upstream": { "license": "AGPL-3.0-or-later", @@ -39,6 +39,14 @@ "name": "is_public", "type": "boolean", "default": true + }, + { + "name": "admin", + "type": "user" + }, + { + "name": "password", + "type": "password" } ] } diff --git a/scripts/install b/scripts/install index 9cf78db..9635462 100755 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN +password=$YNH_APP_ARG_PASSWORD app=$YNH_APP_INSTANCE_NAME @@ -48,6 +50,8 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=admin --value=admin +ynh_app_setting_set --app=$app --key=password --value=password #================================================= # STANDARD MODIFICATIONS @@ -140,6 +144,22 @@ pushd /usr/share/mailman3-web python3 manage.py migrate || ynh_die --message="Mailman3 migrations failed!" popd +#================================================= +# CREATE SUPERUSER +#================================================= +ynh_script_progression --message="Creating superuser..." +pushd /usr/share/mailman3-web + echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('$admin', '$email', '$password')" | python manage.py shell +popd + +#================================================= +# CONFIGURE MAINDOMAIN +#================================================= +ynh_script_progression --message="Configuring maindomain..." +pushd /usr/share/mailman3-web + echo "UPDATE django_site SET domain='$domain',name='$domain' WHERE domain='example.com';" | python3 manage.py dbshell +popd + #================================================= # POSTFIX CONFIGURATION #================================================= @@ -148,6 +168,7 @@ ynh_script_progression --message="Configuring postfix mail server..." # Add postfix configuration hook and regen postfix conf cp -R ../sources/hooks/conf_regen/98-postfix_mailman3 /usr/share/yunohost/hooks/conf_regen/ yunohost tools regen-conf postfix +sudo -su list mailman aliases ynh_systemd_action --service_name=postfix --action="restart" #================================================= diff --git a/sources/hooks/conf_regen/98-postfix_mailman3 b/sources/hooks/conf_regen/98-postfix_mailman3 index 5eff47d..e0f9e0c 100644 --- a/sources/hooks/conf_regen/98-postfix_mailman3 +++ b/sources/hooks/conf_regen/98-postfix_mailman3 @@ -10,7 +10,7 @@ do_pre_regen() { # FIXME : check this file actually exists to not crash when only running this # hook alone - + sed -i 's@virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf@virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf, hash:/var/lib/mailman3/data/postfix_lmtp@' $postfix_main_cf cat << EOT >> $postfix_main_cf unknown_local_recipient_reject_code = 550 owner_request_special = no