Skip to content

Commit 6c2d0ba

Browse files
AashvijShenaijeevantelukula
authored andcommitted
feat: Add Yocto building info for SELinux
This adds documentation on how to integrate preceding information into the Yocto build for production environments Signed-off-by: Aashvij Shenai <[email protected]>
1 parent 422da62 commit 6c2d0ba

File tree

1 file changed

+27
-0
lines changed
  • source/linux/Foundational_Components/System_Security

1 file changed

+27
-0
lines changed

source/linux/Foundational_Components/System_Security/SELinux.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,30 @@ This guide serves as a reference implementation and will not be diving into cust
170170
Policy deny_unknown status: allowed
171171
Memory protection checking: actual (secure)
172172
Max kernel policy version: 31
173+
174+
Integrating into Yocto for production
175+
*************************************
176+
177+
The above steps are useful during development but unusable in a production environment. The following are pointers to help build a final image which does not require the above steps.
178+
179+
1. ``security=selinux`` can be added into :file:`sources/meta-arago/meta-arago-distro/recipes-tisdk/tisdk-uenv/tisdk-uenv/uEnv.txt` to make it default.
180+
181+
2. To relabel on first boot, add ``FIRST_BOOT_RELABEL="1"`` in :file:`local.conf`
182+
183+
3. To set the default selinux mode, add ``DEFAULT_ENFORCING="<mode>"`` in :file:`local.conf`, where <mode> is disabled/permissive/enforcing.
184+
185+
4. Once the policy has been created, there are multiple ways to install it. This post_install section can be added into your recipe, myPolicy.pp is the policy that is placed in the meta-selinux directory:
186+
187+
.. code-block:: console
188+
189+
SRC_URI += "file://myPolicy.pp"
190+
191+
do_install:append() {
192+
install -d ${D}/etc/selinux/targeted/modules/active/modules
193+
install -m 0644 ${WORKDIR}/myPolicy.pp ${D}/etc/selinux/targeted/modules/active/modules/
194+
}
195+
196+
pkg_postinst_ontarget:${PN}() {
197+
#!/bin/bash
198+
/usr/sbin/semodule -i /etc/selinux/targeted/modules/active/modules/myPolicy.pp
199+
}

0 commit comments

Comments
 (0)