Skip to content

Latest commit

 

History

History
184 lines (153 loc) · 7.03 KB

configure-mail-server-opensmtpd.md

File metadata and controls

184 lines (153 loc) · 7.03 KB
title prev up next
Configure mail server: OpenSMTPD
configure-system-log.md
configure-mail-server.md
configure-mail-server.md#tests

Configure mail server: OpenSMTPD

Requirements

Sympa configuration parameters

  • aliases_program

    This parameter must be set to full path to makemap(1) utility bundled in OpenSMTPD:

    aliases_program /path/to/makemap
    

    Note that setting a keyword makemap will not work.

  • sendmail and sendmail_args

    • If you are planning to use message tracking feature, add these lines:

      sendmail /path/to/sympa_smtpc
      sendmail_args --esmtp localhost
      

      Note that smtpd daemon must listen on localhost.

    • Otherwise, add this line:

      sendmail /path/to/sendmail
      

      If the full path to sendmail(1) utility bundled in OpenSMTPD is the same as default of Sympa, /usr/sbin/sendmail, the line above may not be added.

Setup

Initial setting

Steps in this section may be done once at the first time.

  1. Edit sympa.conf to add parameters described in the section above, for example:

    aliases_program /path/to/makemap
    sendmail /path/to/sendmail
    

    Then create list_aliases.tt2 file in $SYSCONFDIR directory with following content, and edit it as you prefer (Note: replace $LIBEXECDIR below):

    #--- [% list.name %]@[% list.domain %]: list virtual table created at [% date %]
    [% list.name %]@[% list.domain %]               "| $LIBEXECDIR/queue [% list.name %]@[% list.domain %]"
    [% list.name %]-request@[% list.domain %]       "| $LIBEXECDIR/queue [% list.name %]-request@[% list.domain %]"
    [% list.name %]-editor@[% list.domain %]        "| $LIBEXECDIR/queue [% list.name %]-editor@[% list.domain %]"
    #[% list.name %]-subscribe@[% list.domain %]    "| $LIBEXECDIR/queue [% list.name %]-subscribe@[%list.domain %]"
    [% list.name %]-unsubscribe@[% list.domain %]   "| $LIBEXECDIR/queue [% list.name %]-unsubscribe@[% list.domain %]"
    [% list.name %][% return_path_suffix %]@[% list.domain %] "| $LIBEXECDIR/bouncequeue [% list.name %]@[% list.domain %]"
    

    By these settings, $SENDMAIL_ALIASES file will be updated automatically when any lists are created, closed, restored or purged.

  2. Create empty virtual tables (Note: replace $SYSCONFDIR and $SENDMAIL_ALIASES below):

    # touch $SYSCONFDIR/sympa_domain_aliases
    # chmod 644 $SYSCONFDIR/sympa_domain_aliases
    # touch $SENDMAIL_ALIASES
    # chmod 640 $SENDMAIL_ALIASES
    # chown sympa:smtpd $SENDMAIL_ALIASES

    and create databases (Note: replace $SYSCONFDIR below):

    # makemap $SYSCONFDIR/sympa_domain_aliases
    # sympa_newaliases.pl

    Note that table files must be readable by smtpd (at least by smtpd group).

  3. Edit OpenSMTPD smtpd.conf file to add configuration for virtual domains (Note: replace $SYSCONFDIR and $SENDMAIL_ALIASES below):

    table sympa db:$SYSCONFIDR/sympa_domain_aliases.db
    accept from any for any recipient <sympa> virtual <sympa>
    
    table lists db:$SENDMAIL_ALIASES.db
    accept from any for any recipient <lists> virtual <lists>
    
    #
    # Here may be the rules for addresses excluded from mailing list service.
    #
    
    table sympa_domains { "mail.example.org" }
    reject from any for domain <sympa_domains>
    

    Note: In the configuration above, brackets < ... > and their contents are not examples: They have to be typed as shown.

Adding new domain

Steps in this section have to be done every time the new domain is added.

  1. Create directories for virtual domain configurations (Note: replace $SYSCONFDIR, $EXPLDIR and mail.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
  2. If you want to override global settings in sympa.conf (such as lang) by each domain, you can add it to robot.conf above.

  3. If Sympa services have already been running, reload them (see "Reloading Sympa services").

  4. Edit smtpd.conf file to add the new domain to sympa_domains table:

    ...
    table sympa_domains { ...existing domains..., "mail.example.org" }
    ...
    
  5. Add following content to sympa_domain_aliases file and edit them as you prefer (Note: replace $LIBEXECDIR and mail.example.org below):

    Then, update database for virtual table (Note: replace $SYSCONFDIR below):

    # makemap $SYSCONFDIR/sympa_domain_aliases
  6. Reload OpenSMTPD. Then test configuration according to instruction.