Bug 216687

Summary: Postfix - a standard, FHS-compliant place for virtual user mailboxes
Product: Red Hat Enterprise Linux 5 Reporter: Răzvan Sandu <rsandu2004>
Component: doc-Deployment_GuideAssignee: Miroslav Svoboda <msvoboda>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.4CC: dwalsh, jhradile, jrb, jskarvad, mhlavink, mprpic, prockai, syeghiay, tommy.reynolds, twoerner, wtogami
Target Milestone: ---Keywords: Documentation
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://www.postfix.org/VIRTUAL_README.html#virtual_mailbox
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 734176 (view as bug list) Environment:
Last Closed: 2013-01-08 17:35:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 184309    

Description Răzvan Sandu 2006-11-21 15:43:09 UTC
Description of problem:

Hello,

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.


Regards,
Razvan   


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


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
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 16:25:44 UTC
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 15:47:38 UTC
Seems that reassigning to the component didn't reassign to that component owner;
fixed by assigning to twoerner.

Comment 3 Răzvan Sandu 2007-07-12 18:24:45 UTC
Hello,

Are there any news about this ?

Răzvan



Comment 8 Jaroslav Škarvada 2011-08-29 15:52:10 UTC
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 15:56:14 UTC
RHEL-6 clone: Bug 734176

Comment 11 RHEL Program Management 2011-12-05 20:37:28 UTC
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 14:59:09 UTC
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 postmaster' > /etc/postfix/virtual
# postmap hash:/etc/postfix/virtual

Addition of users user1, user2:
# echo 'user1  example.com/user1' > /etc/postfix/virtual_mailbox
# echo 'user2  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 15:38:50 UTC
According to review of current RHEL-5 deployment guide I would prefer documenting in Knowledge base.

Comment 14 Jaroslav Škarvada 2012-08-27 08:53:11 UTC
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 09:00:53 UTC
(In reply to comment #14)
s/postcond/postconf/

Comment 17 Michal Hlavinka 2012-08-27 14:02:41 UTC
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; echo "${USR}:$(dovecotpw -u $USR )" >>/etc/dovecot.passdb

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

# restart dovecot
service dovecot restart

Comment 18 Miroslav Svoboda 2012-10-03 15:23:46 UTC
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 17:35:04 UTC
Since this is no longer about the Deployment Guide, I am closing this bug as WONTFIX.