I have a php script that runs in an apache serveron a RHEL5 installation. This script runs an exec on "rpm -q --info packagename".
The thing is that it works properly with selinux in permissive mode, but not when it's fully enabled. So I assume it's a selinux issue.
I've started out with the audit2allow to create rules based on the denied entries i've found, but now there is no more denied in the audit logs, but it still doesn't run with the selinux enabled.
In my world it seems it queries the system if it would be allowed to run, and when selinux say "if you try this, I will stop you". So the system does not run the exec. If it would, i assume i would get a "denied" that i could create a new selinux rule based upon. With selinux in permissive, i don't get any denied either, but it works..
So it seems I will have to deal with this the hard way and create a custom rule for selinux. Said and done I made one:
module php_rpm 1.0;
require {
type httpd_t;
type bin_t;
type rpm_exec_t;
type rpm_var_lib_t;
class file { execute execute_no_trans getattr read execmod };
class dir { getattr search };
}
#============= httpd_t ==============
allow httpd_t rpm_exec_t:file { execute execute_no_trans getattr read execmod };
allow httpd_t rpm_var_lib_t:dir { getattr search };
Unfortunally this did nothing to my problem but assumingly messing up my selinux rules a bit :P
Have anyone out there attempted to execute rpm from php with selinux enabled and got away with it?