Configure mail server: Postfix
Requirements
-
A mail domain name for the mailing list service. See also "Requirements".
In the instructions below,
mail.example.org
will be used for example.
Two ways to integrate
There are two ways to integrate Sympa into Postfix:
- Virtual domain setting (using
postmap
and transports). - Single domain setting (using
postalias
and alias database).
The former is recommended. However, if you will never have plan to manage multiple domains, the latter is easier way.
You can not mix both ways. Following sections describe these two ways by each.
Virtual domain setting
Initial setting
Steps in this section may be done once at the first time.
-
If path of
sendmail
executable file is differ from the default value ofsendmail
parameter,/usr/sbin/sendmail
, define it insympa.conf
. For example:sendmail /usr/local/sbin/sendmail
-
Create
list_aliases.tt2
file in$SYSCONFDIR
directory with following content:#--- [% list.name %]@[% list.domain %]: list transport map created at [% date %] [% list.name %]@[% list.domain %] sympa:[% list.name %]@[% list.domain %] [% list.name %]-request@[% list.domain %] sympa:[% list.name %]-request@[% list.domain %] [% list.name %]-editor@[% list.domain %] sympa:[% list.name %]-editor@[% list.domain %] #[% list.name %]-subscribe@[% list.domain %] sympa:[% list.name %]-subscribe@[%list.domain %] [% list.name %]-unsubscribe@[% list.domain %] sympa:[% list.name %]-unsubscribe@[% list.domain %] [% list.name %][% return_path_suffix %]@[% list.domain %] sympabounce:[% list.name %]@[% list.domain %]
and edit it as you prefer.
Edit
sympa.conf
to add following lines (Note: replace$SYSCONFDIR
below):sendmail_aliases $SYSCONFDIR/sympa_transport aliases_program postmap aliases_db_type hash
By these settings,
sympa_transport
file will be updated automatically when any lists are created, closed, restored or purged. -
Create empty map files (Note: replace
$SYSCONFDIR
below):# touch $SYSCONFDIR/transport.sympa # touch $SYSCONFDIR/virtual.sympa # touch $SYSCONFDIR/sympa_transport # chmod 644 $SYSCONFDIR/sympa_transport # chown sympa:sympa $SYSCONFDIR/sympa_transport
and create databases (Note: replace
$SYSCONFDIR
):# postmap hash:$SYSCONFDIR/transport.sympa # postmap hash:$SYSCONFDIR/virtual.sympa # sympa_newaliases.pl
Note
- With steps above,
sympa_transport
file is world-readable and people may know all of the names of existing lists. To prevent it, follow the steps below after the steps above:where# chmod 640 $SYSCONFDIR/sympa_transport $SYSCONFDIR/sympa_transport.db # chgrp postfix $SYSCONFDIR/sympa_transport $SYSCONFDIR/sympa_transport.db
postfix
is the group the service processes of Postfix belong to.
- With steps above,
-
Edit Postfix
master.cf
file to add transport definitions (Note: replace$LIBEXECDIR
below):sympa unix - n n - - pipe flags=hqRu null_sender= user=sympa argv=$LIBEXECDIR/queue ${nexthop} sympabounce unix - n n - - pipe flags=hqRu null_sender= user=sympa argv=$LIBEXECDIR/bouncequeue ${nexthop}
A few notes:
flags
attribute has to containR
.F
is unnecessary.null_sender
attribute with empty value is required for Postfix 2.3 or later.
-
Edit Postfix
main.cf
file to add configuration for virtual domains (Note: replace$SYSCONFDIR
below):# virtual(8) maps virtual_mailbox_domains = (...existing parameter value...), hash:$SYSCONFDIR/transport.sympa virtual_mailbox_maps = (...existing parameter value...), hash:$SYSCONFDIR/transport.sympa, hash:$SYSCONFDIR/sympa_transport, hash:$SYSCONFDIR/virtual.sympa # virtual(5) maps virtual_alias_maps = (...existing parameter value...), hash:$SYSCONFDIR/virtual.sympa # transport maps transport_maps = (...existing parameter value...), hash:$SYSCONFDIR/transport.sympa, hash:$SYSCONFDIR/sympa_transport # For VERP recipient_delimiter = +
Note
- If
mydestination
parameter inmain.cf
file includes the virtual domain listed invirtual_mailbox_domains
, Postfix outputs warnings to system log. Remove virtual domain(s) frommydestination
.
- If
Adding new domain
Steps in this section have to be done every time the new domain is added.
-
Create directories for virtual domain configurations (Note: replace
$SYSCONFDIR
,$EXPLDIR
andmail.example.org
below):# mkdir -m 755 $SYSCONFDIR/mail.example.org # touch $SYSCONFDIR/mail.example.org/robot.conf # chown -R sympa:sympa $SYSCONFDIR/mail.example.org # mkdir -m 750 $EXPLDIR/mail.example.org # chown sympa:sympa $EXPLDIR/mail.example.org
-
If you want to override global settings in
sympa.conf
(such aslang
) by each domain, you can add it torobot.conf
file above. -
If Sympa services have already been running, reload them (see "Reloading Sympa services").
-
Add following contents to
transport.sympa
andvirtual.sympa
files and edit them as you prefer (Note: replacemail.example.org
below).transport.sympa
:mail.example.org error:User unknown in recipient table sympa@mail.example.org sympa:sympa@mail.example.org listmaster@mail.example.org sympa:listmaster@mail.example.org bounce@mail.example.org sympabounce:sympa@mail.example.org abuse-feedback-report@mail.example.org sympabounce:sympa@mail.example.org
virtual.sympa
:sympa-request@mail.example.org postmaster@localhost sympa-owner@mail.example.org postmaster@localhost
Note
- If you want some addresses of
mail.example.org
to be excluded from mailing list service, you can add them to these files.
Then, update databases for transport map and virtual alias map (Note: replace
$SYSCONFDIR
below):# postmap hash:$SYSCONFDIR/transport.sympa # postmap hash:$SYSCONFDIR/virtual.sympa
- If you want some addresses of
-
Reload Postfix. Then test configuration according to instruction.
Single domain setting
-
Edit
sympa.conf
to add following lines (Note: replacemail.example.org
):domain mail.example.org aliases_program postalias sendmail /usr/local/sbin/sendmail (If path is differ from the default)
-
Save following excerpt as
aliases.sympa.postfix
file in$SYSCONFDIR
and edit it as you prefer (Note: replace$LIBEXECDIR
andmail.example.org
below):# Service aliases for Sympa. sympa: "| $LIBEXECDIR/queue sympa@mail.example.org" listmaster: "| $LIBEXECDIR/queue listmaster@mail.example.org" bounce: "| $LIBEXECDIR/bouncequeue sympa@mail.example.org" abuse-feedback-report: "| $LIBEXECDIR/bouncequeue sympa@mail.example.org" sympa-request: postmaster sympa-owner: postmaster #listserv: sympa #listserv-request: sympa-request #majordomo: sympa #listserv-owner: sympa-owner
If
$SENDMAIL_ALIASES
file does not exist, create it (Note: replace$SENDMAIL_ALIASES
below):# touch $SENDMAIL_ALIASES # chmod 640 $SENDMAIL_ALIASES # chown sympa:sympa $SENDMAIL_ALIASES
and create alias databases (Note: replace
$SYSCONFDIR
):# postalias hash:$SYSCONFDIR/aliases.sympa.postfix # sympa_newaliases.pl
-
Edit Postfix main.cf file (Note: replace
$SYSCONFDIR
,$SENDMAIL_ALIASES
andmail.example.org
below):mydestination = (...existing parameter value...), mail.example.org alias_maps = (...existing parameter value...), hash:$SYSCONFDIR/aliases.sympa.postfix, hash:$SENDMAIL_ALIASES alias_database = (...existing parameter value...), hash:$SYSCONFDIR/aliases.sympa.postfix recipient_delimiter = +
-
Reload Postfix. Then test configuration according to instruction.