As the title says, how do I view the contents of a SELinux policy package? The resulting files end with .pp. I'm running on centos 6, but I guess it's the same way on "all" distros.
For example
cp /usr/share/selinux/targeted/cobbler.pp.bz2 ~
bunzip2 cobbler.pp.bz2
MAGIC_SELINUX_CMD cobbler.pp
A SELinux policy module is built by following steps:
audit2allow
checkmodule
semodule_package
http://wiki.centos.org/HowTos/SELinux
Assuming that I have a
postgreylocal.te
file with belows content:postgreylocal.pp
policy module will be created with:To unpack this policy module, you need a tool which is called semodule_unpackage to extract the
.mod
file and then usedismod
to disassemble the binary module to textual representation.On my Gentoo, the following packages need to be installed:
Firstly, extract the module from
.pp
file:and secondly, disassemble with
dismod
:Are you getting a problem like
wrong magic number for module package: expected 0xf97cff8f, got 0x39685a42
?.pp files are stored internally in bzip2 format, so you'll need to do
bzip2 -cdk policyfile.pp > policyfile.pp.out
BEFOREsemodule_unpackage policyfile.pp.out policyfile.mod
.