====== Mailman ====== [[http://list.org/|Mailman]] est un logiciel serveur pour gérer les listes de diffusion et les newsletters. C'est un logiciel libre maintenu pour [[https://www.gnu.org/|le projet GNU]] par Barry Warsaw2. Il tourne avec tout serveur mail de type Unix, comme Postfix, Sendmail, Exim ou Qmail. Il dispose par ailleurs d'un filtre anti-spam. Avant d'installer [[http://list.org/|Mailman]] vous devriez avoir [[serveur:mail|configurer Postfix]]. ===== Installation ===== apt-get install mailman Il faut vérifier les permissions après installation de Mailman. check_perms La sortie de la commande précédente montre pas mal d’anomalies dans l’attribution des droits. Il faut les ajuster : check_perms -f Puis nous repassons le "check" : check_perms Nous nous apercevons qu’il reste des droits encore non réparés, alors radicalement, nous ajustons les droits avec la commande suivante : cd /var/lib/mailman;chown -R list:list * ===== Configuration ===== ==== Configuration de Mailman ==== vi /etc/mailman/mm_cfg.py Je prends pour exemple un domaine "lists.domain.eu" MAILMAN_SITE_LIST = 'mailman' DEFAULT_URL_PATTERN = 'http://%s/' IMAGE_LOGOS = '/images/mailman/' DEFAULT_EMAIL_HOST = 'lists.domain.eu' DEFAULT_URL_HOST = 'lists.domain.eu' add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) DEFAULT_SERVER_LANGUAGE = 'en' USE_ENVELOPE_SENDER = 0 # Still used? DEFAULT_SEND_REMINDERS = 0 MTA=None GLOBAL_PIPELINE.insert(1, 'SpamAssassin') === Mot de passe administrateur === Créons le mot de passe de l'administrateur : # /usr/lib/mailman/bin/mmsitepass Nouveau mot de passe site : Confirmer le mot de passe : Mot de passe modifié. === Mot de passe créateur de la liste === Créons un mot de passe pour le rôle "créateur de la liste", un utilisateur autre que l'administrateur qui a le pouvoir de créer et de supprimer des listes via l'interface web : # /usr/lib/mailman/bin/mmsitepass -c Nouveau mot de passe créateur de la liste : Confirmer le mot de passe : Mot de passe modifié. ==== Configuration de Postfix ==== Voici la configuration de Postfix pour l'utilisation d’un sous domaine de type lists.domaine.eu mydestination = ... lists.domaine.eu relay_domains = ... lists.domaine.eu transport_maps = hash:/etc/postfix/transport mailman_destination_recipient_limit = 1 mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} lists.domaine.eu mailman: Nous redémarrons Postfix systemctl restart postfix ==== Configuration Apache2 ==== Pour configurer [[https://httpd.apache.org/|Apache2]] il est possible de partir du fichier de configuration installé avec Mailman. cp /etc/mailman/apache.conf /etc/apache2/sites-available/mailman.conf Mais avant de modifier ce fichier, créons un dossier : mkdir /var/www/lists puis nous activons, s'ils ne le sont pas, les modules CGI et Rewrite d'Apache : a2enmod cgi a2enmod rewrite ServerName lists.domaine.eu ServerAdmin webmaster@domaine.eu DocumentRoot /var/www/lists Redirect permanent / https://lists.domaine.eu/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined ServerName lists.domaine.eu ServerAdmin postmaster@domaine.eu DocumentRoot /var/www/lists ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/ AllowOverride None Options +ExecCGI AddHandler cgi-script .cgi index.cgi Require all granted Alias /images/mailman/ /usr/share/images/mailman/ AllowOverride None Require all granted Alias /pipermail/ /var/lib/mailman/archives/public/ Options Indexes MultiViews FollowSymLinks AllowOverride None Require all granted Options FollowSymLinks AllowOverride None Require all granted ScriptAlias /admin /usr/lib/cgi-bin/mailman/admin ScriptAlias /admindb /usr/lib/cgi-bin/mailman/admindb ScriptAlias /confirm /usr/lib/cgi-bin/mailman/confirm ScriptAlias /create /usr/lib/cgi-bin/mailman/create ScriptAlias /edithtml /usr/lib/cgi-bin/mailman/edithtml ScriptAlias /listinfo /usr/lib/cgi-bin/mailman/listinfo ScriptAlias /options /usr/lib/cgi-bin/mailman/options ScriptAlias /private /usr/lib/cgi-bin/mailman/private ScriptAlias /rmlist /usr/lib/cgi-bin/mailman/rmlist ScriptAlias /roster /usr/lib/cgi-bin/mailman/roster ScriptAlias /subscribe /usr/lib/cgi-bin/mailman/subscribe RewriteEngine on # Redirect root access to mailman list RewriteRule ^$ /mailman/listinfo [R=permanent,L] RewriteRule ^/$ /mailman/listinfo [R=permanent,L] RewriteRule ^/favicon.ico - [L] RewriteRule ^/robots.txt - [L] ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on # The CRIME attack uses SSL Compression, we need to disable that SSLCompression off SSLProtocol +TLSv1.2 -TLSv1.1 -TLSv1 -SSLv3 -SSLv2 SSLHonorCipherOrder On SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH SSLCertificateFile /etc/apache2/ssl/certs/lists_domaine.crt SSLCertificateKeyFile /etc/apache2/ssl/domaine.key Header always add Strict-Transport-Security "max-age=15768000; preload" # SSL Engine Options: # Set various options for the SSL engine. # o FakeBasicAuth: # Translate the client X.509 into a Basic Authorisation. This means that # the standard Auth/DBMAuth methods can be used for access control. The # user name is the `one line' version of the client's X.509 certificate. # Note that no password is obtained from the user. Every entry in the user # file needs this password: `xxj31ZMTZzkVA'. # o ExportCertData: # This exports two additional environment variables: SSL_CLIENT_CERT and # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the # server (always existing) and the client (only existing when client # authentication is used). This can be used to import the certificates # into CGI scripts. # o StdEnvVars: # This exports the standard SSL/TLS related `SSL_*' environment variables. # Per default this exportation is switched off for performance reasons, # because the extraction step is an expensive operation and is usually # useless for serving static content. So one usually enables the # exportation for CGI and SSI requests only. # o OptRenegotiate: # This enables optimized SSL connection renegotiation handling when SSL # directives are used in per-directory context. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire SSLOptions +StdEnvVars SSLOptions +StdEnvVars # SSL Protocol Adjustments: # The safe and default but still SSL/TLS standard compliant shutdown # approach is that mod_ssl sends the close notify alert but doesn't wait for # the close notify alert from client. When you need a different shutdown # approach you can use one of the following variables: # o ssl-unclean-shutdown: # This forces an unclean shutdown when the connection is closed, i.e. no # SSL close notify alert is send or allowed to received. This violates # the SSL/TLS standard but is needed for some brain-dead browsers. Use # this when you receive I/O errors because of the standard approach where # mod_ssl sends the close notify alert. # o ssl-accurate-shutdown: # This forces an accurate shutdown when the connection is closed, i.e. a # SSL close notify alert is send and mod_ssl waits for the close notify # alert of the client. This is 100% SSL/TLS standard compliant, but in # practice often causes hanging connections with brain-dead browsers. Use # this only for browsers where you know that their SSL implementation # works correctly. # Notice: Most problems of broken clients are also related to the HTTP # keep-alive facility, so you usually additionally want to disable # keep-alive for those clients, too. Use variable "nokeepalive" for this. # Similarly, one has to force some clients to use HTTP/1.0 to workaround # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and # "force-response-1.0" for this. BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown === Configuration TLS === Configurons ce site pour utiliser TLS avec un certificat de notre propre CA, considérons que la clef privé existe déjà, nous créons une demande de signature de notre certificat (Certificate Signing Request) : cd /etc/apache2/ssl openssl req -new -sha256 -key domaine.key > domaine_lists.csr La demande de signature, le fichier CSR doit être envoyé à notre autorité de certification pour récupérer un certificat signé (domaine.crt) que nous placerons dans ''/etc/apache2/ssl/certs''. chown -R root:root /etc/apache2/ssl && chmod -R 400 /etc/apache2/ssl Il faudra aussi ajouter le certificat de l'autorité de certification si elle n'existe pas dans ''/usr/share/ca-certificates/''. Nous activons les sites, testons la syntaxe et nous rechargeons la configuration d'Apache2 a2ensite mailman.conf mailman-ssl.conf apache2ctl -t service apache2 reload ==== Intégration OpenDMARC ==== Considérons que le serveur Postfix est [[serveur:mail|configuré avec OpenDMARC]]. Nous éditons ''/etc/postfix/dkim/TrustedHosts'', ce fichier contient les hôtes et les domaines pour lesquels OpenDKIM signe les courriers : localhost 127.0.0.1 ::1 domaine.eu lists.domaine.eu Nous relançons les services : systemctl restart opendkim systemctl restart postfix ==== Création de listes ==== Maintenant que nous avons un mailman fonctionnel, nous pouvons créer nos listes de diffusion. **En tout premier lieu, créons une liste système**, généralement nommée "mailman". Vous êtes libres de choisir un autre nom pour la liste système, mais il vous faudra alors ajuster la variable ''MAILMAN_SITE_LIST'' dans le fichier de configuration. Une fois la première configuration passée, il sera possible de passer par l'interface web d'administration pour en créer de nouvelles. Toutefois, il vaut peut-être mieux lui préférer la ligne de commande, qui est beaucoup plus édifiante en cas de problème, et qui vous rappellera par exemple certaines tâches à effectuer que l'interface web passera complètement sous silence (création des alias). Si vous créez une liste par l'interface web, la liste des alias à créer sera tout de même envoyée par email au propriétaire de la liste. Créons la liste : # /usr/lib/mailman/bin/newlist mailman Entrez l'adresse courriel du gestionnaire de la liste : webmaster@domaine.eu Mot de passe initial de la liste mailman : Pour achever la création de votre liste de diffusion, vous devez modifier votre fichier /etc/aliases (ou équivalent) en y ajoutant les lignes suivantes et peut être exécuter le programme `newaliases': liste de diffusion ## mailman mailman: "|/usr/lib/mailman/mail/mailman post mailman" mailman-admin: "|/usr/lib/mailman/mail/mailman admin mailman" mailman-bounces: "|/usr/lib/mailman/mail/mailman bounces mailman" mailman-confirm: "|/usr/lib/mailman/mail/mailman confirm mailman" mailman-join: "|/usr/lib/mailman/mail/mailman join mailman" mailman-leave: "|/usr/lib/mailman/mail/mailman leave mailman" mailman-owner: "|/usr/lib/mailman/mail/mailman owner mailman" mailman-request: "|/usr/lib/mailman/mail/mailman request mailman" mailman-subscribe: "|/usr/lib/mailman/mail/mailman subscribe mailman" mailman-unsubscribe: "|/usr/lib/mailman/mail/mailman unsubscribe mailman" Tapez sur Entrée pour aviser le propriétaire de mailman... Comme vous pourrez le constater, la création de la liste est effective, mais il reste une étape si vous souhaitez la voir fonctionner : l'ajout des alias. Si les alias ne sont pas renseignés, votre serveur de messagerie recevra des messages dont il ne connaît pas les destinataires, et sera en conséquence incapable de les traiter. Éditons le fichier /etc/aliases, et ajoutons ce que la commande de création nous a fourni : # vim /etc/aliases mailman: "|/usr/lib/mailman/mail/mailman post mailman" mailman-admin: "|/usr/lib/mailman/mail/mailman admin mailman" mailman-bounces: "|/usr/lib/mailman/mail/mailman bounces mailman" mailman-confirm: "|/usr/lib/mailman/mail/mailman confirm mailman" mailman-join: "|/usr/lib/mailman/mail/mailman join mailman" mailman-leave: "|/usr/lib/mailman/mail/mailman leave mailman" mailman-owner: "|/usr/lib/mailman/mail/mailman owner mailman" mailman-request: "|/usr/lib/mailman/mail/mailman request mailman" mailman-subscribe: "|/usr/lib/mailman/mail/mailman subscribe mailman" mailman-unsubscribe: "|/usr/lib/mailman/mail/mailman unsubscribe mailman" Lançons ensuite la commande qui permettra au MTA de mettre à jour ses alias : newaliases