forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IMA: create machine owner and blacklist keyrings
This option creates IMA MOK and blacklist keyrings. IMA MOK is an intermediate keyring that sits between .system and .ima keyrings, effectively forming a simple CA hierarchy. To successfully import a key into .ima_mok it must be signed by a key which CA is in .system keyring. On turn any key that needs to go in .ima keyring must be signed by CA in either .system or .ima_mok keyrings. IMA MOK is empty at kernel boot. IMA blacklist keyring contains all revoked IMA keys. It is consulted before any other keyring. If the search is successful the requested operation is rejected and error is returned to the caller. Signed-off-by: Petko Manolov <[email protected]> Signed-off-by: Mimi Zohar <[email protected]>
- Loading branch information
Petko Manolov
authored and
Mimi Zohar
committed
Dec 15, 2015
1 parent
38d859f
commit 41c89b6
Showing
6 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (C) 2015 Juniper Networks, Inc. | ||
* | ||
* Author: | ||
* Petko Manolov <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, version 2 of the | ||
* License. | ||
* | ||
*/ | ||
|
||
#include <linux/export.h> | ||
#include <linux/kernel.h> | ||
#include <linux/sched.h> | ||
#include <linux/cred.h> | ||
#include <linux/err.h> | ||
#include <linux/module.h> | ||
#include <keys/asymmetric-type.h> | ||
|
||
|
||
struct key *ima_mok_keyring; | ||
struct key *ima_blacklist_keyring; | ||
|
||
/* | ||
* Allocate the IMA MOK and blacklist keyrings | ||
*/ | ||
__init int ima_mok_init(void) | ||
{ | ||
pr_notice("Allocating IMA MOK and blacklist keyrings.\n"); | ||
|
||
ima_mok_keyring = keyring_alloc(".ima_mok", | ||
KUIDT_INIT(0), KGIDT_INIT(0), current_cred(), | ||
(KEY_POS_ALL & ~KEY_POS_SETATTR) | | ||
KEY_USR_VIEW | KEY_USR_READ | | ||
KEY_USR_WRITE | KEY_USR_SEARCH, | ||
KEY_ALLOC_NOT_IN_QUOTA, NULL); | ||
|
||
ima_blacklist_keyring = keyring_alloc(".ima_blacklist", | ||
KUIDT_INIT(0), KGIDT_INIT(0), current_cred(), | ||
(KEY_POS_ALL & ~KEY_POS_SETATTR) | | ||
KEY_USR_VIEW | KEY_USR_READ | | ||
KEY_USR_WRITE | KEY_USR_SEARCH, | ||
KEY_ALLOC_NOT_IN_QUOTA, NULL); | ||
|
||
if (IS_ERR(ima_mok_keyring) || IS_ERR(ima_blacklist_keyring)) | ||
panic("Can't allocate IMA MOK or blacklist keyrings."); | ||
set_bit(KEY_FLAG_TRUSTED_ONLY, &ima_mok_keyring->flags); | ||
set_bit(KEY_FLAG_TRUSTED_ONLY, &ima_blacklist_keyring->flags); | ||
return 0; | ||
} | ||
|
||
module_init(ima_mok_init); |