Virtual mail domains and users in plain files

Table of Contents

Introduction
Configuration
Usage

Configuration

by ross at 11:08:21 on April 27, 2017

Exim

1. Install Exim (skip other pages there)

Add Exim's mailnull user to mail group:

# pw groupmod mail -m mailnull

2. Eximanager - Exim setup (this will obviously overwrite existing configuration):

# cd /usr/local/etc/exim
# cp configure.sample configure
# fetch http://daemon-notes.com/downloads/assets/patches/virtual.patch
# patch configure virtual.patch

Edit configure, find and set these two parameters:

primary_hostname = mx.example.com
qualify_domain = example.com

Make Exim rewrite [email protected] (change to your local hostname) or [email protected] as [email protected] (add after begin rewrite line):

# Envelope "From" field, "From:" header 
*@coffin.lan [email protected] Ff
*@localhost [email protected] Ff

# Envelop "To" field, "To:" header
*@coffin.lan [email protected] Tt
*@localhost [email protected] Tt

3. Setup SSL (optional)

4. Activate smarthost relay (if your provider has one)

5. Install and enable SpamAssassin (optional, skip .forward creation if you do)

Dovecot

1. Install and configure Dovecot:

  • Enable SSL (optional)
  • Enable Maildir accounts.

2. Eximanager - Dovecot setup:

Modify conf.d/10-mail.conf:

first_valid_uid = 26
first_valid_gid = 6

Modify conf.d/10-auth.conf — uncomment the following line (near the end of file):

!include auth-passwdfile.conf.ext

Edit conf.d/auth-passwdfile.conf.ext:

  passdb passwd-file {
    args = scheme=CRYPT username_format=%n /etc/mail/virtual/%d/master.passwd
  }
  userdb passwd-file {
    args = username_format=%n /etc/mail/virtual/%d/passwd
  }

Done

# service exim restart
# service dovecot restart

 

Comments