summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2021-06-02 02:05:05 +0000
committerArmin Kuster <akuster808@gmail.com>2021-06-06 13:03:37 -0700
commitc1235f6affb5c38e64b3a04533b8388969b194b2 (patch)
tree08bc2b43e6b96e1f9b775de06240010586548272
parent34d6b479b894441931d8819d1f7a4a43e1fbee2e (diff)
downloadmeta-security-c1235f6affb5c38e64b3a04533b8388969b194b2.tar.gz
meta-security: add sanity check
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--README18
-rw-r--r--classes/sanity-meta-security.bbclass10
-rw-r--r--conf/layer.conf4
3 files changed, 32 insertions, 0 deletions
diff --git a/README b/README
index eb15366..4047b86 100644
--- a/README
+++ b/README
@@ -1,6 +1,24 @@
1Meta-security 1Meta-security
2============= 2=============
3 3
4The bbappend files for some recipes (e.g. linux-yocto) in this layer need
5to have 'security' in DISTRO_FEATURES to have effect.
6To enable them, add in configuration file the following line.
7
8 DISTRO_FEATURES_append = " security"
9
10If meta-security is included, but security is not enabled as a
11distro feature a warning is printed at parse time:
12
13 You have included the meta-security layer, but
14 'security' has not been enabled in your DISTRO_FEATURES. Some bbappend files
15 and preferred version setting may not take effect.
16
17If you know what you are doing, this warning can be disabled by setting the following
18variable in your configuration:
19
20 SKIP_META_SECURITY_SANITY_CHECK = 1
21
4This layer provides security tools, hardening tools for Linux kernels 22This layer provides security tools, hardening tools for Linux kernels
5and libraries for implementing security mechanisms. 23and libraries for implementing security mechanisms.
6 24
diff --git a/classes/sanity-meta-security.bbclass b/classes/sanity-meta-security.bbclass
new file mode 100644
index 0000000..b6c6b9c
--- /dev/null
+++ b/classes/sanity-meta-security.bbclass
@@ -0,0 +1,10 @@
1addhandler security_bbappend_distrocheck
2security_bbappend_distrocheck[eventmask] = "bb.event.SanityCheck"
3python security_bbappend_distrocheck() {
4 skip_check = e.data.getVar('SKIP_META_SECUIRTY_SANITY_CHECK') == "1"
5 if 'security' not in e.data.getVar('DISTRO_FEATURES').split() and not skip_check:
6 bb.warn("You have included the meta-security layer, but \
7'security' has not been enabled in your DISTRO_FEATURES. Some bbappend files \
8and preferred version setting may not take effect. See the meta-security README \
9for details on enabling security support.")
10}
diff --git a/conf/layer.conf b/conf/layer.conf
index 906e024..7853d6e 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -13,6 +13,10 @@ LAYERSERIES_COMPAT_security = "hardknott"
13 13
14LAYERDEPENDS_security = "core openembedded-layer perl-layer networking-layer meta-python" 14LAYERDEPENDS_security = "core openembedded-layer perl-layer networking-layer meta-python"
15 15
16# Sanity check for meta-security layer.
17# Setting SKIP_META_SECURITY_SANITY_CHECK to "1" would skip the bbappend files check.
18INHERIT += "sanity-meta-security"
19
16BBFILES_DYNAMIC += " \ 20BBFILES_DYNAMIC += " \
17rust-layer:${LAYERDIR}/dynamic-layers/meta-rust/recipes-*/*/*.bb \ 21rust-layer:${LAYERDIR}/dynamic-layers/meta-rust/recipes-*/*/*.bb \
18" 22"