LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   SELinux: Show current module policy (https://www.linuxquestions.org/questions/linux-security-4/selinux-show-current-module-policy-917570/)

TJNII 12-07-2011 09:50 AM

SELinux: Show current module policy
 
I have a Cent6 box running SELinux that I need to modify SELinux policy on. The service that I need to make the change already has a policy file in /etc/selinux/targeted/modules/active/modules/[service].pp. I want to append to the existing rules, not overwrite them with a new module. How do I decompile the .pp file to view its contents? My intention would be to generate a .te file from the .pp file, merge it with my new .te file, and replace the existing policy.

unSpawn 12-11-2011 08:35 AM

Quote:

Originally Posted by TJNII (Post 4544305)
I have a Cent6 box running SELinux that I need to modify SELinux policy on. The service that I need to make the change already has a policy file in /etc/selinux/targeted/modules/active/modules/[service].pp. I want to append to the existing rules, not overwrite them with a new module. How do I decompile the .pp file to view its contents? My intention would be to generate a .te file from the .pp file, merge it with my new .te file, and replace the existing policy.

Simple answer (not that you'll like it) is you don't (OK, AFAIK). Since you just want to add to an existing policy just create the necessary [whatevername].te, .if and .fc files, add whatever rules you need then use the provided Makefile and 'semodule' tool to compile and add your additional rules to the module store.

TJNII 12-12-2011 08:12 AM

From and administration standpoint I find this hard to believe. There must be some way to show what selinux rules the kernel is enforcing. There has to be a better way than just appending to a set of functionally write-only files whenever a change is needed.

unSpawn 12-12-2011 02:36 PM

Quote:

Originally Posted by TJNII (Post 4547881)
There must be some way to show what selinux rules the kernel is enforcing.

That is a completely different question.


Quote:

Originally Posted by TJNII (Post 4547881)
There has to be a (..) way (..)

Look at the selinux-policy-%{version}.el5.src.rpm and http://oss.tresys.com/projects/refpolicy.

TJNII 12-12-2011 04:27 PM

Quote:

Look at the selinux-policy-%{version}.el5.src.rpm and http://oss.tresys.com/projects/refpolicy.
Well, that still doesn't answer my question as it assumes the bundled policy has not already been appended. If a previous admin has already appended to the policy, how do I figure out what has been done? I would like to find a solution that prints exactly what a running kernel is enforcing.

unSpawn 12-12-2011 06:24 PM

Use the tools from the setools package.


All times are GMT -5. The time now is 08:24 AM.