Bug 769718 - SELinux is preventing /usr/libexec/postfix/smtp from read, write access on the files in directory /var/spool/postfix/deferred.
Summary: SELinux is preventing /usr/libexec/postfix/smtp from read, write access on th...
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 16
Hardware: i686
OS: Unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
Whiteboard: abrt_hash:5a0ab9c83f7c67f320dfb7ecae9...
Depends On:
TreeView+ depends on / blocked
Reported: 2011-12-21 21:20 UTC by John Griffiths
Modified: 2012-01-31 22:02 UTC (History)
3 users (show)

Fixed In Version: selinux-policy-3.10.0-74.fc16
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-01-31 22:02:54 UTC

Attachments (Terms of Use)

Description John Griffiths 2011-12-21 21:20:23 UTC
libreport version: 2.0.8
executable:     /usr/bin/python
hashmarkername: setroubleshoot
kernel:         3.1.5-6.fc16.i686.PAE
reason:         SELinux is preventing /usr/libexec/postfix/smtp from read, write access on the file /var/spool/postfix/deferred/5/530EB3C03EE.
time:           Wed 21 Dec 2011 04:18:53 PM EST

:SELinux is preventing /usr/libexec/postfix/smtp from read, write access on the file /var/spool/postfix/deferred/5/530EB3C03EE.
:*****  Plugin catchall (100. confidence) suggests  ***************************
:If you believe that smtp should be allowed read write access on the 530EB3C03EE file by default.
:Then you should report this as a bug.
:You can generate a local policy module to allow this access.
:allow this access for now by executing:
:# grep smtp /var/log/audit/audit.log | audit2allow -M mypol
:# semodule -i mypol.pp
:Additional Information:
:Source Context                system_u:system_r:postfix_smtp_t:s0
:Target Context                system_u:object_r:postfix_spool_maildrop_t:s0
:Target Objects                /var/spool/postfix/deferred/5/530EB3C03EE [ file ]
:Source                        smtp
:Source Path                   /usr/libexec/postfix/smtp
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           postfix-2.8.7-1.fc16
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-64.fc16
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux daniel.internal.grifent.com
:                              3.1.5-6.fc16.i686.PAE #1 SMP Thu Dec 15 16:19:31
:                              UTC 2011 i686 i686
:Alert Count                   2
:First Seen                    Wed 21 Dec 2011 03:55:28 PM EST
:Last Seen                     Wed 21 Dec 2011 03:55:28 PM EST
:Local ID                      7906161e-3893-4fee-8aa8-bfb432eaad88
:Raw Audit Messages
:type=AVC msg=audit(1324500928.914:31364): avc:  denied  { read write } for  pid=19056 comm="smtp" name="530EB3C03EE" dev=dm-3 ino=3933166 scontext=system_u:system_r:postfix_smtp_t:s0 tcontext=system_u:object_r:postfix_spool_maildrop_t:s0 tclass=file
:type=SYSCALL msg=audit(1324500928.914:31364): arch=i386 syscall=open success=no exit=EACCES a0=2219d508 a1=8002 a2=0 a3=2219cc38 items=0 ppid=2033 pid=19056 auid=4294967295 uid=89 gid=89 euid=89 suid=89 fsuid=89 egid=89 sgid=89 fsgid=89 tty=(none) ses=4294967295 comm=smtp exe=/usr/libexec/postfix/smtp subj=system_u:system_r:postfix_smtp_t:s0 key=(null)
:Hash: smtp,postfix_smtp_t,postfix_spool_maildrop_t,file,read,write
:#============= postfix_smtp_t ==============
:allow postfix_smtp_t postfix_spool_maildrop_t:file { read write };
:audit2allow -R
:#============= postfix_smtp_t ==============
:allow postfix_smtp_t postfix_spool_maildrop_t:file { read write };

Comment 1 John Griffiths 2011-12-22 02:08:45 UTC
As a workaround and possible solution, rather than creating a local policy, I changed the context on the directories defer and deferred in /var/spool/postfix from 




and the mail was properly delivered.

Comment 2 Miroslav Grepl 2011-12-22 10:43:47 UTC
The "postfix_spool_maildrop_t" is the correct label. If you disable your local policy

# semodule -d name_your_module

and execute

# semanage permissive -a postfix_smtp_t

what avc are you getting then?

Comment 3 John Griffiths 2011-12-22 17:02:32 UTC
I had not made a local policy. I changed the context as stated in comment 1.

After executing 

# semanage permissive -a postfix_smtp_t

and then 

# grep AVC ./audit/audit.log | grep smtp > ~/avc.1
# cp /var/log/maillog ~/maillog.1
# mail me@offHost.com
# grep AVC ./audit/audit.log | grep smtp > ~/avc.2
# cp /var/log/maillog ~/maillog.2
# diff ~/avc.1 ~/avc.2

There were no differences, so I assume no AVCs.

# diff ~/maillog.1 ~/maillog.2
> Dec 22 11:51:28 redacted postfix/pickup[5142]: 38C453C0198: uid=0 from=<root>
> Dec 22 11:51:28 redacted postfix/cleanup[6710]: 38C453C0198: message-id=<20111222165128.38C453C0198@redacted.internal.redacted2>
> Dec 22 11:51:28 redacted postfix/qmgr[2036]: 38C453C0198: from=<root@redacted2>, size=458, nrcpt=1 (queue active)
> Dec 22 11:51:28 redacted postfix/smtpd[6715]: connect from localhost[]
> Dec 22 11:51:28 redacted postfix/smtpd[6715]: D4D223C0144: client=localhost[]
> Dec 22 11:51:28 redacted postfix/cleanup[6710]: D4D223C0144: message-id=<20111222165128.38C453C0198@redacted.internal.redacted2>
> Dec 22 11:51:29 redacted postfix/qmgr[2036]: D4D223C0144: from=<root@redacted2>, size=957, nrcpt=1 (queue active)
> Dec 22 11:51:29 redacted postfix/smtpd[6715]: disconnect from localhost[]
> Dec 22 11:51:29 redacted amavis[5771]: (05771-04) Passed CLEAN, <root@redacted2> -> <me@someHost.domain>, Message-ID: <20111222165128.38C453C0198@redacted.internal.redacted2>, mail_id: 4HibBy5AI0pv, Hits: -10.001, size: 458, queued_as: D4D223C0144, 704 ms
> Dec 22 11:51:29 redacted postfix/smtp[6712]: 38C453C0198: to=<me@someHost.domain>, relay=[]:10024, delay=0.87, delays=0.14/0.01/0.01/0.71, dsn=2.0.0, status=sent (250 2.0.0 from MTA([]:10025): 250 2.0.0 Ok: queued as D4D223C0144)
> Dec 22 11:51:29 redacted postfix/qmgr[2036]: 38C453C0198: removed
> Dec 22 11:51:29 redacted postfix/smtp[6717]: D4D223C0144: to=<me@someHost.domain>, relay=outbound.mailhop.org[]:2525, delay=0.58, delays=0.13/0.03/0.21/0.2, dsn=2.0.0, status=sent (250 OK id=1Rdlrd-00047F-DA)
> Dec 22 11:51:29 redacted postfix/qmgr[2036]: D4D223C0144: removed

So with postfix_smtp_t in permissive mode, there are no AVCs and mail is sent.

The question is: Is it safe to have postfix_smtp_t in permissive mode?

Comment 4 Fedora Update System 2012-01-26 18:16:22 UTC
selinux-policy-3.10.0-74.fc16 has been submitted as an update for Fedora 16.

Comment 5 Fedora Update System 2012-01-28 03:29:26 UTC
Package selinux-policy-3.10.0-74.fc16:
* should fix your issue,
* was pushed to the Fedora 16 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-74.fc16'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2012-01-31 22:02:54 UTC
selinux-policy-3.10.0-74.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

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