Measure public keys of BuiltIn Trusted Keys
Subsystems (6)
PATCH 2/2 Measure public keys of BuiltIn Trusted Keys
During IMA initialization, the keys in "BuiltIn Trusted Keys" will be enumerated and public key of those keys and key description will be extracted, and measured to IMA log.
"[PATCH 1/2] [IMA] Measure public keys of BuiltIn Trusted Keys - Query public key of given key" will be used here.
An attestation service will validate that the client machine had only known good\trusted keys in its "Trusted Keys" keyring. Note that the attestation service will receive the list of "Trusted Keys" from a trustworthy source (which is different from the client machines that are being attested). Attesting the "Trusted Keys" in turn attests the "IMA Signer Key(s)" that were used on the client.
--- certs/system_keyring.c | 7 +++ include/keys/system_keyring.h | 9 ++++ include/linux/key.h | 32 ++++++++++++ security/integrity/digsig.c | 58 ++++++++++++++++++++++ security/integrity/ima/Kconfig | 9 ++++ security/integrity/ima/ima_init.c | 62 +++++++++++++++++++++++ security/integrity/integrity.h | 25 ++++++++++ security/keys/keyring.c | 82 +++++++++++++++++++++++++++++++ 8 files changed, 284 insertions(+)
certs/system_keyring.c +7 -0
@@ -287,3 +287,10 @@ void __init set_platform_trusted_keys(struct key *keyring) platform_trusted_keys = keyring; }#endif + +#ifdef CONFIG_IMA_MEASURE_TRUSTED_KEYS +struct key *get_builtin_trusted_keys (void ) +{ +return builtin_trusted_keys; +} +#endif /* CONFIG_IMA_MEASURE_TRUSTED_KEYS */
include/keys/system_keyring.h +9 -0
@@ -70,4 +70,13 @@ static inline void set_platform_trusted_keys(struct key *keyring) }#endif +#ifdef CONFIG_IMA_MEASURE_TRUSTED_KEYS +extern struct key *get_builtin_trusted_keys (void ); +#else +static struct key *get_builtin_trusted_keys (void ) +{ +return NULL ; +} +#endif /* CONFIG_IMA_MEASURE_TRUSTED_KEYS */ +#endif /* _KEYS_SYSTEM_KEYRING_H */
include/linux/key.h +32 -0
@@ -349,6 +349,38 @@ extern void key_set_timeout(struct key *, unsigned);extern key_ref_t lookup_user_key (key_serial_t id,unsigned long flags,key_perm_t perm); +/* +* Context data used to iterate through the keys in a keyring +* and read the key references into an array. +* +* keyring_keys_count - Number of keys in keyring_keys array +* keyring_keys_size - Max number of keys in keyring_keys array +* keyring_keys - Array containing keys read from the keyring +*/ +struct keyring_keys_read_context { +size_t keyring_keys_size; +size_t keyring_keys_count; +const struct key *keyring_keys[0 ]; +}; + +#ifdef CONFIG_IMA_MEASURE_TRUSTED_KEYS +extern long keyring_read_keys (const struct key *keyring, +struct keyring_keys_read_context **ctx); +extern long keyring_read_builtin_trusted_keys ( +struct keyring_keys_read_context **ctx); +#else +static inline long keyring_read_keys (const struct key *keyring, +struct keyring_keys_read_context **ctx) +{ +return -EOPNOTSUPP ; +} +static inline long keyring_read_builtin_trusted_keys ( +struct keyring_keys_read_context **ctx) +{ +return -EOPNOTSUPP ; +} +#endif /* CONFIG_IMA_MEASURE_TRUSTED_KEYS */ +/* * The permissions required on a key that we're looking up. */
security/integrity/digsig.c +58 -0
61 lines not on this page · raw message
security/integrity/ima/Kconfig +9 -0
@@ -295,3 +295,12 @@ config IMA_APPRAISE_SIGNED_INIT default n help This option requires user-space init to be signed. + +config IMA_MEASURE_TRUSTED_KEYS + bool "Measure the public keys of trusted keys" + depends on IMA + default n + help + This option enables keys in keyrings such as + Builtin Trusted Keys, IMA, Platform, etc. to + be measured during IMA initialization
security/integrity/ima/ima_init.c +62 -0
74 lines not on this page · raw message
security/integrity/integrity.h +25 -0
@@ -242,3 +242,28 @@ static inline void __init add_to_platform_keyring(const char *source, { }#endif + +#ifdef CONFIG_IMA_MEASURE_TRUSTED_KEYS +int __init ima_add_trusted_keyring_keys (int (*store_trusted_key)( +void *key, +u32 keylen, +const char *key_description)); + +int __init store_trusted_keyring_key (void *key, +u32 keylen, +const char *key_description); +#else +static int __init ima_add_trusted_keyring_keys (int (*store_trusted_key)( +void *key, +u32 keylen, +const char *key_description)) +{ +return -EOPNOTSUPP ; +} +static int __init store_trusted_keyring_key (void *key, +u32 keylen, +const char *key_description) +{ +return -EOPNOTSUPP ; +} +#endif /* CONFIG_IMA_MEASURE_TRUSTED_KEYS */
security/keys/keyring.c +82 -0
91 lines not on this page · raw message
Signature · 1 line
2.17.1