Skip to content

Commit 33ce954

Browse files
author
Mimi Zohar
committed
ima: extend the "ima_policy" boot command line to support multiple policies
Add support for providing multiple builtin policies on the "ima_policy=" boot command line. Use "|" as the delimitor separating the policy names. Signed-off-by: Mimi Zohar <[email protected]>
1 parent cdac74d commit 33ce954

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,12 +1477,17 @@
14771477
in crypto/hash_info.h.
14781478

14791479
ima_policy= [IMA]
1480-
The builtin measurement policy to load during IMA
1481-
setup. Specyfing "tcb" as the value, measures all
1482-
programs exec'd, files mmap'd for exec, and all files
1483-
opened with the read mode bit set by either the
1484-
effective uid (euid=0) or uid=0.
1485-
Format: "tcb"
1480+
The builtin policies to load during IMA setup.
1481+
Format: "tcb | appraise_tcb"
1482+
1483+
The "tcb" policy measures all programs exec'd, files
1484+
mmap'd for exec, and all files opened with the read
1485+
mode bit set by either the effective uid (euid=0) or
1486+
uid=0.
1487+
1488+
The "appraise_tcb" policy appraises the integrity of
1489+
all files owned by root. (This is the equivalent
1490+
of ima_appraise_tcb.)
14861491

14871492
ima_tcb [IMA] Deprecated. Use ima_policy= instead.
14881493
Load a policy which meets the needs of the Trusted

security/integrity/ima/ima_policy.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,24 @@ static int __init default_measure_policy_setup(char *str)
170170
}
171171
__setup("ima_tcb", default_measure_policy_setup);
172172

173+
static bool ima_use_appraise_tcb __initdata;
173174
static int __init policy_setup(char *str)
174175
{
175-
if (ima_policy)
176-
return 1;
176+
char *p;
177177

178-
if (strcmp(str, "tcb") == 0)
179-
ima_policy = DEFAULT_TCB;
178+
while ((p = strsep(&str, " |\n")) != NULL) {
179+
if (*p == ' ')
180+
continue;
181+
if ((strcmp(p, "tcb") == 0) && !ima_policy)
182+
ima_policy = DEFAULT_TCB;
183+
else if (strcmp(p, "appraise_tcb") == 0)
184+
ima_use_appraise_tcb = 1;
185+
}
180186

181187
return 1;
182188
}
183189
__setup("ima_policy=", policy_setup);
184190

185-
static bool ima_use_appraise_tcb __initdata;
186191
static int __init default_appraise_policy_setup(char *str)
187192
{
188193
ima_use_appraise_tcb = 1;

0 commit comments

Comments
 (0)