blob: 20e94ca9cc248f8cbd94a744a62640b3972914c5 [file] [log] [blame]
lh758261d2023-07-13 05:52:04 -07001meta-selinux
2============
3
4This layer's purpose is enabling SE Linux support.
5
6The majority of this layers work is accomplished in bbappend files, used to
7enable SE Linux support in existing recipes.
8
9A new recipes-security was added. The purpose of this category is to add
10software specific to system security.
11
12Please see the MAINTAINERS file for information on contacting the maintainers
13of this layer, as well as instructions for submitting patches.
14
15
16Dependencies
17------------
18
19This layer depends on the openembedded-core metadata and the meta-python and
20meta-oe layers from the meta-openembedded repository.
21
22
23Maintenance
24-----------
25Please see the MAINTAINERS file for information on contacting the maintainers
26of this layer, as well as instructions for submitting patches.
27
28
29Building the meta-selinux layer
30-------------------------------
31In order to add selinux support to the poky build this layer should be added
32to your projects bblayers.conf file.
33
34By default the selinux components are disabled. This conforms to the
35Yocto Project compatible guideline that indicate that simply including a
36layer should not change the system behavior.
37
38In order to use the components in this layer you must add the 'selinux' to the
39DISTRO_FEATURES. In addition to selinux, you should be sure that acl, xattr and
40pam are also present.
41e.g. DISTRO_FEATURES_append = " acl xattr pam selinux"
42
43You must also specify a preferred provider for the virtual/refpolicy. The
44included policies with this layer are simply reference policies and will need
45to be tailored for your environment.
46* Enable the refpolicy-mls:
47e.g. PREFERRED_PROVIDER_virtual/refpolicy ?= "refpolicy-mls"
48
49
50Using different versions of refpolicy
51-------------------------------------
52To prepare selinux enabled images using different ver. of refpolicy,
53we can choose supported releases of refpolicy
54refer to available versions under recipes-security/refpolicy
55
56We can use the refpolicy directly from git repository instead of release tarballs.
57By default refpolicy from git builds head commit of master branch, we can update
58SRCREV for refpolicy and refpolicy-contrib as appropriate at refpolicy_git.inc
59to check refpolicy as per required commits.
60
61* enable the preferred refpolicy-minimum:
62PREFERRED_VERSION_refpolicy-minimum = "2.20151208"
63PREFERRED_VERSION_refpolicy = "2.20151208"
64
65
66Using different init manager
67----------------------------
68By default selinux enabled images coming up with "sysvinit" as init manager,
69we can use "systemd" as an init manager using below changes to local.conf
70
71* enable systemd as init manager changes to local.conf
72DISTRO_FEATURES_remove = " sysvinit"
73DISTRO_FEATURES_append = " systemd"
74VIRTUAL-RUNTIME_init_manager = "systemd"
75DISTRO_FEATURES_BACKFILL_CONSIDERED = ""
76
77
78Starting up the system
79----------------------
80Most likely the reference policy selected will not just work "out of the box".
81
82As always, if you update the reference policy to better work with OpenEmbedded
83or Poky configurations, please submit the changes back to the project.
84
85When using 'core-image-selinux', the system will boot and automatically setup
86the policy by running the "fixfiles -f -F relabel" for you. This is
87implemented via the 'selinux-autorelabel' recipe.
88
89The 'core-image-selinux-minimal' does not automatically relabel the system.
90So you must boot using the parameters "selinux=1 enforcing=0", and then
91manually perform the setup. Running 'fixfiles -f -F relabel' is available
92in this configuration.
93
94After logging in you can verify selinux is present using:
95
96$ sestatus
97
98Output should include:
99SELinux status: enabled
100...
101Current mode: enforcing
102...
103
104The above indicates that selinux is currently running, and if you are running
105in an enforcing mode or not.
106
107
108License
109-------
110
111All metadata is MIT licensed unless otherwise stated. Source code included
112in tree for individual recipes is under the LICENSE stated in each recipe
113(.bb file) unless otherwise stated.
114
115This README document is Copyright (C) 2012 Wind River Systems, Inc.