Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 171941 - SELinux apache policy does not permit execmod (e.g. for php)
Summary: SELinux apache policy does not permit execmod (e.g. for php)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: SE Linux Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-23 17:12 UTC by Michael Edenfield
Modified: 2007-08-26 00:57 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Edenfield 2007-03-23 17:12:27 UTC
The apache policy does not give httpd_t 'execmod' permissions to its modules.  PHP, and possibly other modules, have text relocations and require 'execmod' permissions.  The problem appears to result from libphp5.so being labelled differently from most other shared libraries, by nature of being in the apache modules path.  'execmod' is granted to files labelled with shlib_t and textrel_shlib_t, but not httpd_modules_t.

The current policy includes the following template for granting access to the modules:

interface(`apache_exec_modules',`
        gen_require(`
                type httpd_modules_t;
        ')

        allow $1 httpd_modules_t:dir r_dir_perms;
        allow $1 httpd_modules_t:lnk_file r_file_perms;
        can_exec($1,httpd_modules_t)
')

Note, however, that "can_exec" does not supply execmod permission.  Adding:

allow $1 httpd_modules_t:file execmod;

to this template should correct the problem, though there may be a more appropriate solution.


Reproducible: Always

Steps to Reproduce:
Comment 1 Chris PeBenito (RETIRED) gentoo-dev 2007-03-25 20:52:30 UTC
This means that php has text relocations, please try remerging it with USE=pic.
Comment 2 Chris PeBenito (RETIRED) gentoo-dev 2007-08-20 04:34:58 UTC
can you confirm if recompiling php with USE=pic fixed this?
Comment 3 Michael Edenfield 2007-08-22 00:52:03 UTC
(In reply to comment #2)
> can you confirm if recompiling php with USE=pic fixed this?

I'm not running PHP on our secured servers anymore, but it was removed for reasons unrelated to SELinux. As far as I can tell the "pic" flag made it function properly, but I can't confirm that it works as of right now.

I can reinstall it if you would like me to try, but it's not a problem for me anymore so you can also just close the bug :)
Comment 4 Chris PeBenito (RETIRED) gentoo-dev 2007-08-22 01:46:53 UTC
good enough for me
Comment 5 Michael Edenfield 2007-08-26 00:57:28 UTC
(In reply to comment #4)
> good enough for me

For future reference, I can confirm that this works.  I installed the lastest apache2+php5 on a SELinux-secured server.  Without USE="pic" I get the same AVC audit message; with USE="pic" the error does go away.