xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/LSM/SELinux.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun=======
2*4882a593SmuzhiyunSELinux
3*4882a593Smuzhiyun=======
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunIf you want to use SELinux, chances are you will want
6*4882a593Smuzhiyunto use the distro-provided policies, or install the
7*4882a593Smuzhiyunlatest reference policy release from
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun	https://github.com/SELinuxProject/refpolicy
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunHowever, if you want to install a dummy policy for
12*4882a593Smuzhiyuntesting, you can do using ``mdp`` provided under
13*4882a593Smuzhiyunscripts/selinux.  Note that this requires the selinux
14*4882a593Smuzhiyunuserspace to be installed - in particular you will
15*4882a593Smuzhiyunneed checkpolicy to compile a kernel, and setfiles and
16*4882a593Smuzhiyunfixfiles to label the filesystem.
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun	1. Compile the kernel with selinux enabled.
19*4882a593Smuzhiyun	2. Type ``make`` to compile ``mdp``.
20*4882a593Smuzhiyun	3. Make sure that you are not running with
21*4882a593Smuzhiyun	   SELinux enabled and a real policy.  If
22*4882a593Smuzhiyun	   you are, reboot with selinux disabled
23*4882a593Smuzhiyun	   before continuing.
24*4882a593Smuzhiyun	4. Run install_policy.sh::
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun		cd scripts/selinux
27*4882a593Smuzhiyun		sh install_policy.sh
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunStep 4 will create a new dummy policy valid for your
30*4882a593Smuzhiyunkernel, with a single selinux user, role, and type.
31*4882a593SmuzhiyunIt will compile the policy, will set your ``SELINUXTYPE`` to
32*4882a593Smuzhiyun``dummy`` in ``/etc/selinux/config``, install the compiled policy
33*4882a593Smuzhiyunas ``dummy``, and relabel your filesystem.
34