summaryrefslogtreecommitdiffstats
path: root/recipes-security/refpolicy/refpolicy-minimum_2.20190201.bb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-security/refpolicy/refpolicy-minimum_2.20190201.bb')
-rw-r--r--recipes-security/refpolicy/refpolicy-minimum_2.20190201.bb81
1 files changed, 81 insertions, 0 deletions
diff --git a/recipes-security/refpolicy/refpolicy-minimum_2.20190201.bb b/recipes-security/refpolicy/refpolicy-minimum_2.20190201.bb
new file mode 100644
index 0000000..40abe35
--- /dev/null
+++ b/recipes-security/refpolicy/refpolicy-minimum_2.20190201.bb
@@ -0,0 +1,81 @@
1################################################################################
2# Note that -minimum specifically inherits from -targeted. Key policy pieces
3# will be missing if you do not preserve this relationship.
4include refpolicy-targeted_${PV}.bb
5
6SUMMARY = "SELinux minimum policy"
7DESCRIPTION = "\
8This is a minimum reference policy with just core policy modules, and \
9could be used as a base for customizing targeted policy. \
10Pretty much everything runs as initrc_t or unconfined_t so all of the \
11domains are unconfined. \
12"
13
14POLICY_NAME = "minimum"
15
16CORE_POLICY_MODULES = "unconfined \
17 selinuxutil \
18 storage \
19 sysnetwork \
20 application \
21 libraries \
22 miscfiles \
23 logging \
24 userdomain \
25 init \
26 mount \
27 modutils \
28 getty \
29 authlogin \
30 locallogin \
31 "
32#systemd dependent policy modules
33CORE_POLICY_MODULES += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'clock systemd udev fstools', '', d)}"
34
35# nscd caches libc-issued requests to the name service.
36# Without nscd.pp, commands want to use these caches will be blocked.
37EXTRA_POLICY_MODULES += "nscd"
38
39# pam_mail module enables checking and display of mailbox status upon
40# "login", so "login" process will access to /var/spool/mail.
41EXTRA_POLICY_MODULES += "mta"
42
43# sysnetwork requires type definitions (insmod_t, consoletype_t,
44# hostname_t, ping_t, netutils_t) from modules:
45EXTRA_POLICY_MODULES += "modutils consoletype hostname netutils"
46
47POLICY_MODULES_MIN = "${CORE_POLICY_MODULES} ${EXTRA_POLICY_MODULES}"
48
49# re-write the same func from refpolicy_common.inc
50prepare_policy_store () {
51 oe_runmake 'DESTDIR=${D}' 'prefix=${D}${prefix}' install
52 POL_PRIORITY=100
53 POL_SRC=${D}${datadir}/selinux/${POLICY_NAME}
54 POL_STORE=${D}${localstatedir}/lib/selinux/${POLICY_NAME}
55 POL_ACTIVE_MODS=${POL_STORE}/active/modules/${POL_PRIORITY}
56
57 # Prepare to create policy store
58 mkdir -p ${POL_STORE}
59 mkdir -p ${POL_ACTIVE_MODS}
60
61 # get hll type from suffix on base policy module
62 HLL_TYPE=$(echo ${POL_SRC}/base.* | awk -F . '{if (NF>1) {print $NF}}')
63 HLL_BIN=${STAGING_DIR_NATIVE}${prefix}/libexec/selinux/hll/${HLL_TYPE}
64
65 for i in base ${POLICY_MODULES_MIN}; do
66 MOD_FILE=${POL_SRC}/${i}.${HLL_TYPE}
67 MOD_DIR=${POL_ACTIVE_MODS}/${i}
68 mkdir -p ${MOD_DIR}
69 echo -n "${HLL_TYPE}" > ${MOD_DIR}/lang_ext
70
71 if ! bzip2 -t ${MOD_FILE} >/dev/null 2>&1; then
72 ${HLL_BIN} ${MOD_FILE} | bzip2 --stdout > ${MOD_DIR}/cil
73 bzip2 -f ${MOD_FILE} && mv -f ${MOD_FILE}.bz2 ${MOD_FILE}
74 else
75 bunzip2 --stdout ${MOD_FILE} | \
76 ${HLL_BIN} | \
77 bzip2 --stdout > ${MOD_DIR}/cil
78 fi
79 cp ${MOD_FILE} ${MOD_DIR}/hll
80 done
81}