===== Mailing-lists ===== ==== Mailman3 ==== Le système de mailing-list de MiNET se nomme mailman3. Son interface web est accessible sur https://listes.minet.net ==== Installation ==== La CT listes contenant mailman3 utilise les services suivants que l'on va expliciter dans le cadre d'une installation. **postfix** Le service postfix ne sert qu'à assurer le relai entre le serveur SMTP de MiNET et mailman. Installons postfix : apt-get install postfix Sa configuration est située dans "/etc/postfix/main.cf" Elle doit être la suivante : # appending .domain is the MUA's job. append_dot_mydomain = no readme_directory = no myhostname = listes.minet.net mydestination = listes, listes.minet.net, localhost.localdomain, localhost #relayhost = mx.minet.net:10025 relayhost = [smtp.priv.minet.net] mynetworks = 127.0.0.0/8 192.168.102.26 192.168.102.25 mailbox_size_limit = 0 # Nécessaire pour mailman recipient_delimiter = + inet_interfaces = localhost alias_database = hash:/etc/aliases relay_domains = hash:/var/lib/mailman3/data/postfix_domains mailman_destination_recipient_limit = 1 inet_protocols = ipv4 compatibility_level = 2 transport_maps = hash:/var/lib/mailman3/data/postfix_lmtp local_recipient_maps = hash:/var/lib/mailman3/data/postfix_lmtp relay_domains = hash:/var/lib/mailman3/data/postfix_domains Attention : la base de données des aliases est très importante car tous les noms des ML sont notés dedans et si on envoie un mail à une ML non existante c'est là que postfix va refuser ce mail. mailman3 est censé écrire dedans à chaque fois qu'une ML est créee / supprimée. **mailman3** On peut installer mailman3 de la manière suivante (la plus simple) : apt-get install mailman3-core Voilà quelques liens utiles pour mailman3 : - /var/lib/mailman3 : data des ML/archives/database - /etc/mailman3 : configuration de mailman Vous pouvez utiliser la configuration suivante pour mailman : # Copyright (C) 2008-2017 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) # any later version. # # GNU Mailman is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along with # GNU Mailman. If not, see . # This file contains the Debian configuration for mailman. It uses ini-style # formats under the lazr.config regime to define all system configuration # options. See for details. [mailman] # This address is the "site owner" address. Certain messages which must be # delivered to a human, but which can't be delivered to a list owner (e.g. a # bounce from a list owner), will be sent to this address. It should point to # a human. site_owner: webmaster@listes.minet.net # This is the local-part of an email address used in the From field whenever a # message comes from some entity to which there is no natural reply recipient. # Mailman will append '@' and the host name of the list involved. This # address must not bounce and it must not point to a Mailman process. noreply_address: noreply # The default language for this server. default_language: en # Membership tests for posting purposes are usually performed by looking at a # set of headers, passing the test if any of their values match a member of # the list. Headers are checked in the order given in this variable. The # value From_ means to use the envelope sender. Field names are case # insensitive. This is a space separate list of headers. sender_headers: from from_ reply-to sender # Mail command processor will ignore mail command lines after designated max. email_commands_max_lines: 10 # Default length of time a pending request is live before it is evicted from # the pending database. pending_request_life: 3d # How long should files be saved before they are evicted from the cache? cache_life: 7d # A callable to run with no arguments early in the initialization process. # This runs before database initialization. pre_hook: # A callable to run with no arguments late in the initialization process. # This runs after adapters are initialized. post_hook: # Which paths.* file system layout to use. # You should not change this variable. layout: debian # Can MIME filtered messages be preserved by list owners? filtered_messages_are_preservable: no # How should text/html parts be converted to text/plain when the mailing list # is set to convert HTML to plaintext? This names a command to be called, # where the substitution variable $filename is filled in by Mailman, and # contains the path to the temporary file that the command should read from. # The command should print the converted text to stdout. html_to_plain_text_command: /usr/bin/lynx -dump $filename # Specify what characters are allowed in list names. Characters outside of # the class [-_.+=!$*{}~0-9a-z] matched case insensitively are never allowed, # but this specifies a subset as the only allowable characters. This must be # a valid character class regexp or the effect on list creation is # unpredictable. listname_chars: [-_.0-9a-z] [shell] # `mailman shell` (also `withlist`) gives you an interactive prompt that you # can use to interact with an initialized and configured Mailman system. Use # --help for more information. This section allows you to configure certain # aspects of this interactive shell. # Customize the interpreter prompt. prompt: >>> # Banner to show on startup. banner: Welcome to the GNU Mailman shell # Use IPython as the shell, which must be found on the system. Valid values # are `no`, `yes`, and `debug` where the latter is equivalent to `yes` except # that any import errors will be displayed to stderr. use_ipython: no # Set this to allow for command line history if readline is available. This # can be as simple as $var_dir/history.py to put the file in the var directory. history_file: [paths.debian] # Important directories for Mailman operation. These are defined here so that # different layouts can be supported. For example, a developer layout would # be different from a FHS layout. Most paths are based off the var_dir, and # often just setting that will do the right thing for all the other paths. # You might also have to set spool_dir though. # # Substitutions are allowed, but must be of the form $var where 'var' names a # configuration variable in the paths.* section. Substitutions are expanded # recursively until no more $-variables are present. Beware of infinite # expansion loops! # # This is the root of the directory structure that Mailman will use to store # its run-time data. var_dir: /var/lib/mailman3 # This is where the Mailman queue files directories will be created. queue_dir: $var_dir/queue # This is the directory containing the Mailman 'runner' and 'master' commands # if set to the string '$argv', it will be taken as the directory containing # the 'mailman' command. bin_dir: /usr/lib/mailman3/bin # All list-specific data. list_data_dir: $var_dir/lists # Directory where log files go. log_dir: /var/log/mailman3 # Directory for system-wide locks. lock_dir: $var_dir/locks # Directory for system-wide data. data_dir: $var_dir/data # Cache files. cache_dir: $var_dir/cache # Directory for configuration files and such. etc_dir: /etc/mailman3 # Directory containing Mailman plugins. ext_dir: $var_dir/ext # Directory where the default IMessageStore puts its messages. messages_dir: $var_dir/messages # Directory for archive backends to store their messages in. Archivers should # create a subdirectory in here to store their files. archive_dir: $var_dir/archives # Root directory for site-specific template override files. template_dir: $var_dir/templates # There are also a number of paths to specific file locations that can be # defined. For these, the directory containing the file must already exist, # or be one of the directories created by Mailman as per above. # # This is where PID file for the master runner is stored. pid_file: /run/mailman3/master.pid # Lock file. lock_file: $lock_dir/master.lck [database] # The class implementing the IDatabase. class: mailman.database.sqlite.SQLiteDatabase #class: mailman.database.mysql.MySQLDatabase #class: mailman.database.postgresql.PostgreSQLDatabase # Use this to set the Storm database engine URL. You generally have one # primary database connection for all of Mailman. List data and most rosters # will store their data in this database, although external rosters may access # other databases in their own way. This string supports standard # 'configuration' substitutions. url: sqlite:///$DATA_DIR/mailman.db #url: mysql+pymysql://mailman3:mmpass@localhost/mailman3?charset=utf8&use_unicode=1 #url: postgres://mailman3:mmpass@localhost/mailman3 debug: no [logging.debian] # This defines various log settings. The options available are: # # - level -- Overrides the default level; this may be any of the # standard Python logging levels, case insensitive. # - format -- Overrides the default format string # - datefmt -- Overrides the default date format string # - path -- Overrides the default logger path. This may be a relative # path name, in which case it is relative to Mailman's LOG_DIR, # or it may be an absolute path name. You cannot change the # handler class that will be used. # - propagate -- Boolean specifying whether to propagate log message from this # logger to the root "mailman" logger. You cannot override # settings for the root logger. # # In this section, you can define defaults for all loggers, which will be # prefixed by 'mailman.'. Use subsections to override settings for specific # loggers. The names of the available loggers are: # # - archiver -- All archiver output # - bounce -- All bounce processing logs go here # - config -- Configuration issues # - database -- Database logging (SQLAlchemy and Alembic) # - debug -- Only used for development # - error -- All exceptions go to this log # - fromusenet -- Information related to the Usenet to Mailman gateway # - http -- Internal wsgi-based web interface # - locks -- Lock state changes # - mischief -- Various types of hostile activity # - runner -- Runner process start/stops # - smtp -- Successful SMTP activity # - smtp-failure -- Unsuccessful SMTP activity # - subscribe -- Information about leaves/joins # - vette -- Message vetting information format: %(asctime)s (%(process)d) %(message)s datefmt: %b %d %H:%M:%S %Y propagate: no level: info path: mailman.log [webservice] # The hostname at which admin web service resources are exposed. hostname: localhost # The port at which the admin web service resources are exposed. port: 8001 # Whether or not requests to the web service are secured through SSL. use_https: no # Whether or not to show tracebacks in an HTTP response for a request that # raised an exception. show_tracebacks: yes # The API version number for the current (highest) API. api_version: 3.1 # The administrative username. admin_user: restadmin # The administrative password. admin_pass: [mta] # The class defining the interface to the incoming mail transport agent. #incoming: mailman.mta.exim4.LMTP incoming: mailman.mta.postfix.LMTP # The callable implementing delivery to the outgoing mail transport agent. # This must accept three arguments, the mailing list, the message, and the # message metadata dictionary. outgoing: mailman.mta.deliver.deliver # How to connect to the outgoing MTA. If smtp_user and smtp_pass is given, # then Mailman will attempt to log into the MTA when making a new connection. smtp_host: localhost smtp_port: 25 smtp_user: smtp_pass: # Where the LMTP server listens for connections. Use 127.0.0.1 instead of # localhost for Postfix integration, because Postfix only consults DNS # (e.g. not /etc/hosts). lmtp_host: 127.0.0.1 lmtp_port: 8024 # Where can we find the mail server specific configuration file? The path can # be either a file system path or a Python import path. If the value starts # with python: then it is a Python import path, otherwise it is a file system # path. File system paths must be absolute since no guarantees are made about # the current working directory. Python paths should not include the trailing # .cfg, which the file must end with. #configuration: python:mailman.config.exim4 configuration: python:mailman.config.postfix [archiver.hyperkitty] class: mailman_hyperkitty.Archiver enable: yes configuration: /etc/mailman3/mailman-hyperkitty.cfg A cette étape vous pouvez créer des mailing-list et les manipuler, mais ce n'est pas très pratique car il faut être connecté sur la CT et manipuler en python/bash. **postorius & hyperkitty** Installons désormais l'interface graphique de mailman3. Celle-ci est composée de deux parties distinctes : postorius pour la gestion des listes et hyperkitty pour l'archivage et l'interface d'archives. Installons les packets : apt-get install mailman3-web Les configurations sont dans le dossier "/usr/share/mailman3-web/" Voici les config utilisées : settings_local.py # This file is imported by the Mailman Suite. It is used to override # the default settings from /usr/share/mailman3-web/settings.py. # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '' ADMINS = ( ('Mailman Suite Admin', 'root@localhost'), ) # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.8/ref/settings/#allowed-hosts # Set to '*' per default in the Deian package to allow all hostnames. Mailman3 # is meant to run behind a webserver reverse proxy anyway. ALLOWED_HOSTS = [ #"localhost", # Archiving API from Mailman, keep it. # "lists.your-domain.org", # Add here all production URLs you may have. '*' ] # Mailman API credentials MAILMAN_REST_API_URL = 'http://localhost:8001' MAILMAN_REST_API_USER = 'restadmin' MAILMAN_REST_API_PASS = 'pass' MAILMAN_ARCHIVER_KEY = 'key' MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1') # Application definition INSTALLED_APPS = ( 'hyperkitty', 'postorius', 'django_mailman3', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'django_gravatar', 'compressor', 'haystack', 'django_extensions', 'django_q', 'allauth', 'allauth.account', 'allauth.socialaccount', #'django_mailman3.lib.auth.fedora', #'allauth.socialaccount.providers.openid', #'allauth.socialaccount.providers.github', #'allauth.socialaccount.providers.gitlab', #'allauth.socialaccount.providers.google', #'allauth.socialaccount.providers.facebook', #'allauth.socialaccount.providers.twitter', #'allauth.socialaccount.providers.stackexchange', ) # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases DATABASES = { 'default': { # Use 'sqlite3', 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'ENGINE': 'django.db.backends.sqlite3', #'ENGINE': 'django.db.backends.postgresql_psycopg2', #'ENGINE': 'django.db.backends.mysql', # DB name or path to database file if using sqlite3. 'NAME': '/var/lib/mailman3/web/mailman3web.db', # The following settings are not used with sqlite3: 'USER': '', 'PASSWORD': '', # HOST: empty for localhost through domain sockets or '127.0.0.1' for # localhost through TCP. 'HOST': '', # PORT: set to empty string for default. 'PORT': '', # OPTIONS: Extra parameters to use when connecting to the database. 'OPTIONS': { # Set sql_mode to 'STRICT_TRANS_TABLES' for MySQL. See # https://docs.djangoproject.com/en/1.11/ref/ # databases/#setting-sql-mode #'init_command': "SET sql_mode='STRICT_TRANS_TABLES'", }, } } # If you're behind a proxy, use the X-Forwarded-Host header # See https://docs.djangoproject.com/en/1.8/ref/settings/#use-x-forwarded-host USE_X_FORWARDED_HOST = True # And if your proxy does your SSL encoding for you, set SECURE_PROXY_SSL_HEADER # https://docs.djangoproject.com/en/1.8/ref/settings/#secure-proxy-ssl-header # SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_SCHEME', 'https') # Other security settings # SECURE_SSL_REDIRECT = True # If you set SECURE_SSL_REDIRECT to True, make sure the SECURE_REDIRECT_EXEMPT # contains at least this line: # SECURE_REDIRECT_EXEMPT = [ # "archives/api/mailman/.*", # Request from Mailman. # ] # SESSION_COOKIE_SECURE = True # SECURE_CONTENT_TYPE_NOSNIFF = True # SECURE_BROWSER_XSS_FILTER = True # CSRF_COOKIE_SECURE = True # CSRF_COOKIE_HTTPONLY = True # X_FRAME_OPTIONS = 'DENY' # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ LANGUAGE_CODE = 'fr' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Set default domain for email addresses. EMAILNAME = 'minet.net' # If you enable internal authentication, this is the address that the emails # will appear to be coming from. Make sure you set a valid domain name, # otherwise the emails may get rejected. # https://docs.djangoproject.com/en/1.8/ref/settings/#default-from-email # DEFAULT_FROM_EMAIL = "mailing-lists@you-domain.org" DEFAULT_FROM_EMAIL = 'webmaster@{}'.format(EMAILNAME) # If you enable email reporting for error messages, this is where those emails # will appear to be coming from. Make sure you set a valid domain name, # otherwise the emails may get rejected. # https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-SERVER_EMAIL # SERVER_EMAIL = 'root@your-domain.org' SERVER_EMAIL = 'root@{}'.format(EMAILNAME) # Django Allauth ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https" # # Social auth # SOCIALACCOUNT_PROVIDERS = { #'openid': { # 'SERVERS': [ # dict(id='yahoo', # name='Yahoo', # openid_url='http://me.yahoo.com'), # ], #}, #'google': { # 'SCOPE': ['profile', 'email'], # 'AUTH_PARAMS': {'access_type': 'online'}, #}, #'facebook': { # 'METHOD': 'oauth2', # 'SCOPE': ['email'], # 'FIELDS': [ # 'email', # 'name', # 'first_name', # 'last_name', # 'locale', # 'timezone', # ], # 'VERSION': 'v2.4', #}, } # On a production setup, setting COMPRESS_OFFLINE to True will bring a # significant performance improvement, as CSS files will not need to be # recompiled on each requests. It means running an additional "compress" # management command after each code upgrade. # http://django-compressor.readthedocs.io/en/latest/usage/#offline-compression COMPRESS_OFFLINE = True POSTORIUS_TEMPLATE_BASE_URL = 'http://localhost/mailman3/' settings.py # -*- coding: utf-8 -*- # Copyright (C) 1998-2016 by the Free Software Foundation, Inc. # # This file is part of Mailman Suite. # # Mailman Suite is free sofware: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) # any later version. # # Mailman Suite is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # You should have received a copy of the GNU General Public License along # with Mailman Suite. If not, see . """ Django Settings for Mailman Suite (hyperkitty + postorius) For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ADMINS = ( ('Mailman Suite Admin', 'root@localhost'), ) SITE_ID = 1 # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.8/ref/settings/#allowed-hosts ALLOWED_HOSTS = [ "localhost", # Archiving API from Mailman, keep it. # "lists.your-domain.org", # Add here all production URLs you may have. ] # Mailman API credentials MAILMAN_REST_API_URL = 'http://localhost:8001' MAILMAN_REST_API_USER = 'restadmin' MAILMAN_REST_API_PASS = 'restpass' MAILMAN_ARCHIVER_KEY = "" MAILMAN_ARCHIVER_FROM = ('127.0.0.1', '::1') # Application definition INSTALLED_APPS = ( 'hyperkitty', 'postorius', 'django_mailman3', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'django_gravatar', 'compressor', 'haystack', 'django_extensions', 'django_q', 'allauth', 'allauth.account', 'allauth.socialaccount', 'django_mailman3.lib.auth.fedora', #'allauth.socialaccount.providers.openid', #'allauth.socialaccount.providers.github', #'allauth.socialaccount.providers.gitlab', #'allauth.socialaccount.providers.google', #'allauth.socialaccount.providers.facebook', #'allauth.socialaccount.providers.twitter', #'allauth.socialaccount.providers.stackexchange', ) MIDDLEWARE = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django_mailman3.middleware.TimezoneMiddleware', 'postorius.middleware.PostoriusMiddleware', ) ROOT_URLCONF = 'urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.template.context_processors.csrf', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'django_mailman3.context_processors.common', 'hyperkitty.context_processors.common', 'postorius.context_processors.postorius', ], }, }, ] WSGI_APPLICATION = 'wsgi.application' # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases DATABASES = { 'default': { # Use 'sqlite3', 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'ENGINE': 'django.db.backends.postgresql_psycopg2', # DB name or path to database file if using sqlite3. 'NAME': 'mailman3web', # The following settings are not used with sqlite3: 'USER': 'mailmansuite', 'PASSWORD': 'mmpass', # HOST: empty for localhost through domain sockets or '127.0.0.1' for # localhost through TCP. 'HOST': '', # PORT: set to empty string for default. 'PORT': '', } } # If you're behind a proxy, use the X-Forwarded-Host header # See https://docs.djangoproject.com/en/1.8/ref/settings/#use-x-forwarded-host USE_X_FORWARDED_HOST = True # And if your proxy does your SSL encoding for you, set SECURE_PROXY_SSL_HEADER # https://docs.djangoproject.com/en/1.8/ref/settings/#secure-proxy-ssl-header # SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_SCHEME', 'https') # Other security settings # SECURE_SSL_REDIRECT = True # If you set SECURE_SSL_REDIRECT to True, make sure the SECURE_REDIRECT_EXEMPT # contains at least this line: # SECURE_REDIRECT_EXEMPT = [ # "archives/api/mailman/.*", # Request from Mailman. # ] # SESSION_COOKIE_SECURE = True # SECURE_CONTENT_TYPE_NOSNIFF = True # SECURE_BROWSER_XSS_FILTER = True # CSRF_COOKIE_SECURE = True # CSRF_COOKIE_HTTPONLY = True # X_FRAME_OPTIONS = 'DENY' # Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ LANGUAGE_CODE = 'fr' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/var/www/example.com/static/" STATIC_ROOT = '/var/lib/mailman3/web/static' # URL prefix for static files. # Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = '/mailman3/static/' # Additional locations of static files STATICFILES_DIRS = ( # Put strings here, like "/home/html/static" or "C:/www/django/static". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. # BASE_DIR + '/static/', ) # List of finder classes that know how to find static files in # various locations. STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', # 'django.contrib.staticfiles.finders.DefaultStorageFinder', 'compressor.finders.CompressorFinder', ) # Django 1.6+ defaults to a JSON serializer, but it won't work with # django-openid, see # https://bugs.launchpad.net/django-openid-auth/+bug/1252826 SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' LOGIN_URL = 'account_login' LOGIN_REDIRECT_URL = 'list_index' LOGOUT_URL = 'account_logout' HOSTNAME = 'localhost.local' # If you enable internal authentication, this is the address that the emails # will appear to be coming from. Make sure you set a valid domain name, # otherwise the emails may get rejected. # https://docs.djangoproject.com/en/1.8/ref/settings/#default-from-email # DEFAULT_FROM_EMAIL = "mailing-lists@you-domain.org" DEFAULT_FROM_EMAIL = 'postorius@{}'.format(HOSTNAME) # If you enable email reporting for error messages, this is where those emails # will appear to be coming from. Make sure you set a valid domain name, # otherwise the emails may get rejected. # https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-SERVER_EMAIL # SERVER_EMAIL = 'root@your-domain.org' SERVER_EMAIL = 'root@{}'.format(HOSTNAME) # Change this when you have a real email backend EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' # Compatibility with Bootstrap 3 from django.contrib.messages import constants as messages # flake8: noqa MESSAGE_TAGS = { messages.ERROR: 'danger' } # # Social auth # AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'allauth.account.auth_backends.AuthenticationBackend', 'django_auth_ldap.backend.LDAPBackend' ) AUTH_LDAP_SERVER_URI = "ldap://192.168.102.22:389" AUTH_LDAP_BIND_DN = "" AUTH_LDAP_BIND_PASSWORD = "" UTH_LDAP_START_TLS = False AUTH_LDAP_USER_ATTR_MAP = {"first_name": "givenName", "last_name": "sn", "email": "mail"} import ldap from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion AUTH_LDAP_USER_SEARCH = LDAPSearchUnion( LDAPSearch("ou=equipe,dc=minet,dc=net", ldap.SCOPE_SUBTREE, "(uid=%(user)s)") ) # depending on your group type, use one of the following: # from django_auth_ldap.config import PosixGroupType # AUTH_LDAP_GROUP_TYPE = PosixGroupType() # or: import ldap from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion # depending on your group type, use one of the following: # from django_auth_ldap.config import PosixGroupType # AUTH_LDAP_GROUP_TYPE = PosixGroupType() # AUTH_LDAP_GROUP_SEARCH = LDAPSearch("group dn ",ldap.SCOPE_SUBTREE, "(objectClass="posixGroup")") # or: from django_auth_ldap.config import GroupOfUniqueNamesType # Django Allauth ACCOUNT_AUTHENTICATION_METHOD = "username_email" ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_EMAIL_VERIFICATION = "mandatory" # You probably want https in production, but this is a dev setup file ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https" ACCOUNT_UNIQUE_EMAIL = True SOCIALACCOUNT_PROVIDERS = { #'openid': { # 'SERVERS': [ # dict(id='yahoo', # name='Yahoo', # openid_url='http://me.yahoo.com'), # ], #}, #'google': { # 'SCOPE': ['profile', 'email'], # 'AUTH_PARAMS': {'access_type': 'online'}, #}, #'facebook': { # 'METHOD': 'oauth2', # 'SCOPE': ['email'], # 'FIELDS': [ # 'email', # 'name', # 'first_name', # 'last_name', # 'locale', # 'timezone', # ], # 'VERSION': 'v2.4', #}, } # # Gravatar # https://github.com/twaddington/django-gravatar # # Gravatar base url. # GRAVATAR_URL = 'http://cdn.libravatar.org/' # Gravatar base secure https url. # GRAVATAR_SECURE_URL = 'https://seccdn.libravatar.org/' # Gravatar size in pixels. # GRAVATAR_DEFAULT_SIZE = '80' # An image url or one of the following: 'mm', 'identicon', 'monsterid', # 'wavatar', 'retro'. # GRAVATAR_DEFAULT_IMAGE = 'mm' # One of the following: 'g', 'pg', 'r', 'x'. # GRAVATAR_DEFAULT_RATING = 'g' # True to use https by default, False for plain http. # GRAVATAR_DEFAULT_SECURE = True # # django-compressor # https://pypi.python.org/pypi/django_compressor # COMPRESS_PRECOMPILERS = ( ('text/less', 'lessc {infile} {outfile}'), ('text/x-scss', 'sassc -t compressed {infile} {outfile}'), ('text/x-sass', 'sassc -t compressed {infile} {outfile}'), ) # On a production setup, setting COMPRESS_OFFLINE to True will bring a # significant performance improvement, as CSS files will not need to be # recompiled on each requests. It means running an additional "compress" # management command after each code upgrade. # http://django-compressor.readthedocs.io/en/latest/usage/#offline-compression # COMPRESS_OFFLINE = True # Needed for debug mode # INTERNAL_IPS = ('127.0.0.1',) # # Full-text search engine # HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', 'PATH': '/var/lib/mailman3/web/fulltext_index', # You can also use the Xapian engine, it's faster and more accurate, # but requires another library. # http://django-haystack.readthedocs.io/en/v2.4.1/installing_search_engines.html#xapian # Example configuration for Xapian: #'ENGINE': 'xapian_backend.XapianEngine' }, } # # Asynchronous tasks # Q_CLUSTER = { 'timeout': 300, 'save_limit': 100, 'orm': 'default', 'poll': 5, } # A sample logging configuration. The only tangible logging # performed by this configuration is to send an email to # the site admins on every HTTP 500 error when DEBUG=False. # See http://docs.djangoproject.com/en/dev/topics/logging for # more details on how to customize your logging configuration. LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse' } }, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'filters': ['require_debug_false'], 'class': 'django.utils.log.AdminEmailHandler' }, 'file':{ 'level': 'INFO', 'class': 'logging.handlers.RotatingFileHandler', #'class': 'logging.handlers.WatchedFileHandler', 'filename': '/var/log/mailman3/web/mailman-web.log', 'formatter': 'verbose', }, 'console': { 'class': 'logging.StreamHandler', 'formatter': 'simple', }, }, 'loggers': { 'django.request': { 'handlers': ['mail_admins', 'file'], 'level': 'INFO', 'propagate': True, }, 'django': { 'handlers': ['file'], 'level': 'INFO', 'propagate': True, }, 'hyperkitty': { 'handlers': ['file'], 'level': 'INFO', 'propagate': True, }, 'postorius': { 'handlers': ['file'], 'level': 'INFO', 'propagate': True, }, 'django_auth_ldap': { 'handler': ['console'], 'level': 'DEBUG' } }, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(process)d %(name)s %(message)s' }, 'simple': { 'format': '%(levelname)s %(message)s' }, }, #'root': { # 'handlers': ['file'], # 'level': 'INFO', #}, } # Using the cache infrastructure can significantly improve performance on a # production setup. This is an example with a local Memcached server. #CACHES = { # 'default': { # 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', # 'LOCATION': '127.0.0.1:11211', # } #} # # HyperKitty-specific # # Only display mailing-lists from the same virtual host as the webserver FILTER_VHOST = False POSTORIUS_TEMPLATE_BASE_URL = 'http://localhost:8000' try: from settings_local import * except ImportError: pass Une fois ces configurations effectuées, il va falloir configurer nginx. En théorie vous avez juste à copier l'exemple dans /etc/mailman3 : il fonctionne très bien. ==== Initialisation ==== Démarrez les services. service postfix start service mailman3 start service mailman3-web start Une fois cela fait, nous allons pouvoir créer votre premier compte administrateur. Rendez-vous dans /usr/share/mailman3-web : vous y trouverez un script "manage.py" qui vous permettra de gérer tout un tas d'aspect de votre plateforme web. Dans notre cas : python3 createsuperuser Suivez ensuite les étapes. Vous pourrez grâce à la BDD mailman3-web nommer quelqu'un superuser sur son compte LDAP par exemple. (cela doit se transmettre entre présidents par exemple) Vous pouvez alors vous connecter, valider votre email et gérer les mailing-list. En théorie à ce niveau tout fonctionne. ==== Informations complémentaires ==== **Authentification LDAP** Vous avez configuré avec les configurations proposées une authentification par LDAP, cela signifie que tout user de la team MiNET peut se co avec ses identifiants LDAP : un compte sera ensuite crée dans la base de données du site (donc cela fonctionnera aussi si le ldap tombe !) Tout user peut également s'inscrire sans ldap ce qui permet aux utilisateurs des ML externes à MiNET d'utiliser aussi le site. **Archives HyperKitty** La synchro entre postorius et hyperkitty peut être capricieuse. Au cas où vous voudriez passer des archives en private, faites le directement via la BDD. Pour supprimer proprement des archives hyperkitty en python : from hyperkitty.models import MailingList ml = MailingList.objects.get(name="yourlist@example.com") ml.delete() mailman3, mailman3-web et hyperkitty se synchronisent via des cron' donc si il y a des problèmes vous pouvez les lancer manuellement. python3 manage.py runjobs Si le souci n'est toujours pas résolu : python3 manage.py sync_mailman Ce qui "devrait" synchroniser les listes et leurs propriétées mailman3 sur hyperkitty. Et si enfin ça ne passe pas, on peut mettre à jour l'index. python3 manage.py update_index Sinon il faut chercher côté DB et logs. (et documentation bien sûr !) **Gestion de son compte user** Tout user d'une ML peut se co sur le site, consulter les archives de tous ses abonnements et se désabonner ou tout simplement décider de ne plus recevoir les mails sans se désabonner. Pour cela il suffit de se connecter puis cliquer sur son pseudo en haut à droite, ensuite "mailman settings" et vous pourrez trouver votre bonheur. Vous pouvez aussi lier un autre e-mail sur votre compte, il faut juste aller dans "Compte" et ajouter ce mail. Votre compte pourra alors consulter toutes les mailing list / archives liées au mail ajouté. ==== Mailing-List par bâtiments ==== Dans le but de pouvoir communiquer directement avec les adhérents, des mailing-list spécifiques sont en place. Chacune est liée à un bâtiment. Exemple : u1@listes.minet.net Toutes les nuits un jobs jenkins est lancé et exécute le programme cron_mailing.sh situé dans /root/mailing_adherents sur la CT liste. Ce programme synchronise les ML avec la DB fdpsql. Il vire les adhérents dont la cotisation est expirée et ajoute ceux actifs dans leurs bâtiments respectifs. Il existe également une ML adherents@listes.minet.net qui recense ces 7 listes de bâtiments. Toutes ces ML sont soumises à approbation d'un owner pour utilisation : soit le président soit le respo. comm.