Provision virtual mailboxes with Postfix and Dovecot
This commit is contained in:
1 parent
4bd7a90580
commit
0804182f17
5 files changed
+551
-2
No files matched your search
@@ -195,6 +195,83 @@ mail stack. See the [Dovecot guide to Postfix and LMTP](https://doc.dovecot.org/
|
||||
coulobre-mail-node inspect coulobre-mailbox-1.json
|
||||
```
|
||||
|
||||
### Apply a mailbox manifest
|
||||
|
||||
Use an Ubuntu 24.04 mail node with Postfix, Dovecot 2.3 and the `dovecot-imapd`
|
||||
and `dovecot-lmtpd` packages. Install Coulobre in a root-owned virtual
|
||||
environment on the node. Use a Postfix hostname outside the set of hosted
|
||||
mail domains and keep those domains in Postfix's virtual mailbox address
|
||||
class. See the [Postfix virtual domain guide](https://www.postfix.org/VIRTUAL_README.html).
|
||||
|
||||
On a fresh mail node, create the virtual mail user and empty lookup files.
|
||||
|
||||
```sh
|
||||
sudo adduser --system --group --no-create-home --home /srv/coulobre-mail \
|
||||
--shell /usr/sbin/nologin coulobre-vmail
|
||||
sudo install -m 0644 /dev/null /etc/postfix/coulobre-domains
|
||||
sudo install -m 0644 /dev/null /etc/postfix/coulobre-mailboxes
|
||||
sudo install -o root -g dovecot -m 0640 /dev/null /etc/dovecot/coulobre-users
|
||||
```
|
||||
|
||||
Use these values in Postfix's `main.cf`.
|
||||
|
||||
```ini
|
||||
virtual_mailbox_domains = proxy:texthash:/etc/postfix/coulobre-domains
|
||||
virtual_mailbox_maps = proxy:texthash:/etc/postfix/coulobre-mailboxes
|
||||
virtual_transport = lmtp:unix:private/dovecot-lmtp
|
||||
smtpd_reject_unlisted_recipient = yes
|
||||
```
|
||||
|
||||
Replace the stock `auth-system.conf.ext` include in Dovecot's `10-auth.conf`
|
||||
with the following virtual user configuration. Configure Dovecot's TLS
|
||||
certificate and keep encrypted client authentication enabled on a public
|
||||
mail node. See the [Dovecot passwd-file guide](https://doc.dovecot.org/2.3/configuration_manual/authentication/passwd_file/).
|
||||
|
||||
```text
|
||||
auth_username_format = %Lu
|
||||
auth_cache_size = 0
|
||||
passdb {
|
||||
driver = passwd-file
|
||||
args = /etc/dovecot/coulobre-users
|
||||
}
|
||||
userdb {
|
||||
driver = passwd-file
|
||||
args = /etc/dovecot/coulobre-users
|
||||
}
|
||||
```
|
||||
|
||||
Set the mailbox format and enable the LMTP socket for Postfix in Dovecot.
|
||||
Use the output of `id -u coulobre-vmail` for both UID settings in place of
|
||||
the example value `103`. This limits Dovecot mailbox access to the virtual
|
||||
mail user on this node. See the [Dovecot UID range settings](https://doc.dovecot.org/2.3/settings/core/#first-valid-uid).
|
||||
|
||||
```text
|
||||
protocols = imap lmtp
|
||||
mail_location = maildir:~/Maildir
|
||||
first_valid_uid = 103
|
||||
last_valid_uid = 103
|
||||
service lmtp {
|
||||
unix_listener /var/spool/postfix/private/dovecot-lmtp {
|
||||
user = postfix
|
||||
group = postfix
|
||||
mode = 0600
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Start Postfix and Dovecot with these settings and apply the manifest.
|
||||
|
||||
```sh
|
||||
sudo /opt/coulobre/bin/coulobre-mail-node apply coulobre-mailbox-1.json
|
||||
```
|
||||
|
||||
The command creates a private mailbox home under `/srv/coulobre-mail/`,
|
||||
generates the initial password, and prints the path to the root-only
|
||||
credentials file on the mail node. Dovecot authenticates the full mailbox
|
||||
address using a password hash. Postfix accepts listed recipients and
|
||||
hands delivery to Dovecot over the local LMTP socket. Reapply the same
|
||||
manifest to resume installation with the same credentials.
|
||||
|
||||
## Request an Apache configuration preview
|
||||
|
||||
Start RabbitMQ and set `COULOBRE_BROKER_URL` to its AMQP URL. The development
|
||||
|
||||
Reference in new issue
Block a user