DragonFly BSD

mta

Switching Mail Transfer Agents

Every release of DragonFly BSD up to and including Release 4.0 came with Sendmail configured as the Mail Transfer Agent (MTA). Since Release 1.12, the DragonFly Mail Agent (DMA) has been available in base, but manual configuration has been required to activate it. On 15 March 2015, the default MTA has been switched to DMA in preparation of removing Sendmail version 8.14.5 from the base system.

The DragonFly Mail Agent is a minimalist MTA that handles emails competently for many of DragonFly’s use cases. It accepts mails from locally installed Mail User Agents (MUA) and delivers the mails either locally or to a remote destination using TLS/SSL and SMTP authentication. However, DMA is not intended as a replacement for real, big MTAs like sendmail(8) or postfix(1). Consequently, DMA does not listen on port 25 for incoming connections, and thus may be inadequate when advanced mail functionality is needed. Note that DMA does not yet support vacation/.forward functionality, so another MTA will have to be installed if this feature is mandatory. These instructions explain how to do this.

The system administrator can change the system’s MTA using the following instructions, which assume Sendmail is no longer in base. Several alternative MTAs are available from the mail category of DPorts. Those administering systems from Release 4.0 and earlier seeking to reconfigure MTA back to base Sendmail are not covered, but it should be fairly straightforward to adapt DPorts Sendmail instructions for that case.

Once a new MTA is installed either through source builds or binary packages, it should be fully configured before switching away from DMA. A basic checklist is given here, but the administrator needs to refer to dedicated documentation to configure the new MTA.

Stop any active daemons

This step can be skipped on default installations where the DragonFly Mail Agent is the active MTA. For others, the MTA probably has an active daemon running, so turn it off. Examples on how to do that are shown:

> /etc/rc.d/sendmail stop
> /usr/local/etc/rc.d/postfix stop
> /usr/local/etc/rc.d/smtpd stop

There are equivalent alternatives to stopping these daemons as well.

Disable the current MTA

This step can be skipped on default installations where the DragonFly Mail Agent is the active MTA. For others, the current MTA daemon needs to be prevented from starting on reboot in the case it is not removed from the system.

Example: When Sendmail is the current MTA (base or DPorts) it can be completely disabled by adding or editing the following lines in /etc/rc.conf:

sendmail_enable="NONE"

Example: When Postfix is the current MTA it can be completely disabled by adding or editing the following lines in /etc/rc.conf:

postfix_enable="NO"

Example: When OpenSMPTd is the current MTA it can be completely disabled by adding or editing the following lines in /etc/rc.conf:

smptd_enable="NO"

Configure DragonFly to use the DragonFly Mail Agent

This section explains how to configure DragonFly to use dma from base, so it should be skipped if another MTA is desired.

Update mail wrapper

Unless DPorts are not installed in the standard location of /usr/local, the following command will update the mail wrapper:

> cp /etc/mail/mailer.conf.dma /etc/mail/mailer.conf

The contents of /etc/mail/mailer.conf.dma are:

# mail wrapper set for DragonFly Mail Agent

sendmail    /usr/libexec/dma
mailq       /usr/libexec/dma
newaliases  /usr/libexec/dma
hoststat    /usr/libexec/dma
purgestat   /usr/libexec/dma

Update periodic reports configuration

Edit or add /etc/periodic.conf with the following lines:

daily_clean_hoststat_enable="NO"
daily_submit_queuerun="NO"

Configure DragonFly Mail Agent

Check, update or install the following configuration files (optional):

/etc/dma/dma.conf
/etc/dma/auth.conf

Configure daemon

Not Applicable

Configure DragonFly to use DPorts Sendmail MTA

This section explains how to configure DragonFly to use the Sendmail from DPorts, so it should be skipped if another MTA is desired. It is assumed that the DPorts version of Sendmail has just been installed.

Caveat: For some reason, the sendmail package is named sendmail+tls+sasl2 and not just sendmail . However, using the command "pkg ins mail/sendmail" still works, although referencing by port origin may stop working in future versions of pkg.

Update mail wrapper

Unless DPorts are not installed in the standard location of /usr/local, the following command will update the mail wrapper:

> cp /etc/mail/mailer.conf.sendmail /etc/mail/mailer.conf

The contents of /etc/mail/mailer.conf.sendmail are:

# mail wrapper set for DPorts Sendmail

sendmail    /usr/local/sbin/sendmail
mailq       /usr/local/bin/mailq
newaliases  /usr/local/bin/newaliases
hoststat    /usr/local/bin/hoststat
purgestat   /usr/local/bin/purgestat

Update periodic reports configuration

Edit or add /etc/periodic.conf with the following lines:

daily_clean_hoststat_enable="YES"
daily_submit_queuerun="YES"

Configure Sendmail

Check, update or install the following configuration files for sendmail:

/etc/mail/access.db
/etc/mail/aliases.db
/etc/mail/sendmail.cf
/etc/mail/submit.cf
/etc/mail/virtusertable.db
/etc/mail/relay-domains

This is the suggested way to do this (install Sendmail from DPorts first):

01. cd /etc/mail
02. make cf
03. edit new <hostname>.mc and <hostname>.submit.mc (optional)
04. make cf
05. make install
06. cp access.sample access (then edit)
07. cp virtusertable.sample virtusertable (then edit)
08. (optional) add mailertable, domaintable, bitdomain, uucpdomain, genericstable files
09. make maps
10. edit or create aliases
11. make aliases
12. (option) add relay-domain file

Configure daemon

Update or edit the following lines in /etc/rc.conf

sendmail_enable="YES"
sendmail_submit_enable="YES"
sendmail_outbound_enable="YES"
sendmail_msp_queue_enable="YES"

Configure DragonFly to use DPorts Postfix MTA

This section explains how to configure DragonFly to use one of the Postfix ports from DPorts, so it should be skipped if another MTA is desired. It is assumed that Postfix has just been installed.

Update mail wrapper

Unless DPorts are not installed in the standard location of /usr/local, the following command will update the mail wrapper:

> cp /etc/mail/mailer.conf.postfix /etc/mail/mailer.conf

The contents of /etc/mail/mailer.conf.postfix are:

# mail wrapper set for DPorts Postfix

sendmail    /usr/local/sbin/sendmail
mailq       /usr/local/bin/mailq
newaliases  /usr/local/bin/newaliases
hoststat    /usr/bin/true
purgestat   /usr/bin/true

Update periodic reports configuration

Edit or add /etc/periodic.conf with the following lines:

daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"

Configure Postfix

Check, update or install the following configuration files for Postfix (assuming the default ports installation location of /usr/local):

/usr/local/libexec/postfix/main.cf
/usr/local/libexec/postfix/master.cf

Configure daemon

Update or edit the following lines in /etc/rc.conf

postfix_enable="YES"

Configure DragonFly to use DPorts OpenSMTPD MTA

This section explains how to configure DragonFly to use OpenBSD’s OpenSMTPD from DPorts, so it should be skipped if another MTA is desired. It is assumed that the DPorts version of OpenSMTD has just been installed.

Update mail wrapper

Unless DPorts are not installed in the standard location of /usr/local, the following command will update the mail wrapper:

> cp /etc/mail/mailer.conf.opensmtpd /etc/mail/mailer.conf

The contents of /etc/mail/mailer.conf.opensmtpd are:

# mail wrapper set for DPorts OpenSMTPD

sendmail    /usr/local/sbin/smtpctl
mailq       /usr/local/sbin/smtpctl
newaliases  /usr/local/sbin/smtpctl
hoststat    /usr/bin/true
purgestat   /usr/bin/true

Update periodic reports configuration

Edit or add /etc/periodic.conf with the following lines:

daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"

Configure OpenSMTPD

Check, update or install the following configuration files for OpenSMTPD (assuming the default ports installation location of /usr/local):

/usr/local/etc/mail/smtpd.conf
/etc/mail/mailname
/etc/mail/aliases  (makemap)
/etc/mail/secrets  (makemap)

Configure daemon

Update or edit the following lines in /etc/rc.conf

smtpd_enable="YES"

Activating new MTA

Once everything is configured, it is recommended to reboot the system. Rebooting provides the opportunity to ensure that the system is correctly configured to start the new MTA automatically on boot.