Bug 840706

Summary: procmail denied access to Maildir folders
Product: [Fedora] Fedora Reporter: Alan Hamilton <alanh>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-21 22:52:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alan Hamilton 2012-07-17 02:39:36 UTC
Description of problem:
procmail is unable to write to /home/user/Maildir folders as it does not have write access to the mail_home_rw_t context.

How reproducible:
Run mail through procmail and have it deliver to a Maildir folder in a user's home directory.

Steps to Reproduce:
1. Create .procmairc with MAILDIR=$HOME/Maildir
2. Send mail to user.
  
Actual results:
Mail is not delivered. procmail's log shows:
procmail: Error while writing to "/home/alanh/Maildir/tmp/1342487394.10921_0.starfall.dynip.com"
procmail: Couldn't create or rename temp file "/home/alanh/Maildir/tmp/1342487394.10921_0.starfall.dynip.com"

And the system log shows (among many others):
Jul 16 18:32:25 starfall kernel: [124408.763381] type=1400 audit(1342488745.221:48): avc:  denied  { write } for  pid=11084 comm="procmail" name="tmp" dev="dm-3" ino=262146 scontext=system_u:system_r:procmail_t:s0 tcontext=unconfined_u:object_r:mail_home_rw_t:s0 tclass=dir

Expected results:
Mail delivered to Maildir folder.

Additional info:
Running in permissive mode and then running audit2allow shows:

#============= procmail_t ==============
#!!!! The source type 'procmail_t' can write to a 'dir' of the following types:
# data_home_t, var_log_t, user_home_dir_t, mail_spool_t, tmp_t, user_home_t

allow procmail_t mail_home_rw_t:dir { write remove_name add_name };
#!!!! The source type 'procmail_t' can write to a 'file' of the following types:
# data_home_t, procmail_tmp_t, mail_spool_t, user_home_t

allow procmail_t mail_home_rw_t:file { write open create unlink link };

This may be related to bug 830611 which caused the same issue with dovecot.

Comment 1 Alan Hamilton 2012-07-17 02:42:13 UTC
Also noting that running audit2allow -R shows

#============= procmail_t ==============
mta_manage_home_rw(procmail_t)

Comment 2 Miroslav Grepl 2012-07-17 07:05:28 UTC
Fixed in selinux-policy-3.10.0-140.fc17

Comment 3 Fedora Update System 2012-07-18 13:05:55 UTC
selinux-policy-3.10.0-140.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-140.fc17

Comment 4 Fedora Update System 2012-07-19 09:12:44 UTC
Package selinux-policy-3.10.0-140.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.10.0-140.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-10840/selinux-policy-3.10.0-140.fc17
then log in and leave karma (feedback).

Comment 5 Alan Hamilton 2012-07-19 23:54:32 UTC
The test release fixed the issue. Thanks!

Comment 6 Fedora Update System 2012-07-21 22:52:53 UTC
selinux-policy-3.10.0-140.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.