From b51c7030e5f8a67b98f5e00a7871c87b5059847b Mon Sep 17 00:00:00 2001 From: Alexandre Barbosa Date: Fri, 23 Jan 2015 17:12:35 -0200 Subject: [PATCH] Update Mailman section --- docs/install.rst | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- docs/postfix-to-mailman-centos.py | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 185 insertions(+), 8 deletions(-) create mode 100755 docs/postfix-to-mailman-centos.py diff --git a/docs/install.rst b/docs/install.rst index f88ebb2..b4da73c 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -192,9 +192,11 @@ Para configurar o Nginx crie o arquivo ``/etc/nginx/conf.d/colab.conf`` com o co } -Substitua o domínio de exemplo ``beta.softwarepublico.gov.br`` pelo domínio desejado. +Substitua o domínio de exemplo ``beta.softwarepublico.gov.br`` pelo domínio +desejado. -Certifique-se de instalar o certificado SSL (``/etc/nginx/colab.crt``) e sua chave privada (``/etc/nginx/colab.crt``). +Certifique-se de instalar o certificado SSL (``/etc/nginx/colab.crt``) e sua +chave privada (``/etc/nginx/colab.key``). Reinicie o serviço do Nginx com o comando: ``sudo service nginx restart``. @@ -251,13 +253,15 @@ Edite o arquivo ``/etc/colab/settings.yaml`` e configure o endereço das ferrame upstream: 'http://localhost:8090/noosfero' -Após editar todos os arquivos desejados reinicie o processo do Colab com utilizando o comando ``service colab restart``. +Após editar todos os arquivos desejados reinicie o processo do Colab com +utilizando o comando ``service colab restart``. Gitlab ++++++ -Edite o arquivo ``/etc/gitlab/gitlab.yaml`` acrescentando o atributo relative_url_root após a linha ``email_from: example@example.com``. +Edite o arquivo ``/etc/gitlab/gitlab.yml`` acrescentando o atributo +relative_url_root após a linha ``email_from: example@example.com``. Veja o exemplo a seguir: .. code-block:: yaml @@ -302,7 +306,7 @@ seguinte conteúdo: Crie/edite o arquivo ``/etc/default/noosfero`` e adicione a seguinte linha: -.. code-block:: sh +.. code-block:: ruby export RAILS_RELATIVE_URL_ROOT=/social @@ -322,7 +326,7 @@ Edite o arquivo de configuração do `mailman` em DEFAULT_EMAIL_HOST = 'listas.softwarepublico.gov.br' MTA = None - POSTFIX_STYLE_VIRTUAL_DOMAINS ['listas.softwarepublico.gov.br'] + POSTFIX_STYLE_VIRTUAL_DOMAINS = ['listas.softwarepublico.gov.br'] Crie a lista de discussão default, necessária para a inicialização do serviço. Substitua ``USER@DOMAIN.COM`` pelo email a ser usado como @@ -335,6 +339,9 @@ administrador do `mailman`, e ``PASSWORD`` pela senha de administração do $ sudo service mailman restart +Postfix ++++++++ + Configure o postfix: .. code-block:: sh @@ -342,13 +349,50 @@ Configure o postfix: $ sudo postconf relay_domains=listas.softwarepublico.gov.br $ sudo postconf transport_maps=hash:/etc/postfix/transport -Crie/edite ``/etc/postfix/transport`` com o seguinte conteúdo:: +Crie/edite ``/etc/postfix/transport`` com o seguinte conteúdo: + +.. code-block:: sh listas.softwarepublico.gov.br mailman: -Gere o banco de dados para consulta, e reinicie o serviço:: + +Faça o download do arquivo :download:`postfix-to-mailman-centos.py` e salve no +diretório ``/etc/postfix``. + +Adicione o seguinte conteúdo no final do arquivo ``/etc/postfix/master.cf``: + +:: + + mailman unix - n n - - pipe + flags=FR user=mailman:mailman + argv=/etc/postfix/postfix-to-mailman-centos.py ${nexthop} ${user} + +Gere o banco de dados para consulta, e reinicie o serviço: .. code-block:: sh $ sudo postmap /etc/postfix/transport $ sudo service postfix restart + +Inicie o serviço do mailman-api: + +.. code-block:: sh + + $ sudo service mailman-api start + + +Habilitar inicialização automática dos serviços ++++++++++++++++++++++++++++++++++++++++++++++++ + +Para permitir que os serviços iniciem automaticamente, execute os comandos +abaixo: + +.. code-block:: sh + + $ sudo systemctl enable mailman + $ sudo systemctl enable mailman-api + $ sudo systemctl enable nginx + $ sudo systemctl enable colab + $ sudo systemctl enable noosfero + $ sudo chkconfig --add gitlab + $ sudo chkconfig --add solr diff --git a/docs/postfix-to-mailman-centos.py b/docs/postfix-to-mailman-centos.py new file mode 100755 index 0000000..6629d02 --- /dev/null +++ b/docs/postfix-to-mailman-centos.py @@ -0,0 +1,133 @@ +#! /usr/bin/env python + +# Configuration variables - Change these for your site if necessary. +MailmanHome = "/var/lib/mailman"; # Mailman home directory. +MailmanOwner = "postmaster@example.com"; # Postmaster and abuse mail recipient. +MailmanScripts = "/usr/lib/mailman"; # Where mailman scripts reside + +# End of configuration variables. + +# postfix-to-mailman-2.1.py (to be installed as postfix-to-mailman.py) +# +# Interface mailman to a postfix with a mailman transport. Does not require +# the creation of _any_ aliases to connect lists to your mail system. +# +# Dax Kelson, dkelson@gurulabs.com, Sept 2002. +# coverted from qmail to postfix interface +# Jan 2003: Fixes for Mailman 2.1 +# Thanks to Simen E. Sandberg +# Feb 2003: Change the suggested postfix transport to support VERP +# Thanks to Henrique de Moraes Holschuh +# +# This script was originally qmail-to-mailman.py by: +# Bruce Perens, bruce@perens.com, March 1999. +# This is free software under the GNU General Public License. +# +# This script is meant to be called from ~mailman/postfix-to-mailman.py. +# It catches all mail to a virtual domain, eg "lists.example.com". +# It looks at the recipient for each mail message and decides if the mail is +# addressed to a valid list or not, and bounces the message with a helpful +# suggestion if it's not addressed to a list. It decides if it is a posting, +# a list command, or mail to the list administrator, by checking for the +# -admin, -owner, and -request addresses. It will recognize a list as soon +# as the list is created, there is no need to add _any_ aliases for any list. +# It recognizes mail to postmaster, mailman-owner, abuse, mailer-daemon, root, +# and owner, and routes those mails to MailmanOwner as defined in the +# configuration variables, above. +# +# INSTALLATION: +# +# Install this file as ~mailman/postfix-to-mailman.py +# +# To configure a virtual domain to connect to mailman, edit Postfix thusly: +# +# /etc/postfix/main.cf: +# relay_domains = ... lists.example.com +# transport_maps = hash:/etc/postfix/transport +# mailman_destination_recipient_limit = 1 +# +# /etc/postfix/transport: +# lists.example.com mailman: +# +# /etc/postfix/master.cf +# mailman unix - n n - - pipe +# flags=FR user=mailman:mailman +# argv=/var/mailman/postfix-to-mailman.py ${nexthop} ${user} +# +# +# Replace list.example.com above with the name of the domain to be connected +# to Mailman. Note that _all_ mail to that domain will go to Mailman, so you +# don't want to put the name of your main domain here. Typically a virtual +# domain lists.domain.com is used for Mailman, and domain.com for regular +# email. +# + +import sys, os, re, string + +def main(): + os.nice(5) # Handle mailing lists at non-interactive priority. + # delete this if you wish + + os.chdir(MailmanHome + "/lists") + + try: + local = sys.argv[2] + except: + # This might happen if we're not using Postfix + sys.stderr.write("LOCAL not set?\n") + sys.exit(1) + + local = string.lower(local) + local = re.sub("^mailman-","",local) + + names = ("root", "postmaster", "mailer-daemon", "mailman-owner", "owner", + "abuse") + for i in names: + if i == local: + os.execv("/usr/sbin/sendmail", + ("/usr/sbin/sendmail", MailmanOwner)) + sys.exit(0) + + type = "post" + types = (("-admin$", "admin"), + ("-owner$", "owner"), + ("-request$", "request"), + ("-bounces$", "bounces"), + ("-confirm$", "confirm"), + ("-join$", "join"), + ("-leave$", "leave"), + ("-subscribe$", "subscribe"), + ("-unsubscribe$", "unsubscribe")) + + for i in types: + if re.search(i[0],local): + type = i[1] + local = re.sub(i[0],"",local) + + if os.path.exists(local): + os.execv(MailmanScripts + "/mail/mailman", + (MailmanScripts + "/mail/mailman", type, local)) + else: + bounce() + sys.exit(75) + +def bounce(): + bounce_message = """\ +TO ACCESS THE MAILING LIST SYSTEM: Start your web browser on +http://%s/ +That web page will help you subscribe or unsubscribe, and will +give you directions on how to post to each mailing list.\n""" + sys.stderr.write(bounce_message % (sys.argv[1])) + sys.exit(1) + +try: + sys.exit(main()) +except SystemExit, argument: + sys.exit(argument) + +except Exception, argument: + info = sys.exc_info() + trace = info[2] + sys.stderr.write("%s %s\n" % (sys.exc_type, argument)) + sys.stderr.write("Line %d\n" % (trace.tb_lineno)) + sys.exit(75) # Soft failure, try again later. -- libgit2 0.21.2