summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-05-21 07:09:44 -0700
committerArmin Kuster <akuster808@gmail.com>2019-05-28 07:38:52 -0700
commitc84f39f8e09aabb479f7157765c3e3085c1e1109 (patch)
treeba319baee76e937d686b25e8ce779dcadb249809
parent8910674d19fa7bc806a68cea80c0038b01e39b61 (diff)
downloadmeta-security-c84f39f8e09aabb479f7157765c3e3085c1e1109.tar.gz
ima-policy-hashed: add new recipe
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-integrity/recipes-security/ima_policy_hashed/files/ima_policy_hashed77
-rw-r--r--meta-integrity/recipes-security/ima_policy_hashed/ima-policy-hashed_1.0.bb20
2 files changed, 97 insertions, 0 deletions
diff --git a/meta-integrity/recipes-security/ima_policy_hashed/files/ima_policy_hashed b/meta-integrity/recipes-security/ima_policy_hashed/files/ima_policy_hashed
new file mode 100644
index 0000000..7f89c8d
--- /dev/null
+++ b/meta-integrity/recipes-security/ima_policy_hashed/files/ima_policy_hashed
@@ -0,0 +1,77 @@
1# With this policy, all files on regular partitions are
2# appraised. Files with signed IMA hash and normal hash are
3# accepted. Signed files cannot be modified while hashed files can be
4# (which will also update the hash). However, signed files can
5# be deleted, so in practice it is still possible to replace them
6# with a modified version.
7#
8# Without EVM, this is obviously not very secure, so this policy is
9# just an example and/or basis for further improvements. For that
10# purpose, some comments show what could be added to make the policy
11# more secure.
12#
13# With EVM the situation might be different because access
14# to the EVM key can be restricted.
15#
16# Files which are appraised are also measured. This allows
17# debugging whether a file is in policy by looking at
18# /sys/kernel/security/ima/ascii_runtime_measurements
19
20# PROC_SUPER_MAGIC
21dont_appraise fsmagic=0x9fa0
22dont_measure fsmagic=0x9fa0
23# SYSFS_MAGIC
24dont_appraise fsmagic=0x62656572
25dont_measure fsmagic=0x62656572
26# DEBUGFS_MAGIC
27dont_appraise fsmagic=0x64626720
28dont_measure fsmagic=0x64626720
29# TMPFS_MAGIC
30dont_appraise fsmagic=0x01021994
31dont_measure fsmagic=0x01021994
32# RAMFS_MAGIC
33dont_appraise fsmagic=0x858458f6
34dont_measure fsmagic=0x858458f6
35# DEVPTS_SUPER_MAGIC
36dont_appraise fsmagic=0x1cd1
37dont_measure fsmagic=0x1cd1
38# BIFMT
39dont_appraise fsmagic=0x42494e4d
40dont_measure fsmagic=0x42494e4d
41# SECURITYFS_MAGIC
42dont_appraise fsmagic=0x73636673
43dont_measure fsmagic=0x73636673
44# SELINUXFS_MAGIC
45dont_appraise fsmagic=0xf97cff8c
46dont_measure fsmagic=0xf97cff8c
47# NSFS_MAGIC (introduced in 3.19, see cd025f7 and e149ed2 in the upstream Linux kernel)
48dont_appraise fsmagic=0x6e736673
49dont_measure fsmagic=0x6e736673
50# SMACK_MAGIC
51dont_appraise fsmagic=0x43415d53
52dont_measure fsmagic=0x43415d53
53# CGROUP_SUPER_MAGIC
54dont_appraise fsmagic=0x27e0eb
55dont_measure fsmagic=0x27e0eb
56# EFIVARFS_MAGIC
57dont_appraise fsmagic=0xde5e81e4
58dont_measure fsmagic=0xde5e81e4
59
60# Special partition, no checking done.
61# dont_measure fsuuid=a11234...
62# dont_appraise fsuuid=a11243...
63
64# Special immutable group.
65# appraise appraise_type=imasig func=FILE_CHECK mask=MAY_READ fgroup=200
66
67# All executables must be signed - too strict, we need to
68# allow installing executables on the device.
69# appraise appraise_type=imasig func=FILE_MMAP mask=MAY_EXEC
70# appraise appraise_type=imasig func=BPRM_CHECK mask=MAY_EXEC
71
72# Default rule. Would be needed also when other rules were added that
73# determine what to do in case of reading (mask=MAY_READ or
74# mask=MAY_EXEC) because otherwise writing does not update the file
75# hash.
76appraise
77measure
diff --git a/meta-integrity/recipes-security/ima_policy_hashed/ima-policy-hashed_1.0.bb b/meta-integrity/recipes-security/ima_policy_hashed/ima-policy-hashed_1.0.bb
new file mode 100644
index 0000000..3352daa
--- /dev/null
+++ b/meta-integrity/recipes-security/ima_policy_hashed/ima-policy-hashed_1.0.bb
@@ -0,0 +1,20 @@
1SUMMARY = "IMA sample hash policy"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4
5# This policy file will get installed as /etc/ima/ima-policy.
6# It is located via the normal file search path, so a .bbappend
7# to this recipe can just point towards one of its own files.
8IMA_POLICY ?= "ima_policy_hashed"
9
10SRC_URI = " \
11 file://${IMA_POLICY} \
12"
13
14do_install () {
15 install -d ${D}/${sysconfdir}/ima
16 install ${WORKDIR}/${IMA_POLICY} ${D}/${sysconfdir}/ima/ima-policy
17}
18
19FILES_${PN} = "${sysconfdir}/ima"
20RDEPENDS_${PN} = "ima-evm-utils"