IMA: Turn IMA_MEASURE_ASYMMETRIC_KEYS off by default
Subsystems (4)
PATCH 1/1 IMA: Turn IMA_MEASURE_ASYMMETRIC_KEYS off by default
Enabling IMA and ASYMMETRIC_PUBLIC_KEY_SUBTYPE configs will automatically enable the IMA hook to measure asymmetric keys. Keys created or updated early in the boot process are queued up whether or not a custom IMA policy is provided. Although the queued keys will be freed if a custom IMA policy is not loaded within 5 minutes, it could still cause significant performance impact on smaller systems.
This patch turns the config IMA_MEASURE_ASYMMETRIC_KEYS off by default. Since a custom IMA policy that defines key measurement is required to measure keys, systems that require key measurement can enable this config option in addition to providing a custom IMA policy.
--- security/integrity/ima/Kconfig | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
security/integrity/ima/Kconfig +14 -2
@@ -312,7 +312,19 @@ config IMA_APPRAISE_SIGNED_INIT This option requires user-space init to be signed. config IMA_MEASURE_ASYMMETRIC_KEYS - bool + bool "Enable asymmetric keys measurement on key create or update" depends on IMA depends on ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y - default y + default n + help + This option enables measuring asymmetric keys when the key + is created or updated. Additionally a custom IMA policy that + defines key measurement should also be loaded. + + If this option is enabled, keys created or updated early in + the boot process are queued up. The queued keys are processed + when a custom IMA policy is loaded. But if a custom IMA policy + is not loaded within 5 minutes after IMA subsystem is initialized, + any queued keys are just freed. Keys created or updated after + a custom IMA policy is loaded will be processed immediately and + not queued.
Signature · 1 line
2.17.1
James Bottomley
maintainerQuoted 6 lines · Lakshmi Ramasubramanian
Enabling IMA and
ASYMMETRIC_PUBLIC_KEY_SUBTYPEconfigs will automatically enable the IMA hook to measure asymmetric keys. Keys created or updated early in the boot process are queued up whether or not a custom IMA policy is provided. Although the queued keys will be freed if a custom IMA policy is not loaded within 5 minutes, it could still cause significant performance impact on smaller systems.
What exactly do you expect distributions to do with this? I can tell you that most of them will take the default option, so this gets set to N and you may as well not have got the patches upstream because you won't be able to use them in any distro with this setting.
Quoted 5 lines
This patch turns the config
IMA_MEASURE_ASYMMETRIC_KEYSoff by default. Since a custom IMA policy that defines key measurement is required to measure keys, systems that require key measurement can enable this config option in addition to providing a custom IMA policy.
Well, no they can't ... it's rather rare nowadays for people to build their own kernels. The vast majority of Linux consumers take what the distros give them. Think carefully before you decide a config option is the solution to this problem.
James
Quoted 4 lines · James Bottomley
What exactly do you expect distributions to do with this? I can tell you that most of them will take the default option, so this gets set to N and you may as well not have got the patches upstream because you won't be able to use them in any distro with this setting.
I agree - distros that are not sure or don't care about key measurement are anyway not going to choose this option. Only those that really care will opt in.
My goal is to not burden the vast majority of the users with this additional overhead if they don't need it - particularly, small systems such as embedded devices, etc.
Quoted 8 lines
Well, no they can't ... it's rather rare nowadays for people to build their own kernels. The vast majority of Linux consumers take what the distros give them. Think carefully before you decide a config option is the solution to this problem.
James
If you have suggestions for how I can handle it in a different way (other than config option), I'll be happy to try it out.
thanks,
-lakshmi
Mimi Zohar
maintainerQuoted 19 lines · James Bottomley
Quoted 6 lines · Lakshmi Ramasubramanian
Enabling IMA and
ASYMMETRIC_PUBLIC_KEY_SUBTYPEconfigs will automatically enable the IMA hook to measure asymmetric keys. Keys created or updated early in the boot process are queued up whether or not a custom IMA policy is provided. Although the queued keys will be freed if a custom IMA policy is not loaded within 5 minutes, it could still cause significant performance impact on smaller systems.What exactly do you expect distributions to do with this? I can tell you that most of them will take the default option, so this gets set to N and you may as well not have got the patches upstream because you won't be able to use them in any distro with this setting.
Quoted 5 lines
This patch turns the config
IMA_MEASURE_ASYMMETRIC_KEYSoff by default. Since a custom IMA policy that defines key measurement is required to measure keys, systems that require key measurement can enable this config option in addition to providing a custom IMA policy.
Quoted 4 lines
Well, no they can't ... it's rather rare nowadays for people to build their own kernels. The vast majority of Linux consumers take what the distros give them. Think carefully before you decide a config option is the solution to this problem.
James, up until now IMA could be configured, but there wouldn't be any performance penalty for enabling IMA until a policy was loaded. With IMA and asymmetric keys enabled, whether or not an IMA policy is loaded, certificates will be queued.
My concern is:
- changing the expected behavior
- really small devices/sensors being able to queue certificates
This change permits disabling queueing certificates. Whether the default should be "disabled" is a separate question. I'm open to comments/suggestions.
Mimi
James Bottomley
maintainerQuoted 27 lines · Mimi Zohar
Quoted 21 lines · James Bottomley
Quoted 7 lines · Lakshmi Ramasubramanian
Enabling IMA and
ASYMMETRIC_PUBLIC_KEY_SUBTYPEconfigs will automatically enable the IMA hook to measure asymmetric keys. Keys created or updated early in the boot process are queued up whether or not a custom IMA policy is provided. Although the queued keys will be freed if a custom IMA policy is not loaded within 5 minutes, it could still cause significant performance impact on smaller systems.What exactly do you expect distributions to do with this? I can tell you that most of them will take the default option, so this gets set to N and you may as well not have got the patches upstream because you won't be able to use them in any distro with this setting.
Quoted 5 lines
This patch turns the config
IMA_MEASURE_ASYMMETRIC_KEYSoff by default. Since a custom IMA policy that defines key measurement is required to measure keys, systems that require key measurement can enable this config option in addition to providing a custom IMA policy.Quoted 4 lines
Well, no they can't ... it's rather rare nowadays for people to build their own kernels. The vast majority of Linux consumers take what the distros give them. Think carefully before you decide a config option is the solution to this problem.
Quoted 7 lines
James, up until now IMA could be configured, but there wouldn't be any performance penalty for enabling IMA until a policy was loaded.
With IMA and asymmetric keys enabled, whether or not an IMA policy
is loaded, certificates will be queued.My concern is:
- changing the expected behavior
In general config options for this are a really bad idea because if the tools only cope with one setting, no-one should ever use the other and if they work with everything there's no need for the option.
Quoted 1 line
- really small devices/sensors being able to queue certificates
seems like the answer to this one would be don't queue. I realise it's after the submit design, but what about measuring when the key is added if there's a policy otherwise measure the keyring when the policy is added ... that way no queueing.
Quoted 3 lines
This change permits disabling queueing certificates. Whether the default should be "disabled" is a separate question. I'm open to comments/suggestions.
I'm just giving the general rule of thumb for boolean config options. If it's default Y there likely shouldn't be a config option and if it's default N the feature should likely not be in the kernel at all.
Quoted 6 lines · James Bottomley
Quoted 1 line
- really small devices/sensors being able to queue certificates
seems like the answer to this one would be don't queue. I realise it's after the submit design, but what about measuring when the key is added if there's a policy otherwise measure the keyring when the policy is added ... that way no queueing.
Without the "deferred key processing" changes, only keys added at runtime were measured (if policy permitted).
"deferred key processing" enabled queuing keys added early in the boot process and measured them when the policy is loaded.
We can make this (the queuing) optional through a config, but leave the runtime key measurement auto-enabled (as is the config IMA_MEASURE_ASYMMETRIC_KEYS now).
-lakshmi
Mimi Zohar
maintainerQuoted 12 lines · Lakshmi Ramasubramanian
Quoted 6 lines · James Bottomley
Quoted 1 line
- really small devices/sensors being able to queue certificates
seems like the answer to this one would be don't queue. I realise it's after the submit design, but what about measuring when the key is added if there's a policy otherwise measure the keyring when the policy is added ... that way no queueing.
Without the "deferred key processing" changes, only keys added at runtime were measured (if policy permitted).
Quoted 6 lines
"deferred key processing" enabled queuing keys added early in the boot process and measured them when the policy is loaded.
We can make this (the queuing) optional through a config, but leave the runtime key measurement auto-enabled (as is the config
IMA_MEASURE_ASYMMETRIC_KEYSnow).
Thanks, Lakshmi. This requires moving the code around. Instead of doing this on the current code base, I suggest posting a v9 version of the entire "IMA: Deferred measurement of keys".
I suggest making the switch from spinlock to mutex, as you had it originally, before posting v9. The commit history will then be a lot cleaner.
thanks,
Mimi
Quoted 5 lines · Mimi Zohar
Thanks, Lakshmi. This requires moving the code around. Instead of doing this on the current code base, I suggest posting a v9 version of the entire "IMA: Deferred measurement of keys".
Quoted 8 lines
I suggest making the switch from spinlock to mutex, as you had it originally, before posting v9. The commit history will then be a lot cleaner.
thanks,
Mimi
Sure Mimi - I'll post an update to the patch set shortly.
thanks,
-lakshmi
Mimi Zohar
maintainerQuoted 11 lines · Lakshmi Ramasubramanian
Quoted 9 lines · Mimi Zohar
Thanks, Lakshmi. This requires moving the code around. Instead of doing this on the current code base, I suggest posting a v9 version of the entire "IMA: Deferred measurement of keys".
I suggest making the switch from spinlock to mutex, as you had it originally, before posting v9. The commit history will then be a lot cleaner.
Quoted 6 lines
Quoted 4 lines
thanks,
Mimi
Sure Mimi - I'll post an update to the patch set shortly.
I just pushed out the next-integrity-testing branch without the "Deferred measurement of keys" patches. I've kept the "IMA: pre- allocate buffer to hold keyrings string" patch, though it probably isn't required.
thanks,
Mimi
Mimi Zohar
maintainerQuoted 9 lines · James Bottomley
Quoted 3 lines · Mimi Zohar
This change permits disabling queueing certificates. Whether the default should be "disabled" is a separate question. I'm open to comments/suggestions.
I'm just giving the general rule of thumb for boolean config options. If it's default Y there likely shouldn't be a config option and if it's default N the feature should likely not be in the kernel at all.
Thanks, James. I'll keep this in mind when debating about defining a new Kconfig option.
Mimi