Bug 808624

Summary: dovecot lmtp exec access denied to sendmail.postfix
Product: Red Hat Enterprise Linux 6 Reporter: info <info>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: dwalsh, mmalik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.7.19-144.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 12:32:50 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:

Description info@kobaltwit.be 2012-03-30 21:41:18 UTC
Description of problem:
I have configured dovecot lmtp as virtual delivery agent on my postfix based mailserver. Dovecot additionally has sieve (via dovecot-pigeonhole) enabled and I'm using a sieve script to setup a vacation message using the sieve vacation plugin.

Whenever a message arrives for the account with an active vacation sieve script, the message is delivered, but the vacation auto reply is not. The core reason seems to be that dovecot lmtp doesn't have exec access on /usr/sbin/sendmail.postfix due to the current selinux policy.

Version-Release number of selected component (if applicable):
dovecot-2.0.9-2.el6_1.1.x86_64
dovecot-pigeonhole-2.0.9-2.el6_1.1.x86_64
postfix-2.6.6-2.2.el6_1.x86_64
selinux-policy-targeted-3.7.19-126.el6_2.10.noarch

How reproducible:
Always

Steps to Reproduce:
1. setup sieve for dovecot and setup a vacation sieve script for a user (I used the example script from http://wiki2.dovecot.org/Pigeonhole/Sieve/Examples)
2. send a mail to the user for which a vacation message is active
  
Actual results:
Vacation reply message isn't sent. This is found in the maillog (I filtered to the relevant dovecot messages only):
Mar 30 21:37:59 abmpub6 dovecot: lmtp(6626): Connect from local
Mar 30 21:37:59 abmpub6 dovecot: lmtp(6626, recipient): Fatal: execv(/usr/sbin/sendmail) failed: Permission denied
Mar 30 21:37:59 abmpub6 dovecot: lmtp(6626, recipient): Error: Sendmail process terminated abnormally, exit status 84
Mar 30 21:37:59 abmpub6 dovecot: lmtp(6626, recipient): Error: JBO/MowKdk/iGQAAZsTLbA: sieve: msgid=<20120330193759.7CA7758855A>: failed
 to send vacation response to <sender> (refer to server log for more information)

This is accompanied by the following selinux messages in audit.log:
type=AVC msg=audit(1333136279.642:112177): avc:  denied  { execute } for  pid=6653 comm="lmtp" name="sendmail.postfix" dev=xvda ino=7422495 scontext=unconfined_u:system_r:dovecot_t:s0 tcontext=system_u:object_r:sendmail_exec_t:s0 tclass=file
type=SYSCALL msg=audit(1333136279.642:112177): arch=c000003e syscall=59 success=no exit=-13 a0=ccd270 a1=ccd288 a2=0 a3=34ac017240 items=0 ppid=6626 pid=6653 auid=501 uid=0 gid=10001 euid=10001 suid=0 fsuid=10001 egid=10001 sgid=10001 fsgid=10001 tty=(none) ses=707 comm="lmtp" exe="/usr/libexec/dovecot/lmtp" subj=unconfined_u:system_r:dovecot_t:s0 key=(null)

Expected results:
The automatic vacation reply is sent successfully.

Comment 2 Miroslav Grepl 2012-04-02 12:27:03 UTC
We have 

optional_policy(`
    # Handle sieve scripts
    sendmail_domtrans(dovecot_deliver_t)
')

So we probably need it also for dovecot_t.

Comment 3 Miroslav Grepl 2012-04-02 16:38:57 UTC
Could you test it with the following local policy

# cat mydovecot.te
policy_module(mydovecot, 1.0)

require{
 type dovecot_t;
}

optional_policy(`
    # Handle sieve scripts
    sendmail_domtrans(dovecot_t)
')


and then execute

# make -f /usr/share/selinux/devel/Makefile mydovecot.pp
# semodule -i dovecot.pp

Comment 4 info@kobaltwit.be 2012-04-03 08:10:36 UTC
When I install that policy, the mail forwarding sieve script works fine. Thanks.

Comment 5 Miroslav Grepl 2012-04-03 09:40:14 UTC
Great, thank you.

Comment 9 info@kobaltwit.be 2012-05-04 09:30:38 UTC
I wonder, when the new policy package gets pushed to the update repos, should I remove my local policy myself again or will this be done during the update ?

Comment 10 Daniel Walsh 2012-05-04 11:00:54 UTC
You will need to remove it, although it would not matter, since we allow duplicate allows.

Comment 11 errata-xmlrpc 2012-06-20 12:32:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0780.html