Bug 966549 - Sudo auditing problems when selinux is enforced
Sudo auditing problems when selinux is enforced
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy (Show other bugs)
x86_64 Linux
unspecified Severity low
: rc
: 6.4
Assigned To: Miroslav Grepl
BaseOS QE Security Team
Depends On:
  Show dependency treegraph
Reported: 2013-05-23 09:13 EDT by g.danti
Modified: 2013-08-06 03:06 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-08-06 03:06:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
PHP test file (107 bytes, application/x-php)
2013-05-23 09:16 EDT, g.danti
no flags Details
Selinux policy template (2.32 KB, text/plain)
2013-05-23 09:17 EDT, g.danti
no flags Details
Selinux binary policy (4.11 KB, application/octet-stream)
2013-05-23 09:18 EDT, g.danti
no flags Details
Sudo debug log (5.46 KB, text/x-log)
2013-05-23 09:19 EDT, g.danti
no flags Details

  None (edit)
Description g.danti 2013-05-23 09:13:51 EDT
Description of problem:
I have a web application that use the exec() function to call "sudo -H -u amavis amavisd-release" (see attached test file for an example). When selinux is enforced, sudo correctly completes but also return this error:
"sudo: unable to send audit message: Permission denied"

Searching in the /var/log/audit/audit.log show no useful information (I already modified the default selinux policy to allow the execution of an external script and a sudo session from within an httpd process).

If I use selinux in permissive mode, the error message is not returned, but in the /var/log/audit/audit.log file I can not see any "denied" message.

Curiously, if I execute the command from a bash shell using the apache user (I change apache's user to launch /bin/bash for testing purpose) I can not see any error.

In the sudo debug log, I can see a message stating "May 23 14:44:16 sudo[1952] unable to send audit message: Permission denied @ linux_audit_command() ./linux_audit.c:93"

Version-Release number of selected component (if applicable):

How reproducible:
Always (100%)

Steps to Reproduce:
1. setup sudo to don't require a tty
2. load the attached selinux custom policy
3. launch the attached php file from within apache
4. you will have a "sudo: unable to send audit message: Permission denied" error.

Actual results:
While sudo correctly completes, you have an error stating "sudo: unable to send audit message: Permission denied"

Expected results:
Sudo should execute without error. On the other side, if the selinux policy somehow deny sudo to send an audit message, this should be logged somewhere.

Additional info:
I attached four files:
1) the php test file
2) the selinux custom policy template
3) the selinux custom binary policy
4) the complete sudo debug log.
Comment 1 g.danti 2013-05-23 09:16:15 EDT
Created attachment 752201 [details]
PHP test file
Comment 2 g.danti 2013-05-23 09:17:51 EDT
Created attachment 752202 [details]
Selinux policy template
Comment 3 g.danti 2013-05-23 09:18:39 EDT
Created attachment 752203 [details]
Selinux binary policy
Comment 4 g.danti 2013-05-23 09:19:28 EDT
Created attachment 752204 [details]
Sudo debug log
Comment 6 Daniel Walsh 2013-05-23 14:20:24 EDT
Can you turn off the dontaudit rules.

semodule -DB


Will allow your domain to send audit messages.
Comment 7 g.danti 2013-05-24 04:28:43 EDT
Thank you very much Daniel!
I simply ignored the don't audit facility and so I were stumbled in this problem.

After disabling the don't audit rules, I was able to find the offending messages and to grant the specific permission needed to run sudo without issues.

Thank you again :)

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