Bug 1366173 - /root/.esmtp_queue has bad context when created from a cron job
Summary: /root/.esmtp_queue has bad context when created from a cron job
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1282043 1319370 (view as bug list)
Depends On:
Blocks: 1303305
TreeView+ depends on / blocked
 
Reported: 2016-08-11 08:45 UTC by Ondřej Lysoněk
Modified: 2016-09-29 22:52 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.13.1-158.24.fc23
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-29 22:52:16 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ondřej Lysoněk 2016-08-11 08:45:22 UTC
Description of problem:
When a process with context
'unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023'
creates the '/root/.esmtp_queue/' directory, then the directory is assigned the correct context
'unconfined_u:object_r:mail_home_rw_t:s0'

However, if the process that creates the directory has context
'system_u:system_r:crond_t:s0-s0:c0.c1023'
(context of the 'atd' daemon - note that this context is only preserved, when 'atd' is sending mail internally. The context is set to unconfined when running the jobs.)
or
'system_u:system_r:system_cronjob_t:s0-s0:c0.c1023'
(context of a regular cron job)
then the created directory has incorrect context
'system_u:object_r:admin_home_t:s0'

Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-158.21.fc23

Comment 1 Ondřej Lysoněk 2016-08-11 08:49:34 UTC
This might be the cause of [1] and [2], but there may be other process contexts, under which the directory is created with bad context.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1282043
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1319370

Comment 2 Lukas Vrabec 2016-08-11 09:54:08 UTC
*** Bug 1282043 has been marked as a duplicate of this bug. ***

Comment 3 Lukas Vrabec 2016-08-11 09:54:31 UTC
*** Bug 1319370 has been marked as a duplicate of this bug. ***

Comment 4 Jonathan Wakely 2016-08-15 09:25:22 UTC
(In reply to Ondřej Lysoněk from comment #0)
> When a process with context
> 'unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023'
> creates the '/root/.esmtp_queue/' directory, then the directory is assigned
> the correct context

N.B. I'm seeing atd use /.esmtp_queue/ **not** /root/.esmtp_queue/

Comment 5 Ondřej Lysoněk 2016-08-15 12:12:06 UTC
(In reply to Jonathan Wakely from comment #4)
> (In reply to Ondřej Lysoněk from comment #0)
> > When a process with context
> > 'unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023'
> > creates the '/root/.esmtp_queue/' directory, then the directory is assigned
> > the correct context
> 
> N.B. I'm seeing atd use /.esmtp_queue/ **not** /root/.esmtp_queue/

Yes, this is a bug, which is being resolved in [1]. The correct directory should be /root/.esmtp_queue/.

If you want to test this bug, I can send you a patch for esmtp, which fixes [1]. I did not build it yet, as I'm waiting for the resolution of this selinux-policy bug.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1303305

Comment 6 Ondřej Lysoněk 2016-08-22 11:20:46 UTC
This seems to be fixed now in f24-rawhide. Are you planning to backport the fix to f23 too?

Comment 7 Lukas Vrabec 2016-08-25 12:10:45 UTC
It's backported. I just need to create new build.

Comment 8 Fedora Update System 2016-09-16 08:37:12 UTC
selinux-policy-3.13.1-158.24.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-f739cc7524

Comment 9 Fedora Update System 2016-09-17 00:52:52 UTC
selinux-policy-3.13.1-158.24.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-f739cc7524

Comment 10 Fedora Update System 2016-09-29 22:52:16 UTC
selinux-policy-3.13.1-158.24.fc23 has been pushed to the Fedora 23 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.