diff options
author | David Howells <dhowells@redhat.com> | 2005-10-30 18:02:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 20:37:23 -0500 |
commit | 29db9190634067c5a328ee5fcc2890251b836b4b (patch) | |
tree | 07ec242789230824f1fa8bcbbe681fd5bf166fa8 /include/linux/key.h | |
parent | 2aa349f6e37ce030060c994d3aebbff4ab703565 (diff) |
[PATCH] Keys: Add LSM hooks for key management [try #3]
The attached patch adds LSM hooks for key management facilities. The notable
changes are:
(1) The key struct now supports a security pointer for the use of security
modules. This will permit key labelling and restrictions on which
programs may access a key.
(2) Security modules get a chance to note (or abort) the allocation of a key.
(3) The key permission checking can now be enhanced by the security modules;
the permissions check consults LSM if all other checks bear out.
(4) The key permissions checking functions now return an error code rather
than a boolean value.
(5) An extra permission has been added to govern the modification of
attributes (UID, GID, permissions).
Note that there isn't an LSM hook specifically for each keyctl() operation,
but rather the permissions hook allows control of individual operations based
on the permission request bits.
Key management access control through LSM is enabled by automatically if both
CONFIG_KEYS and CONFIG_SECURITY are enabled.
This should be applied on top of the patch ensubjected:
[PATCH] Keys: Possessor permissions should be additive
Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/key.h')
-rw-r--r-- | include/linux/key.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/linux/key.h b/include/linux/key.h index f1efa016dbf3..53513a3be53b 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -40,28 +40,32 @@ struct key; | |||
40 | #define KEY_POS_WRITE 0x04000000 /* possessor can update key payload / add link to keyring */ | 40 | #define KEY_POS_WRITE 0x04000000 /* possessor can update key payload / add link to keyring */ |
41 | #define KEY_POS_SEARCH 0x08000000 /* possessor can find a key in search / search a keyring */ | 41 | #define KEY_POS_SEARCH 0x08000000 /* possessor can find a key in search / search a keyring */ |
42 | #define KEY_POS_LINK 0x10000000 /* possessor can create a link to a key/keyring */ | 42 | #define KEY_POS_LINK 0x10000000 /* possessor can create a link to a key/keyring */ |
43 | #define KEY_POS_ALL 0x1f000000 | 43 | #define KEY_POS_SETATTR 0x20000000 /* possessor can set key attributes */ |
44 | #define KEY_POS_ALL 0x3f000000 | ||
44 | 45 | ||
45 | #define KEY_USR_VIEW 0x00010000 /* user permissions... */ | 46 | #define KEY_USR_VIEW 0x00010000 /* user permissions... */ |
46 | #define KEY_USR_READ 0x00020000 | 47 | #define KEY_USR_READ 0x00020000 |
47 | #define KEY_USR_WRITE 0x00040000 | 48 | #define KEY_USR_WRITE 0x00040000 |
48 | #define KEY_USR_SEARCH 0x00080000 | 49 | #define KEY_USR_SEARCH 0x00080000 |
49 | #define KEY_USR_LINK 0x00100000 | 50 | #define KEY_USR_LINK 0x00100000 |
50 | #define KEY_USR_ALL 0x001f0000 | 51 | #define KEY_USR_SETATTR 0x00200000 |
52 | #define KEY_USR_ALL 0x003f0000 | ||
51 | 53 | ||
52 | #define KEY_GRP_VIEW 0x00000100 /* group permissions... */ | 54 | #define KEY_GRP_VIEW 0x00000100 /* group permissions... */ |
53 | #define KEY_GRP_READ 0x00000200 | 55 | #define KEY_GRP_READ 0x00000200 |
54 | #define KEY_GRP_WRITE 0x00000400 | 56 | #define KEY_GRP_WRITE 0x00000400 |
55 | #define KEY_GRP_SEARCH 0x00000800 | 57 | #define KEY_GRP_SEARCH 0x00000800 |
56 | #define KEY_GRP_LINK 0x00001000 | 58 | #define KEY_GRP_LINK 0x00001000 |
57 | #define KEY_GRP_ALL 0x00001f00 | 59 | #define KEY_GRP_SETATTR 0x00002000 |
60 | #define KEY_GRP_ALL 0x00003f00 | ||
58 | 61 | ||
59 | #define KEY_OTH_VIEW 0x00000001 /* third party permissions... */ | 62 | #define KEY_OTH_VIEW 0x00000001 /* third party permissions... */ |
60 | #define KEY_OTH_READ 0x00000002 | 63 | #define KEY_OTH_READ 0x00000002 |
61 | #define KEY_OTH_WRITE 0x00000004 | 64 | #define KEY_OTH_WRITE 0x00000004 |
62 | #define KEY_OTH_SEARCH 0x00000008 | 65 | #define KEY_OTH_SEARCH 0x00000008 |
63 | #define KEY_OTH_LINK 0x00000010 | 66 | #define KEY_OTH_LINK 0x00000010 |
64 | #define KEY_OTH_ALL 0x0000001f | 67 | #define KEY_OTH_SETATTR 0x00000020 |
68 | #define KEY_OTH_ALL 0x0000003f | ||
65 | 69 | ||
66 | struct seq_file; | 70 | struct seq_file; |
67 | struct user_struct; | 71 | struct user_struct; |
@@ -119,6 +123,7 @@ struct key { | |||
119 | struct key_type *type; /* type of key */ | 123 | struct key_type *type; /* type of key */ |
120 | struct rw_semaphore sem; /* change vs change sem */ | 124 | struct rw_semaphore sem; /* change vs change sem */ |
121 | struct key_user *user; /* owner of this key */ | 125 | struct key_user *user; /* owner of this key */ |
126 | void *security; /* security data for this key */ | ||
122 | time_t expiry; /* time at which key expires (or 0) */ | 127 | time_t expiry; /* time at which key expires (or 0) */ |
123 | uid_t uid; | 128 | uid_t uid; |
124 | gid_t gid; | 129 | gid_t gid; |