Bug 1140493 - SELinux is preventing /usr/bin/esmtp from 'read' accesses on the file .
Summary: SELinux is preventing /usr/bin/esmtp from 'read' accesses on the file .
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: esmtp
Version: 22
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:c7a150d61e75db3a7a3c09a8215...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-11 06:31 UTC by Mikhail
Modified: 2016-07-19 12:06 UTC (History)
20 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-19 12:06:56 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mikhail 2014-09-11 06:31:33 UTC
Description of problem:
SELinux is preventing /usr/bin/esmtp from 'read' accesses on the file .

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that esmtp should be allowed read access on the  file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep esmtp /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:system_mail_t:s0-s0:c0.c1023
Target Context                system_u:object_r:root_t:s0
Target Objects                 [ file ]
Source                        esmtp
Source Path                   /usr/bin/esmtp
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           esmtp-1.0-11.fc20.i686
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-183.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.16.2-200.fc20.i686+PAE #1 SMP
                              Mon Sep 8 12:07:04 UTC 2014 i686 i686
Alert Count                   3
First Seen                    2014-09-05 10:08:16 YEKT
Last Seen                     2014-09-11 12:08:11 YEKT
Local ID                      a8bf574c-0ce9-47f5-87b4-10a1a13a302c

Raw Audit Messages
type=AVC msg=audit(1410415691.418:757): avc:  denied  { read } for  pid=13900 comm="esmtp" path="/.esmtp_queue/vONRKvpn/mail" dev="sda1" ino=262505 scontext=system_u:system_r:system_mail_t:s0-s0:c0.c1023 tcontext=system_u:object_r:root_t:s0 tclass=file permissive=0


type=SYSCALL msg=audit(1410415691.418:757): arch=i386 syscall=execve success=yes exit=0 a0=9d2e778 a1=9d32cd0 a2=9d2d2b8 a3=9d32cd0 items=0 ppid=13785 pid=13900 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=26 comm=esmtp exe=/usr/bin/esmtp subj=system_u:system_r:system_mail_t:s0-s0:c0.c1023 key=(null)

Hash: esmtp,system_mail_t,root_t,file,read

Additional info:
reporter:       libreport-2.2.3
hashmarkername: setroubleshoot
kernel:         3.16.2-200.fc20.i686+PAE
type:           libreport

Comment 1 Daniel Walsh 2014-09-13 10:56:23 UTC
This seems to be a strange setup.  Looks lke for some reason esmtp thinks / is your root homedir rather then /root?

Any idea why

Comment 2 Christopher Wawak 2014-09-19 14:44:49 UTC
Description of problem:
1. Ran dnf update

Additional info:
reporter:       libreport-2.2.3
hashmarkername: setroubleshoot
kernel:         3.15.10-201.fc20.x86_64
type:           libreport

Comment 3 Christopher Wawak 2014-09-19 14:46:12 UTC
Re: /root vs / - I don't remember specifically making any changes to the system for it to think / is root's home dir.

Comment 4 Christian Stadelmann 2014-09-27 17:09:23 UTC
This bug happens to me about once or twice in a month.
It seems to be caused by the smartd (smartmontools) and freshclam (clamav) daemons trying to send some mail instead of logging.
I think adding a rule to allow this behavior is wrong, instead the bug(s) causing write access to /.esmtp/ should be fixed.

Comment 5 Miroslav Grepl 2014-09-29 13:44:14 UTC
Why is it located directly in / ?

Comment 6 Christian Stadelmann 2014-09-29 19:04:08 UTC
There is/was a similiar bug in abrt where $HOME was not set.
btw: this happens on x86_64 with both F20 and F21.

Comment 7 Richard Z. 2014-10-19 17:27:01 UTC
(In reply to Christian Stadelmann from comment #4)
> This bug happens to me about once or twice in a month.
> It seems to be caused by the smartd (smartmontools) and freshclam (clamav)
> daemons trying to send some mail instead of logging.
> I think adding a rule to allow this behavior is wrong, instead the bug(s)
> causing write access to /.esmtp/ should be fixed.

definitely.

And before doing that, a new version of ESMTP has been out for many years and should finally find its way into Fedora - #1051667

Comment 8 Van de Bugger 2015-03-16 22:35:10 UTC
Hi, please see also bug 1202562.

Shortly: cronie does NOT set HOME env var when it runs sendmail (which is a symlink to esmtp-wrapper).

Comment 9 Fedora End Of Life 2015-05-29 12:51:07 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Fedora End Of Life 2015-06-29 22:29:15 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 11 Lukáš Doktor 2015-09-23 06:18:59 UTC
Hello guys, I have the same problem on F22:

SELinux is preventing esmtp from read access on the file /.esmtp_queue/WcQXCAjq/mail.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/.esmtp_queue/WcQXCAjq/mail default label should be default_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /.esmtp_queue/WcQXCAjq/mail

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that esmtp should be allowed read access on the mail file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep esmtp /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:system_mail_t:s0-s0:c0.c1023
Target Context                system_u:object_r:root_t:s0
Target Objects                /.esmtp_queue/WcQXCAjq/mail [ file ]
Source                        esmtp
Source Path                   esmtp
Port                          <Unknown>
Host                          w541
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-128.13.fc22.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     w541
Platform                      Linux w541 4.1.6-201.fc22.x86_64 #1 SMP Fri Sep 4
                              17:49:24 UTC 2015 x86_64 x86_64
Alert Count                   832897
First Seen                    2015-09-19 10:28:06 CEST
Last Seen                     2015-09-20 09:27:05 CEST
Local ID                      a8af909f-0209-45d7-9992-96949c9f5aa0

Raw Audit Messages
type=AVC msg=audit(1442734025.596:886907): avc:  denied  { read } for  pid=27732 comm="esmtp" path="/.esmtp_queue/WcQXCAjq/mail" dev="dm-3" ino=431662 scontext=system_u:system_r:system_mail_t:s0-s0:c0.c1023 tcontext=system_u:object_r:root_t:s0 tclass=file permissive=0


Hash: esmtp,system_mail_t,root_t,file,read




I deleted the directory (because the system was cluttered with the load), which resulted in:

SELinux is preventing mkdir from write access on the directory /.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that mkdir should be allowed write access on the  directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep mkdir /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:system_mail_t:s0-s0:c0.c1023
Target Context                system_u:object_r:root_t:s0
Target Objects                / [ dir ]
Source                        mkdir
Source Path                   mkdir
Port                          <Unknown>
Host                          w541
Source RPM Packages           
Target RPM Packages           filesystem-3.2-32.fc22.x86_64
Policy RPM                    selinux-policy-3.13.1-128.13.fc22.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     w541
Platform                      Linux w541 4.1.6-201.fc22.x86_64 #1 SMP Fri Sep 4
                              17:49:24 UTC 2015 x86_64 x86_64
Alert Count                   4241
First Seen                    2015-09-20 09:28:01 CEST
Last Seen                     2015-09-23 08:17:01 CEST
Local ID                      ba2e3f5b-6e53-4dbd-b7ac-a621d60dac16

Raw Audit Messages
type=AVC msg=audit(1442989021.181:908854): avc:  denied  { write } for  pid=17890 comm="mkdir" name="/" dev="dm-3" ino=2 scontext=system_u:system_r:system_mail_t:s0-s0:c0.c1023 tcontext=system_u:object_r:root_t:s0 tclass=dir permissive=0


Hash: mkdir,system_mail_t,root_t,dir,write


I wanted to kill `esmtp` process, but it did not exist. After couple of minutes the load ceased and the system was usable again.

Comment 12 Lukáš Doktor 2015-09-23 06:52:49 UTC
OK I read it's because esmtp is started by cron:

    /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t -f root


not setting the $HOME dir. So what I did to avoid high utilization every couple of minutes I added:

    [ $HOME ] || HOME="/root"

at the beginning of the `/usr/bin/esmtp-wrapper` file and it works fine for me.

Comment 13 Richard Z. 2015-09-24 12:12:15 UTC
(In reply to Lukas Doktor from comment #12)
> OK I read it's because esmtp is started by cron:

most frequently but not entirely. You have also demons which have "/" as home dir but not the permission to actually write anything there and might invoke sendmail.

Your fix will also not work if the recipient is anything else than local root. aliases expansion won't work and remote delivery would require a cron job doing "mailq -s" from time to time. 
Local delivery can be fixed to work without the queue but the case of a demon with "/" as home dir and remote delivery is nasty, would require a globally writable queue dir with all the known pitfalls.

Comment 14 Timo Wilken 2015-10-11 13:27:33 UTC
Description of problem:
No steps to repro. I was away from my computer for several hours; when I came back, a notification informed me of the SELinux alert.

Version-Release number of selected component:
selinux-policy-3.13.1-128.16.fc22.noarch

Additional info:
reporter:       libreport-2.6.2
hashmarkername: setroubleshoot
kernel:         4.1.10-200.fc22.x86_64
type:           libreport

Comment 15 Fedora Admin XMLRPC Client 2016-02-12 18:20:58 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 16 Fedora Admin XMLRPC Client 2016-02-14 23:18:15 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 17 Fedora End Of Life 2016-07-19 12:06:56 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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