Bug 729361

Summary: SELinux prevents amanda from sending mail
Product: Red Hat Enterprise Linux 6 Reporter: Orion Poplawski <orion>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED DUPLICATE QA Contact: Milos Malik <mmalik>
Severity: low Docs Contact:
Priority: medium    
Version: 6.1CC: dwalsh, mmalik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-09 09:37:48 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 Orion Poplawski 2011-08-09 16:39:02 UTC
Description of problem:

At the end of a run, amanda sends mail of the log.  SELinux is preventing this.  In enforcing mode I see:

type=AVC msg=audit(1312901001.834:76457): avc:  denied  { append } for  pid=18183 comm="mail" path="/var/lib/amanda/Data/amdump" dev=dm-4 ino=527273 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:amanda_var_lib_t:s0 tclass=file
type=AVC msg=audit(1312901001.834:76457): avc:  denied  { append } for  pid=18183 comm="mail" path="/var/lib/amanda/Data/amdump" dev=dm-4 ino=527273 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:amanda_var_lib_t:s0 tclass=file
type=AVC msg=audit(1312901001.834:76457): avc:  denied  { read } for  pid=18183 comm="mail" path="/var/lib/amanda/Data/log" dev=dm-4 ino=527272 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:amanda_var_lib_t:s0 tclass=file
type=AVC msg=audit(1312901001.951:76458): avc:  denied  { write } for  pid=18183 comm="mail" name="21680.1.amanda" dev=tmpfs ino=162693 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=dir

The third item is a leaked file descriptor.

The mail command is run from perl with:

open3($fh, ">&2", ">&2", @cmd);

So any output of the mail command is expected to go to the amdump log.  It appears that the mail command is not allowed to create it's temp file.

Version-Release number of selected component (if applicable):
selinux-policy-3.7.19-106.el6.noarch
amanda-3.3.0-2.el6.cora.1.x86_64

Comment 2 Miroslav Grepl 2011-08-11 12:32:45 UTC
What AVC are you getting in permissive mode?

Comment 3 Orion Poplawski 2011-08-31 15:21:09 UTC
Sorry for the delay, here we go:

type=AVC msg=audit(1314789994.636:948630): avc:  denied  { append } for  pid=14918 comm="mail" path="/var/lib/amanda/Data/amdump" dev=dm-4 ino=524886 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:amanda_var_lib_t:s0 tclass=file
type=AVC msg=audit(1314789994.636:948630): avc:  denied  { read } for  pid=14918 comm="mail" path="/var/lib/amanda/Data/log" dev=dm-4 ino=524796 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:amanda_var_lib_t:s0 tclass=file
type=AVC msg=audit(1314789995.443:948631): avc:  denied  { ioctl } for  pid=14918 comm="mail" path="/var/lib/amanda/Data/amdump" dev=dm-4 ino=524886 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:amanda_var_lib_t:s0 tclass=file
type=AVC msg=audit(1314789995.443:948632): avc:  denied  { add_name } for  pid=14918 comm="mail" name="Rs7AM1VB" scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=dir
type=AVC msg=audit(1314789995.443:948632): avc:  denied  { create } for  pid=14918 comm="mail" name="Rs7AM1VB" scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file
type=AVC msg=audit(1314789995.443:948633): avc:  denied  { setattr } for  pid=14918 comm="mail" name="Rs7AM1VB" dev=tmpfs ino=25852496 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file
type=AVC msg=audit(1314789995.443:948634): avc:  denied  { remove_name } for  pid=14918 comm="mail" name="Rs7AM1VB" dev=tmpfs ino=25852496 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=dir
type=AVC msg=audit(1314789995.443:948634): avc:  denied  { unlink } for  pid=14918 comm="mail" name="Rs7AM1VB" dev=tmpfs ino=25852496 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file
type=AVC msg=audit(1314789997.411:948635): avc:  denied  { getattr } for  pid=14921 comm="sendmail" path="/var/lib/amanda/Data/amdump" dev=dm-4 ino=524886 scontext=system_u:system_r:sendmail_t:s0 tcontext=system_u:object_r:amanda_var_lib_t:s0 tclass=file

Comment 4 Miroslav Grepl 2011-09-06 12:34:04 UTC
Any idea who creates name="Rs7AM1VB" file with initrc_tmp_t context? 

This means the file is created by an init script or a domain running as initrc_t.

Comment 5 Orion Poplawski 2011-09-06 14:44:21 UTC
This dovetails nicely with our grid work - the backup jobs are being run as grid jobs and the grid daemons (and the backup scripts) are running as initrc_t.  I'll installed the grid policy on this machine as well and see what changes.

Comment 6 Miroslav Grepl 2011-09-08 12:04:35 UTC
Ok, this relates with grid jobs.

Comment 8 Miroslav Grepl 2011-12-09 09:37:48 UTC

*** This bug has been marked as a duplicate of bug 718273 ***