Bug 512710 - SElinux disallows nagios sending alerts via mailx & exim
Summary: SElinux disallows nagios sending alerts via mailx & exim
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-07-20 13:55 UTC by Joe Christy
Modified: 2010-04-27 16:54 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-04-27 16:54:56 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
output from sealert -l (2.46 KB, text/plain)
2009-07-20 13:55 UTC, Joe Christy
no flags Details
extract of output from audit2allow -w -a (722 bytes, text/plain)
2009-07-20 13:58 UTC, Joe Christy
no flags Details
extract of output from audit2allow -a (84 bytes, text/plain)
2009-07-20 13:58 UTC, Joe Christy
no flags Details
Second out put of sealert -l, showing new denials (2.46 KB, application/octet-stream)
2009-07-20 15:24 UTC, Joe Christy
no flags Details
Type Enforcement file for policy fixing first problem and exposing second (185 bytes, application/octet-stream)
2009-07-20 15:27 UTC, Joe Christy
no flags Details
Second Type Enforcement file, attempts to correct both denials (214 bytes, text/plain)
2009-07-20 15:30 UTC, Joe Christy
no flags Details
Third output from sealert -l (2.48 KB, text/plain)
2009-07-20 16:26 UTC, Joe Christy
no flags Details
Third te file attempting to fix denial described in https://bugzilla.redhat.com/attachment.cgi?id=354364 (248 bytes, application/octet-stream)
2009-07-20 16:29 UTC, Joe Christy
no flags Details
Fourth alert, after installing local policy based on attachment 354366 (2.48 KB, text/plain)
2009-07-20 16:32 UTC, Joe Christy
no flags Details
Fifth output from sealert -l, after inserting Dan's local policy (2.46 KB, application/octet-stream)
2009-07-20 22:20 UTC, Joe Christy
no flags Details
The local policy that I've put together with audit2allow (247 bytes, text/plain)
2009-07-21 03:20 UTC, Joe Christy
no flags Details
The local policy that Dan suggested most recentlyThi (109 bytes, text/plain)
2009-07-21 03:22 UTC, Joe Christy
no flags Details
... and this is the AVC denial I get withe the two attached local policies in place (2.67 KB, application/octet-stream)
2009-07-21 03:31 UTC, Joe Christy
no flags Details
... and this is the AVC denial I get with the two attached local policies in place bis (2.67 KB, text/plain)
2009-07-21 03:37 UTC, Joe Christy
no flags Details

Description Joe Christy 2009-07-20 13:55:24 UTC
Created attachment 354347 [details]
output from sealert -l

Description of problem:
Nagios attempts to send email notifications vail mailx => cauding AVC denials

Version-Release number of selected component (if applicable):
mailx-12.4-2.fc11.x86_64
exim-4.69-10.fc11.x86_64
selinux-policy-3.6.12-62.fc11.noarch


How reproducible:
always

Steps to Reproduce:
1. set exim as default MTA
2. install and enable nagios
3.
  
Actual results:
at 34 minutes past the hour, nagios tries to send a message and an AVC denial results

Expected results:
nagios sends message and selinux doesn't complain

Additional info:
3 attachments follow: 1) output from sealert -l, 2) extract of output from audit2allow -w -a, and 3) extract of output from audit2allow -a

Comment 1 Joe Christy 2009-07-20 13:58:08 UTC
Created attachment 354348 [details]
extract of output from audit2allow -w -a

Comment 2 Joe Christy 2009-07-20 13:58:46 UTC
Created attachment 354349 [details]
extract of output from audit2allow -a

Comment 3 Joe Christy 2009-07-20 15:14:13 UTC
After creating a local policy (to follow) to allow mailx to execute exim, I got a new denial for read and open of exim by mailx attached below.

Comment 4 Joe Christy 2009-07-20 15:24:25 UTC
Created attachment 354359 [details]
Second out put of sealert -l, showing new denials

Comment 5 Joe Christy 2009-07-20 15:27:11 UTC
Created attachment 354360 [details]
Type Enforcement file for policy fixing first problem and exposing second

produced via: egrep exim /var/log/audit/audit.log | audit2allow -a -M NagiosMailxExim

Comment 6 Joe Christy 2009-07-20 15:30:15 UTC
Created attachment 354361 [details]
Second Type Enforcement file, attempts to correct both denials

produced by:
egrep exim /var/log/audit/audit.log | audit2allow -a -M NagiosMailxExim1

Comment 7 Joe Christy 2009-07-20 16:26:03 UTC
Created attachment 354364 [details]
Third output from sealert -l

I got these from nagios's attempts to email me after installing a local policy to allow execute & open by mailx of exim.

Comment 8 Joe Christy 2009-07-20 16:29:27 UTC
Created attachment 354366 [details]
Third te file attempting to fix denial described in https://bugzilla.redhat.com/attachment.cgi?id=354364

Another, unsuccessful, go at a local policy to allows nagios to use mailx to send messages to its admin when exim is the MTA

Comment 9 Joe Christy 2009-07-20 16:32:24 UTC
Created attachment 354367 [details]
Fourth alert, after installing local policy based on attachment 354366 [details]

Sigh.

Comment 10 Joe Christy 2009-07-20 16:36:04 UTC
I totally don't understand this last one, since sendmail isn't installed on my system, and /usr/{bin,lib}/sendmail resolve, through alternatives to exim. It appears that selinux is denying exim, albeit invoked by a circuitous route, access to its spool directory.

FWIW, exim works find with other automagically generated alert from various cron-scheduled jobs, etc.

Comment 11 Daniel Walsh 2009-07-20 20:48:17 UTC
Mgrepl you need to add

optional_policy(`
	exim_domtrans(sendmail_t)
')




Joe if you want you can add this policy for now.


=========================== cut ======================================
policy_module(myexim, 1.0)
gen_require(`
          type sendmail_t;
')
exim_manage_spool_dirs(sendmail_t)

======================================================================

create myexim.te using the above lines.

# make -f /usr/share/selinux/devel/Makefile
# semodule myexim.pp

Comment 12 Joe Christy 2009-07-20 21:10:48 UTC
Mgrepl?? Where do I add:

optional_policy(`
 exim_domtrans(sendmail_t)
')

??

I'll try the te file

Comment 13 Miroslav Grepl 2009-07-20 21:49:17 UTC
(In reply to comment #12)
> Mgrepl?? Where do I add:
> 
> optional_policy(`
>  exim_domtrans(sendmail_t)
> ')
> 
> ??
> 

Joe,

I'll add this to selinux-policy.

> I'll try the te file

Comment 14 Joe Christy 2009-07-20 22:20:13 UTC
Created attachment 354398 [details]
Fifth output from sealert -l, after inserting Dan's local policy

Comment 15 Joe Christy 2009-07-20 22:21:45 UTC
The prior denial occurred after I had built and inserted the local policy based on Dan's te file and removed my earlier local policies.

Comment 16 Daniel Walsh 2009-07-21 01:26:15 UTC
Joe, I am sorry, I had a cut and paste error.

Should have had

=========================== cut ======================================
policy_module(myexim, 1.0)
gen_require(`
          type sendmail_t;
')
exim_domtrans(sendmail_t)
======================================================================

Follow the steps above and this will replace the first policy module.

Comment 17 Joe Christy 2009-07-21 03:14:31 UTC
OK, I'm about to obsolete a ton of earlier attachments and get to an up to date sketch of where my local policies are and the latest denial (w/ the latest policies in place). With Dan's first proposed te file, I removed all my prior local policies and then step-wise re-added them as familiar alerts  came in. I haven't repeated that procedure w/ Dan's 2nd proposal, but I'm assuming now that I need both the policies I've accumulated listening to audit2allow _and_ Dan's policy _and_ something else.

Ideally, I would like to ask you all to review what I've had to add and integrate it w/ Dan's suggestions.

Comment 18 Joe Christy 2009-07-21 03:20:05 UTC
Created attachment 354430 [details]
The local policy that I've put together with audit2allow

This is the first of two local policies that I've installed to solve this problem.

Comment 19 Joe Christy 2009-07-21 03:22:01 UTC
Created attachment 354431 [details]
The local policy that Dan suggested most recentlyThi

This is the policy from comment 16, https://bugzilla.redhat.com/show_bug.cgi?id=512710#c16

Comment 20 Joe Christy 2009-07-21 03:31:58 UTC
Created attachment 354432 [details]
... and this is the AVC denial I get withe the two attached local policies in place

I hope it's clear: even with the policies from attachements 354430 and 354431, I still get AVC denials, about mis-labeled files now. I have no idea where the temp-ish-looking file in question, with the hash-like name came from. Moreover, find (actually find21-2 2TB or so beneath /.

Sigh.

Comment 21 Joe Christy 2009-07-21 03:37:29 UTC
Created attachment 354433 [details]
... and this is the AVC denial I get with the two attached local policies in place bis

Oops, forgot to obsolete the prior alerts.

This is the same alert as attachment 354432 [details], and the comment there about the ephemeral nature of the file selinux is denying access to applies in spades (find is still searching to know avail).

Comment 22 Daniel Walsh 2009-07-21 13:00:23 UTC
Miroslav, add

optional_policy(`
	sendmail_manage_tmp(exim_t)
')
to exim.te

Add 
########################################
## <summary>
##	Manage sendmail tmp files.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
## <rolecap/>
#
interface(`sendmail_manage_tmp',`
	gen_require(`
		type sendmail_tmp_t;
	')

	files_search_tmp($1)
	manage_files_pattern($1, sendmail_tmp_t, sendmail_tmp_t)
')
to sendmail.if

Comment 23 Daniel Walsh 2009-07-21 13:02:08 UTC
Joe one more attempt.

=========================== cut ======================================
policy_module(myexim, 1.0)
gen_require(`
          type sendmail_t, exim_t, sendmail_tmp_t;

')
exim_domtrans(sendmail_t)
manage_files_pattern(exim_t, sendmail_tmp_t, sendmail_tmp_t)

======================================================================

Comment 24 Joe Christy 2009-07-21 19:32:19 UTC
Dan: Third time's a charm - that did it. What do you make of the local policy in https://bugzilla.redhat.com/show_bug.cgi?id=512710#c18? Can it be improved? Or is it obsoleted by https://bugzilla.redhat.com/show_bug.cgi?id=512710#c23? Thanks, Joe

Comment 25 Daniel Walsh 2009-07-21 19:55:24 UTC
Obsoleted.

Comment 26 Daniel Walsh 2009-07-27 17:48:39 UTC
Miroslav can you make this the default in F11.

Comment 27 Miroslav Grepl 2009-07-28 13:19:15 UTC
Fixed in selinux-policy-3.6.12-70.fc11

Comment 29 Bug Zapper 2010-04-27 15:48:02 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  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 WONTFIX if it remains open with a Fedora 
'version' of '11'.

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 prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 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 please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

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.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping


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