linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ima: Allow to import the blacklisted cert signed by secondary CA cert
@ 2019-08-01  1:23 Jia Zhang
  2019-08-01 22:57 ` Mimi Zohar
  0 siblings, 1 reply; 4+ messages in thread
From: Jia Zhang @ 2019-08-01  1:23 UTC (permalink / raw)
  To: dhowells, zohar, dmitry.kasatkin
  Cc: keyrings, linux-security-module, linux-integrity, linux-kernel,
	zhang.jia

Similar to .ima, the cert imported to .ima_blacklist is able to be
authenticated by a secondary CA cert.

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
---
 include/keys/system_keyring.h    | 6 ++++++
 security/integrity/digsig.c      | 6 ------
 security/integrity/ima/ima_mok.c | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
index c1a96fd..7dc91db 100644
--- a/include/keys/system_keyring.h
+++ b/include/keys/system_keyring.h
@@ -31,6 +31,12 @@ extern int restrict_link_by_builtin_and_secondary_trusted(
 #define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted
 #endif
 
+#ifdef CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY
+#define restrict_link_to_ima restrict_link_by_builtin_and_secondary_trusted
+#else
+#define restrict_link_to_ima restrict_link_by_builtin_trusted
+#endif
+
 #ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
 extern int mark_hash_blacklisted(const char *hash);
 extern int is_hash_blacklisted(const u8 *hash, size_t hash_len,
diff --git a/security/integrity/digsig.c b/security/integrity/digsig.c
index 868ade3..c6f3384 100644
--- a/security/integrity/digsig.c
+++ b/security/integrity/digsig.c
@@ -33,12 +33,6 @@
 	".platform",
 };
 
-#ifdef CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY
-#define restrict_link_to_ima restrict_link_by_builtin_and_secondary_trusted
-#else
-#define restrict_link_to_ima restrict_link_by_builtin_trusted
-#endif
-
 int integrity_digsig_verify(const unsigned int id, const char *sig, int siglen,
 			    const char *digest, int digestlen)
 {
diff --git a/security/integrity/ima/ima_mok.c b/security/integrity/ima/ima_mok.c
index 36cadad..6d0b12d 100644
--- a/security/integrity/ima/ima_mok.c
+++ b/security/integrity/ima/ima_mok.c
@@ -31,7 +31,7 @@ __init int ima_mok_init(void)
 	if (!restriction)
 		panic("Can't allocate IMA blacklist restriction.");
 
-	restriction->check = restrict_link_by_builtin_trusted;
+	restriction->check = restrict_link_to_ima;
 
 	ima_blacklist_keyring = keyring_alloc(".ima_blacklist",
 				KUIDT_INIT(0), KGIDT_INIT(0), current_cred(),
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ima: Allow to import the blacklisted cert signed by secondary CA cert
  2019-08-01  1:23 [PATCH] ima: Allow to import the blacklisted cert signed by secondary CA cert Jia Zhang
@ 2019-08-01 22:57 ` Mimi Zohar
  2019-08-02  1:42   ` Jia Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Mimi Zohar @ 2019-08-01 22:57 UTC (permalink / raw)
  To: Jia Zhang, dhowells, dmitry.kasatkin
  Cc: keyrings, linux-security-module, linux-integrity, linux-kernel,
	Mark D. Baushke, Petko Manolov

Hi Jia,

On Thu, 2019-08-01 at 09:23 +0800, Jia Zhang wrote:
> Similar to .ima, the cert imported to .ima_blacklist is able to be
> authenticated by a secondary CA cert.
> 
> Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>

The IMA blacklist, which is defined as experimental for a reason, was
upstreamed prior to the system blacklist.  Any reason you're not using
the system blacklist?  Before making this sort of change, I'd like
some input from others.

thanks,

Mimi


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ima: Allow to import the blacklisted cert signed by secondary CA cert
  2019-08-01 22:57 ` Mimi Zohar
@ 2019-08-02  1:42   ` Jia Zhang
  2019-08-05 14:28     ` Mimi Zohar
  0 siblings, 1 reply; 4+ messages in thread
From: Jia Zhang @ 2019-08-02  1:42 UTC (permalink / raw)
  To: Mimi Zohar, dhowells, dmitry.kasatkin
  Cc: keyrings, linux-security-module, linux-integrity, linux-kernel,
	Mark D. Baushke, Petko Manolov



On 2019/8/2 上午6:57, Mimi Zohar wrote:
> Hi Jia,
> 
> On Thu, 2019-08-01 at 09:23 +0800, Jia Zhang wrote:
>> Similar to .ima, the cert imported to .ima_blacklist is able to be
>> authenticated by a secondary CA cert.
>>
>> Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
> 
> The IMA blacklist, which is defined as experimental for a reason, was
> upstreamed prior to the system blacklist.  Any reason you're not using
> the system blacklist?  Before making this sort of change, I'd like
> some input from others.

In our trusted cloud service, the IMA private key is controlled by
tenant for some reason. Some unprofessional operations made by tenant
may lead to the leakage of IMA private key. So the need for importing
the blacklisted is necessary,without system/kexec reboot, on the
contrary, the system blacklist needs a kernel rebuild and system/kexec
reboot, without runtime and fine-grained control.

The secondary CA cert has a similar story, but it is not controlled by
tenant. It is always imported during system/kexec boot to serve
importing IMA trusted cert and IMA blacklisted cert.

Jia

> 
> thanks,
> 
> Mimi
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ima: Allow to import the blacklisted cert signed by secondary CA cert
  2019-08-02  1:42   ` Jia Zhang
@ 2019-08-05 14:28     ` Mimi Zohar
  0 siblings, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2019-08-05 14:28 UTC (permalink / raw)
  To: Jia Zhang, dhowells, dmitry.kasatkin
  Cc: keyrings, linux-security-module, linux-integrity, linux-kernel,
	Mark D. Baushke, Petko Manolov

On Fri, 2019-08-02 at 09:42 +0800, Jia Zhang wrote:
> 
> On 2019/8/2 上午6:57, Mimi Zohar wrote:
> > Hi Jia,
> > 
> > On Thu, 2019-08-01 at 09:23 +0800, Jia Zhang wrote:
> >> Similar to .ima, the cert imported to .ima_blacklist is able to be
> >> authenticated by a secondary CA cert.
> >>
> >> Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
> > 
> > The IMA blacklist, which is defined as experimental for a reason, was
> > upstreamed prior to the system blacklist.  Any reason you're not using
> > the system blacklist?  Before making this sort of change, I'd like
> > some input from others.
> 
> In our trusted cloud service, the IMA private key is controlled by
> tenant for some reason. Some unprofessional operations made by tenant
> may lead to the leakage of IMA private key. So the need for importing
> the blacklisted is necessary,without system/kexec reboot, on the
> contrary, the system blacklist needs a kernel rebuild and system/kexec
> reboot, without runtime and fine-grained control.
> 
> The secondary CA cert has a similar story, but it is not controlled by
> tenant. It is always imported during system/kexec boot to serve
> importing IMA trusted cert and IMA blacklisted cert.

Before expanding the set of keys permitted to blacklist a key on the
IMA keyring, there needs to be a way of differentiating how keys may
be used.  The same certificate should not be allowed to be loaded onto
both the IMA and the IMA blacklist keyrings for obvious reasons.

The normal way of blacklisting a key is by using CRLs.  I'm not
recommending adding full CRL support in the kernel, but using the key
usage extension to differentiate who may sign a certificate being
black listed.  Please refer to section "4.2.1.3.  Key Usage", in
particular the cRLSign bit.

thanks,

Mimi


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-05 14:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01  1:23 [PATCH] ima: Allow to import the blacklisted cert signed by secondary CA cert Jia Zhang
2019-08-01 22:57 ` Mimi Zohar
2019-08-02  1:42   ` Jia Zhang
2019-08-05 14:28     ` Mimi Zohar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).