|
|
f65af0 |
From 1a7538f0d73b4b35769c4df5ba32ed836e26a648 Mon Sep 17 00:00:00 2001
|
|
|
f65af0 |
From: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
f65af0 |
Date: Wed, 8 Aug 2018 13:04:04 +0300
|
|
|
f65af0 |
Subject: [PATCH] ipasam: do not use RC4 in FIPS mode
|
|
|
f65af0 |
|
|
|
f65af0 |
When creating Kerberos keys for trusted domain object account, ipasam
|
|
|
f65af0 |
module requests to generate keys using a series of well-known encryption
|
|
|
f65af0 |
types. In FIPS mode it is not possible to generate RC4-HMAC key:
|
|
|
f65af0 |
MIT Kerberos is using openssl crypto backend and openssl does not allow
|
|
|
f65af0 |
use of RC4 in FIPS mode.
|
|
|
f65af0 |
|
|
|
f65af0 |
Thus, we have to filter out RC4-HMAC encryption type when running in
|
|
|
f65af0 |
FIPS mode. A side-effect is that a trust to Active Directory running
|
|
|
f65af0 |
with Windows Server 2003 will not be possible anymore in FIPS mode.
|
|
|
f65af0 |
|
|
|
f65af0 |
Resolves: https://pagure.io/freeipa/issue/7659
|
|
|
f65af0 |
Reviewed-By: Robbie Harwood <rharwood@redhat.com>
|
|
|
f65af0 |
---
|
|
|
f65af0 |
daemons/ipa-sam/ipa_sam.c | 23 +++++++++++++++++++----
|
|
|
f65af0 |
1 file changed, 19 insertions(+), 4 deletions(-)
|
|
|
f65af0 |
|
|
|
f65af0 |
diff --git a/daemons/ipa-sam/ipa_sam.c b/daemons/ipa-sam/ipa_sam.c
|
|
|
f65af0 |
index 0cd48d845b2edf9f328de0a949f80f98f9ef9025..675a511f0febf13cc5e00b547c18a050ac534f2e 100644
|
|
|
f65af0 |
--- a/daemons/ipa-sam/ipa_sam.c
|
|
|
f65af0 |
+++ b/daemons/ipa-sam/ipa_sam.c
|
|
|
f65af0 |
@@ -213,6 +213,7 @@ struct ipasam_private {
|
|
|
f65af0 |
char *client_princ;
|
|
|
f65af0 |
struct sss_idmap_ctx *idmap_ctx;
|
|
|
f65af0 |
uint32_t supported_enctypes;
|
|
|
f65af0 |
+ bool fips_enabled;
|
|
|
f65af0 |
};
|
|
|
f65af0 |
|
|
|
f65af0 |
|
|
|
f65af0 |
@@ -1737,6 +1738,10 @@ static bool search_krb_princ(struct ipasam_private *ipasam_state,
|
|
|
f65af0 |
return true;
|
|
|
f65af0 |
}
|
|
|
f65af0 |
|
|
|
f65af0 |
+/* Please keep ENCTYPE_ARCFOUR_HMAC the last in the list
|
|
|
f65af0 |
+ * of the default encryption types so that we can exclude
|
|
|
f65af0 |
+ * it when running in a FIPS mode where it is not allowed
|
|
|
f65af0 |
+ */
|
|
|
f65af0 |
#define DEF_ENCTYPE_NUM 3
|
|
|
f65af0 |
long default_enctypes[DEF_ENCTYPE_NUM] = {
|
|
|
f65af0 |
ENCTYPE_AES256_CTS_HMAC_SHA1_96,
|
|
|
f65af0 |
@@ -1754,9 +1759,14 @@ static int set_cross_realm_pw(struct ipasam_private *ipasam_state,
|
|
|
f65af0 |
struct berval reqdata = { 0 };
|
|
|
f65af0 |
struct berval *retdata = NULL;
|
|
|
f65af0 |
char *retoid;
|
|
|
f65af0 |
+ int enctypes_num = DEF_ENCTYPE_NUM;
|
|
|
f65af0 |
|
|
|
f65af0 |
+ if (ipasam_state->fips_enabled) {
|
|
|
f65af0 |
+ DEBUG(1, ("FIPS mode enabled: TDO account credentials will not have RC4-HMAC!\n"));
|
|
|
f65af0 |
+ enctypes_num = DEF_ENCTYPE_NUM - 1;
|
|
|
f65af0 |
+ }
|
|
|
f65af0 |
ret = ipaasn1_enc_getkt(true, princ, pwd,
|
|
|
f65af0 |
- default_enctypes, DEF_ENCTYPE_NUM,
|
|
|
f65af0 |
+ default_enctypes, enctypes_num,
|
|
|
f65af0 |
&buffer, &buflen);
|
|
|
f65af0 |
if (!ret) goto done;
|
|
|
f65af0 |
|
|
|
f65af0 |
@@ -3935,7 +3945,9 @@ static NTSTATUS ipasam_get_enctypes(struct ipasam_private *ipasam_state,
|
|
|
f65af0 |
*enctypes |= KERB_ENCTYPE_DES_CBC_MD5;
|
|
|
f65af0 |
break;
|
|
|
f65af0 |
case ENCTYPE_ARCFOUR_HMAC:
|
|
|
f65af0 |
- *enctypes |= KERB_ENCTYPE_RC4_HMAC_MD5;
|
|
|
f65af0 |
+ if (!ipasam_state->fips_enabled) {
|
|
|
f65af0 |
+ *enctypes |= KERB_ENCTYPE_RC4_HMAC_MD5;
|
|
|
f65af0 |
+ }
|
|
|
f65af0 |
break;
|
|
|
f65af0 |
case ENCTYPE_AES128_CTS_HMAC_SHA1_96:
|
|
|
f65af0 |
*enctypes |= KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96;
|
|
|
f65af0 |
@@ -4563,6 +4575,7 @@ static NTSTATUS pdb_init_ipasam(struct pdb_methods **pdb_method,
|
|
|
f65af0 |
return NT_STATUS_INVALID_PARAMETER;
|
|
|
f65af0 |
}
|
|
|
f65af0 |
|
|
|
f65af0 |
+ ipasam_state->fips_enabled = ipapwd_fips_enabled();
|
|
|
f65af0 |
ipasam_state->trust_dn = talloc_asprintf(ipasam_state,
|
|
|
f65af0 |
"cn=ad,cn=trusts,%s",
|
|
|
f65af0 |
ipasam_state->base_dn);
|
|
|
f65af0 |
@@ -4684,9 +4697,11 @@ static NTSTATUS pdb_init_ipasam(struct pdb_methods **pdb_method,
|
|
|
f65af0 |
&enctypes);
|
|
|
f65af0 |
|
|
|
f65af0 |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
f65af0 |
- enctypes = KERB_ENCTYPE_RC4_HMAC_MD5 |
|
|
|
f65af0 |
- KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96 |
|
|
|
f65af0 |
+ enctypes = KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96 |
|
|
|
f65af0 |
KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96;
|
|
|
f65af0 |
+ if (!ipasam_state->fips_enabled) {
|
|
|
f65af0 |
+ enctypes |= KERB_ENCTYPE_RC4_HMAC_MD5;
|
|
|
f65af0 |
+ }
|
|
|
f65af0 |
}
|
|
|
f65af0 |
|
|
|
f65af0 |
ipasam_state->supported_enctypes = enctypes;
|
|
|
f65af0 |
--
|
|
|
f65af0 |
2.17.1
|
|
|
f65af0 |
|