Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146433
b: refs/heads/master
c: 5789ba3
h: refs/heads/master
i:
  146431: 943ba7b
v: v3
  • Loading branch information
Eric Paris authored and James Morris committed May 21, 2009
1 parent 1d3609e commit 0e7fedc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5642f4bbae30122beb696e723f6da273caa570e
refs/heads/master: 5789ba3bd0a3cd20df5980ebf03358f2eb44fd67
6 changes: 6 additions & 0 deletions trunk/Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,12 @@ and is between 256 and 4096 characters. It is defined in the file
Formt: { "sha1" | "md5" }
default: "sha1"

ima_tcb [IMA]
Load a policy which meets the needs of the Trusted
Computing Base. This means IMA will measure all
programs exec'd, files mmap'd for exec, and all files
opened for read by uid=0.

in2000= [HW,SCSI]
See header of drivers/scsi/in2000.c.

Expand Down
30 changes: 27 additions & 3 deletions trunk/security/integrity/ima/ima_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@ struct ima_measure_rule_entry {
} lsm[MAX_LSM_RULES];
};

/* Without LSM specific knowledge, the default policy can only be
/*
* Without LSM specific knowledge, the default policy can only be
* written in terms of .action, .func, .mask, .fsmagic, and .uid
*/

/*
* The minimum rule set to allow for full TCB coverage. Measures all files
* opened or mmap for exec and everything read by root. Dangerous because
* normal users can easily run the machine out of memory simply building
* and running executables.
*/
static struct ima_measure_rule_entry default_rules[] = {
{.action = DONT_MEASURE,.fsmagic = PROC_SUPER_MAGIC,.flags = IMA_FSMAGIC},
{.action = DONT_MEASURE,.fsmagic = SYSFS_MAGIC,.flags = IMA_FSMAGIC},
Expand All @@ -59,6 +67,8 @@ static struct ima_measure_rule_entry default_rules[] = {
.flags = IMA_FUNC | IMA_MASK},
{.action = MEASURE,.func = BPRM_CHECK,.mask = MAY_EXEC,
.flags = IMA_FUNC | IMA_MASK},
{.action = MEASURE,.func = PATH_CHECK,.mask = MAY_READ,.uid = 0,
.flags = IMA_FUNC | IMA_MASK | IMA_UID},
};

static LIST_HEAD(measure_default_rules);
Expand All @@ -67,6 +77,14 @@ static struct list_head *ima_measure;

static DEFINE_MUTEX(ima_measure_mutex);

static bool ima_use_tcb __initdata;
static int __init default_policy_setup(char *str)
{
ima_use_tcb = 1;
return 1;
}
__setup("ima_tcb", default_policy_setup);

/**
* ima_match_rules - determine whether an inode matches the measure rule.
* @rule: a pointer to a rule
Expand Down Expand Up @@ -162,9 +180,15 @@ int ima_match_policy(struct inode *inode, enum ima_hooks func, int mask)
*/
void ima_init_policy(void)
{
int i;
int i, entries;

/* if !ima_use_tcb set entries = 0 so we load NO default rules */
if (ima_use_tcb)
entries = ARRAY_SIZE(default_rules);
else
entries = 0;

for (i = 0; i < ARRAY_SIZE(default_rules); i++)
for (i = 0; i < entries; i++)
list_add_tail(&default_rules[i].list, &measure_default_rules);
ima_measure = &measure_default_rules;
}
Expand Down

0 comments on commit 0e7fedc

Please sign in to comment.