Configure mail server: Postfix
Requirements
-
A mail domain name for the mailing list service. See also “Requirements”.
In the instructions below,
mail.example.orgwill be used for example.
Two ways to integrate
There are two ways to integrate Sympa into Postfix:
- Virtual domain setting (using
postmapand transports). - Single domain setting (using
postaliasand 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
sendmailexecutable file is differ from the default value ofsendmailparameter,/usr/sbin/sendmail, define it insympa.conf. For example:sendmail /usr/local/sbin/sendmail - Create
list_aliases.tt2file in$SYSCONFDIRdirectory 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.confto add following lines (Note: replace$SYSCONFDIRbelow):sendmail_aliases $SYSCONFDIR/sympa_transport aliases_program postmap aliases_db_type hashBy these settings,
sympa_transportfile will be updated automatically when any lists are created, closed, restored or purged. - Create empty map files (Note:
replace
$SYSCONFDIRbelow):# touch $SYSCONFDIR/transport.sympa # touch $SYSCONFDIR/virtual.sympa # touch $SYSCONFDIR/sympa_transport # chmod 644 $SYSCONFDIR/sympa_transport # chown sympa:sympa $SYSCONFDIR/sympa_transportand create databases (Note: replace
$SYSCONFDIR):# postmap hash:$SYSCONFDIR/transport.sympa # postmap hash:$SYSCONFDIR/virtual.sympa # sympa_newaliases.plNote
- With steps above,
sympa_transportfile 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:# chmod 640 $SYSCONFDIR/sympa_transport $SYSCONFDIR/sympa_transport.db # chgrp postfix $SYSCONFDIR/sympa_transport $SYSCONFDIR/sympa_transport.dbwhere
postfixis the group the service processes of Postfix belong to.
- With steps above,
- Edit Postfix
master.cffile to add transport definitions (Note: replace$LIBEXECDIRbelow):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:
flagsattribute has to containR.Fis unnecessary.null_senderattribute with empty value is required for Postfix 2.3 or later.
- Edit Postfix
main.cffile to add configuration for virtual domains (Note: replace$SYSCONFDIRbelow):# 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
mydestinationparameter inmain.cffile 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,$EXPLDIRandmail.example.orgbelow):# 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.conffile above. -
If Sympa services have already been running, reload them (see “Reloading Sympa services”).
-
Add following contents to
transport.sympaandvirtual.sympafiles and edit them as you prefer (Note: replacemail.example.orgbelow).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.orgvirtual.sympa:sympa-request@mail.example.org postmaster@localhost sympa-owner@mail.example.org postmaster@localhostNote
- If you want some addresses of
mail.example.orgto 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
$SYSCONFDIRbelow):# 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.confto 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.postfixfile in$SYSCONFDIRand edit it as you prefer (Note: replace$LIBEXECDIRandmail.example.orgbelow):# Robot 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-ownerIf
$SENDMAIL_ALIASESfile does not exist, create it (Note: replace$SENDMAIL_ALIASESbelow):# touch $SENDMAIL_ALIASES # chmod 640 $SENDMAIL_ALIASES # chown sympa:sympa $SENDMAIL_ALIASESand create alias databases (Note: replace
$SYSCONFDIR):# postalias hash:$SYSCONFDIR/aliases.sympa.postfix # sympa_newaliases.pl - Edit Postfix main.cf file (Note:
replace
$SYSCONFDIR,$SENDMAIL_ALIASESandmail.example.orgbelow):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.