Bug 154751 - php mail() function blocked by selinux policy
php mail() function blocked by selinux policy
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: selinux-policy-targeted (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Walsh
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-13 18:39 EDT by Gianluca Sforna
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: u1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-07-21 14:24:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Gianluca Sforna 2005-04-13 18:39:09 EDT
Description of problem:
The selinux policy is preventing me from usinf the php mail() function.
Please note I am using postfix in my machine, so the same _could_ work with the
default MTA (sendmail).

Version-Release number of selected component (if applicable):
selinux-policy-targeted-1.17.30-2.52.1.noarch

How reproducible:
always

Steps to Reproduce:
1. Of course you need an httpd server with php enabled
2. create a index.php file in /var/www/html containing the line:
<?php mail ("user@example.com", "TEST Subject", "Test body"; ?>
3. browse the page and hopeless wait for an email in the inbox...
  
Actual results:
The mail is not sent to user@example.com

Expected results:
mail sent

Additional info:
In /var/log/messages I can see:
Apr 13 23:08:08 moat kernel: audit(1113426488.965:0): avc:  denied  { getattr }
for  pid=29205 exe=/bin/bash path=/var/log dev=dm-0 ino=261142
scontext=root:system_r:httpd_sys_script_t tcontext=system_u:object_r:var_log_t
tclass=dir
Apr 13 23:08:08 moat kernel: audit(1113426488.975:0): avc:  denied  { create }
for  pid=29205 exe=/usr/sbin/sendmail.postfix
scontext=root:system_r:httpd_sys_script_t
tcontext=root:system_r:httpd_sys_script_t tclass=unix_dgram_socket
Apr 13 23:08:09 moat kernel: audit(1113426489.093:0): avc:  denied  { search }
for  pid=29205 exe=/usr/sbin/sendmail.postfix name=spool dev=dm-0 ino=261156
scontext=root:system_r:httpd_sys_script_t tcontext=system_u:object_r:var_spool_t
tclass=dir
Apr 13 23:08:09 moat kernel: audit(1113426489.094:0): avc:  denied  { create }
for  pid=29205 exe=/usr/sbin/sendmail.postfix
scontext=root:system_r:httpd_sys_script_t
tcontext=root:system_r:httpd_sys_script_t tclass=unix_dgram_socket
Comment 1 Daniel Walsh 2005-04-13 20:23:52 EDT
The policy in U1 fixes this problem.  You can grab a preview from

ftp://people.redhat.com/dwalsh/SELinux/RHEL4/{selinux-policy-targeted,
policycoretuils}
Comment 2 Gianluca Sforna 2005-04-14 09:08:52 EDT
thanks a lot. I "yum"med the whole thing and now it works as expected.

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