mail-server (mail/mail-server) Updated: 6 months, 1 week ago Add to my watchlist

Mail server configuration

Mail server working configuration that provides a basic, working, easily modifiable mail server. The configuration is built using postfix for the MTA, dovecot for the MDA, solr for fast search, rspamd for a milter, and clamav for email virus scans. The configuration includes a surrogate TLS certificate, DKIM, and Apple Push Notification Service (APNS) capability for iOS devices.

Version: 1.4 License: GPL-3 GitHub
Maintainers essandess
Categories net mail
Homepage https://www.postfix.org/
Platforms darwin
Variants
  • initialize_always (Always initialize all configuration files. Intended for development and troubleshooting only. Working deployments must disable this variant to prevent configuration files being overwritten at the next upgrade. Existing configuration files are not overwritten by default.)
  • logrotate (Use mail-server logrotate configuration.)

"mail-server" depends on

lib (12)
run (1)
build (1)

Ports that depend on "mail-server"



Port notes

A mail server is a complex, interdependent set of tools that must all be configured correctly to provide secure, reliable email.

Users must reconfigure this installation for their own system, network, and security model specifics by editing all necessary files and checking file permissions. A subset of these settings are visible in the files:

port contents mail-server
port file mail-server

Full deployment also requires a working DNS configuration on both the LAN and the internet, including SPF and DKIM records, trusted TLS certificates, port forwarding, possibly a mail replay, and more.

Postfix and dovecot must be installed with these variants:
sudo port -pN install postfix +dovecot_sasl+pcre+smtputf8+tls
sudo port -pN install dovecot +solr [+apns]

These are the locations and network settings for the default configuration:

MTA (postfix):
${prefix}/etc/postfix/main.cf
${prefix}/etc/postfix/master.cf
ports: smtp/tcp (25), submission/tcp (587)

MDA (dovecot):
${prefix}/etc/dovecot/dovecot.conf
${prefix}/etc/dovecot/conf.d/*
port: imaps/tcp (993)

FTS (solr):
http://localhost:8983/

Milter (rspamd):
${prefix}/etc/rspamd/rspamd.conf
${prefix}/etc/rspamd/local.d/*

A default Rspamd controller password and its hash appear in the files:
${prefix}/etc/dovecot/sieve/train-spam.sh
${prefix}/etc/dovecot/sieve/train-ham.sh
${prefix}/etc/rspamd/local.d/worker-controller.inc

Rspamd controller:
http://localhost:11334/

Spam/Ham training (default behavior):
Move/Copy email to the folders Spam_train or Notspam_train.

The configuration also includes a surrogate TLS certificate and DKIM settings that must be changed before deployment.

TLS:
${prefix}/etc/certificates

DKIM:
${prefix}/var/lib/rspamd/dkim

The ports dns-server provide necessary DNS service on the LAN; variant +logrotate provides log rotation capabilities:

sudo port install dns-server
sudo port install mail-server +logrotate

This port assume indepedent installation and management of DNS and log rotation; mail-server includes example logrotate configuration files and a logroate launchdaemon.

The port's launch daemon controls launching for each of the dependendent services. These may be controlled independently, e.g.

sudo port load clamav-server
sudo port load apache-solr8
sudo port load redis
sudo port load dcc
sudo port load postfix
sudo port load dovecot
sudo port load rspamd

and if installed independently,

sudo port load dns-server
sudo port load logrotate

TLS certificate updates must be included in mail-server dovecot's conf.d/10-ssl.conf, postfix's master.cf, and, if installed, calendar-contacts-server's proxy nginx.conf. Instructions are included as comments in:

sudo vi ${prefix}/etc/dovecot/conf.d/10-ssl.conf
sudo vi ${prefix}/etc/postfix/main.cf
sudo vi \
${prefix}/var/calendarserver/Library/CalendarServer/etc/nginx.conf

References:
* http://www.postfix.org/documentation.html
* https://wiki.dovecot.org/
* https://www.rspamd.com/doc/index.html
* https://www.c0ffee.net/blog/mail-server-guide/
* _The Book of Postfix_, by Patrick Koetter and Ralf Hildebrandt

Known issues:
* The Postfix service does not reliably start after reboot, presumably due to an issue with launchd. A workaround after rebooting is to issue the commands:

sudo port unload postfix ; sleep 5 ; sudo port load postfix A startup item has been generated that will aid in starting mail-server with launchd. It is disabled by default. Execute the following command to start it, and to cause it to launch at startup:

sudo port load mail-server


Port Health:

Loading Port Health

Installations (30 days)

1

Requested Installations (30 days)

1