Bug 216687 - Postfix - a standard, FHS-compliant place for virtual user mailboxes
Postfix - a standard, FHS-compliant place for virtual user mailboxes
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: Deployment_Guide (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Miroslav Svoboda
: Documentation
Depends On:
Blocks: 184309
  Show dependency treegraph
Reported: 2006-11-21 10:43 EST by Răzvan Sandu
Modified: 2015-10-05 22:12 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 734176 (view as bug list)
Last Closed: 2013-01-08 12:35:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Răzvan Sandu 2006-11-21 10:43:09 EST
Description of problem:


IMHO, the postfix documentation should provide a standard, FHS-compliant place
on the filesystem to put the virtual user mailboxes (mbox *or* Maildir). Please
see http://www.postfix.org/VIRTUAL_README.html#virtual_mailbox: I mean the value
for the virtual_mailbox_base parameter (and subdirectories for it).

This should be default option in the main.cf file provided in distro.

The FHS standard v2.3, paragraph 5.11 states that /var/mail is the default
place, but explicitly says that "user mailboxes files in this location must be
stored in the standard UNIX mailbox format". IMHO, it is unclear if this
excludes only proprietary mailbox formats or Maildir as well. 

Given the fact that the distro is now SELinux-enabled by default and dovecot is
the default IMAP server, the proposed directory should meet other requirements too:

- dovecot (or other imap servers) must be able to pick-up messages from there
(permissions related matters);
- it should not matter if the virtual mailboxes share the same UID/GID for all
users or if these are different;
- documentation should explictly say which preconfigured system user/group will
own the virtual mailboxes, in case it's a common one;
- spamassassin, amavisd-new, pyzor, clamav and other programs that eventually
need to access that directory should be able to do it;
- the configuration should work when SELinux is in enforcing mode, with an
unmodified (default) SELinux policy.


Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Actual results:
Postfix documentation only sugest a place for virtual user mailboxes. In a
SELinux-enabled environment, there are often interoperability problems between
the various components involved in an e-mail system, requiring various
permissions hacks or disabling SELinux.

Expected results:
A FHS-compliant place for those mailboxes should be provided and suggested both
in documentation and in Postfix's default main.cf. Postfix documentation should
agree on this with POP3 server's documentation. SELinux default policy should
take into account the proposed usage for this directory, allowing the various
programs to acces it apropriately.

A preconfigured system user/group should exist as a common owner for the virtual
mailboxes, if administrator wants to use a common one. The docs should
explicitly indicate this preconfigured system user in an RH-compliant distro.

Additional info:
Comment 1 Karsten Wade 2006-11-21 11:25:44 EST
Reassigning to the postfix maintainer in the Fedora Core component.  Postfix
documentation comes from upstream with the rest of the source, so it is not
anything Fedora Documentation has control over.

I don't know anything about the technical feasibility of this proposal, but I do
know that a patch accompanying the suggestion should help acceptance from the
Postfix team.
Comment 2 Karsten Wade 2006-12-28 10:47:38 EST
Seems that reassigning to the component didn't reassign to that component owner;
fixed by assigning to twoerner@redhat.com.
Comment 3 Răzvan Sandu 2007-07-12 14:24:45 EDT

Are there any news about this ?


Comment 8 Jaroslav Škarvada 2011-08-29 11:52:10 EDT
Changing severity to 'medium', because this issue doesn't full-fill the 'high' definition, that is defined as:
> Problem due to crashes, loss of data, severe memory, leak, etc.

Cloning to RHEL-6.
Comment 9 Jaroslav Škarvada 2011-08-29 11:56:14 EDT
RHEL-6 clone: Bug 734176
Comment 11 RHEL Product and Program Management 2011-12-05 15:37:28 EST
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.
Comment 12 Jaroslav Škarvada 2012-06-28 10:59:09 EDT
For postfix any directory under /var/mail works even with selinux in enforcing mode. Also there are more complex configurations possible - e.g. mapping of virtual users to more than one system user (in this case the preset user wouldn't help).

I would like to follow upstream and I wouldn't like to enforce anything in default configuration (especially during the RHEL-5 lifecycle). Probably better to only provide example configuration in RH documentation, e.g. for postfix:

General config:
# groupadd -g 5000 vmail
# useradd -u 5000 -g vmail -M vmail
# mkdir -p /var/mail/virtual/example.com
# chown -R vmail:vmail /var/mail/virtual

Postfix config:
# postconf -e virtual_mailbox_domains=example.com
# postconf -e virtual_mailbox_base=/var/spool/mail/virtual
# postconf -e virtual_mailbox_maps=hash:/etc/postfix/virtual_mailbox
# postconf -e virtual_minimum_uid=100
# postconf -e virtual_uid_maps=static:5000
# postconf -e virtual_gid_maps=static:5000
# postconf -e virtual_alias_maps=hash:/etc/postfix/virtual
# echo 'postmaster@example.com postmaster' > /etc/postfix/virtual
# postmap hash:/etc/postfix/virtual

Addition of users user1, user2:
# echo 'user1@example.com  example.com/user1' > /etc/postfix/virtual_mailbox
# echo 'user2@example.com  example.com/user2' >> /etc/postfix/virtual_mailbox
# postmap hash:/etc/postfix/virtual_mailbox

# service postfix reload

For dovecot compatible example should be added.
Comment 13 Jaroslav Škarvada 2012-08-20 11:38:50 EDT
According to review of current RHEL-5 deployment guide I would prefer documenting in Knowledge base.
Comment 14 Jaroslav Škarvada 2012-08-27 04:53:11 EDT
Adding SMTP SASL config example (using Dovecot SASL) to have complete example.

SMTP SASL config:
# postconf -e smtpd_sasl_type=dovecot
# postconf -e smtpd_sasl_path=private/auth
# postconf -e smtpd_sasl_auth_enable=yes
# postconf -e broken_sasl_auth_clients=yes  # Enable broken clients
# postconf -e smtpd_sasl_security_options=noanonymous  # Disable anonymous
# postcond -e smtpd_recipient_restrictions="permit_mynetworks, reject_sender_login_mismatch, permit_sasl_authenticated, reject_unauth_destination"  # Enable relay for SASL authenticated

TLS config (optional):
# postconf -e smtpd_tls_security_level=may
# postcond -e smtpd_tls_key_file=/etc/pki/tls/private/mail.example.com.key
# postconf -e smtpd_tls_cert_file=/etc/pki/tls/certs/mail.example.com.crt
# postconf -e smtpd_tls_CAfile=/etc/pki/tls/certs/ca-bundle.crt

# postconf -e smtpd_tls_auth_only=yes  # Enable SASL only over TLS (more secure)
Comment 15 Jaroslav Škarvada 2012-08-27 05:00:53 EDT
(In reply to comment #14)
Comment 17 Michal Hlavinka 2012-08-27 10:02:41 EDT
Dovecot's simple configuration for virtual users:

# environment
mkdir /home/virtual
chown vmail:vmail /home/virtual

# in /etc/dovecot.conf, set:

mail_location = mbox:~/mail:INBOX=/var/mail/virtual/%d/%n
auth_realms = "example.com"
auth_default_realm = "example.com"

# and change whole auth default { ... } section to:
auth default {
  mechanisms = plain login
  passdb passwd-file {
    args = /etc/dovecot.passdb
  userdb static {
   args = uid=vmail gid=vmail home=/home/virtual/%d/%n
  user = root
  socket listen {
    client {
      path = /var/spool/postfix/private/auth
      mode = 0660
      user = postfix
      group = postfix

# create user database
touch /etc/dovecot.passdb
chmod 0600 /etc/dovecot.passdb

# Addition of users user1, user2:
USR=user1@example.com; echo "${USR}:$(dovecotpw -u $USR )" >>/etc/dovecot.passdb

USR=user2@example.com; echo "${USR}:$(dovecotpw -u $USR )" >>/etc/dovecot.passdb

# restart dovecot
service dovecot restart
Comment 18 Miroslav Svoboda 2012-10-03 11:23:46 EDT
As requested, a Knowledgebase page, on how to configure a system to manage multiple virtual mailboxes using Postfix and Dovecot, has been created.

Page location: https://access.redhat.com/knowledge/articles/209683
Comment 19 Jaromir Hradilek 2013-01-08 12:35:04 EST
Since this is no longer about the Deployment Guide, I am closing this bug as WONTFIX.

Note You need to log in before you can comment on or make changes to this bug.