8145473
From 2b0dce163a119f5f62eb4428b485f7575f321d6f Mon Sep 17 00:00:00 2001
dab22dd
From: Petr Mensik <pemensik@redhat.com>
dab22dd
Date: Mon, 5 Aug 2019 11:54:03 +0200
dab22dd
Subject: [PATCH] Allow explicit disabling of autodisabled MD5
dab22dd
dab22dd
Default security policy might include explicitly disabled RSAMD5
dab22dd
algorithm. Current FIPS code automatically disables in FIPS mode. But if
dab22dd
RSAMD5 is included in security policy, it fails to start, because that
dab22dd
algorithm is not recognized. Allow it disabled, but fail on any
dab22dd
other usage.
dab22dd
---
8145473
 bin/named/server.c | 4 ++--
8145473
 lib/bind9/check.c  | 4 ++++
8145473
 lib/dns/rcode.c    | 1 +
8145473
 3 files changed, 7 insertions(+), 2 deletions(-)
dab22dd
dab22dd
diff --git a/bin/named/server.c b/bin/named/server.c
8145473
index ee23f10..22a5c01 100644
dab22dd
--- a/bin/named/server.c
dab22dd
+++ b/bin/named/server.c
8145473
@@ -1689,12 +1689,12 @@ disable_algorithms(const cfg_obj_t *disabled, dns_resolver_t *resolver) {
6f27f8e
 		r.length = strlen(r.base);
6f27f8e
 
6f27f8e
 		result = dns_secalg_fromtext(&alg, &r);
6f27f8e
-		if (result != ISC_R_SUCCESS) {
6f27f8e
+		if (result != ISC_R_SUCCESS && result != ISC_R_DISABLED) {
6f27f8e
 			uint8_t ui;
dab22dd
 			result = isc_parse_uint8(&ui, r.base, 10);
dab22dd
 			alg = ui;
dab22dd
 		}
dab22dd
-		if (result != ISC_R_SUCCESS) {
dab22dd
+		if (result != ISC_R_SUCCESS && result != ISC_R_DISABLED) {
8145473
 			cfg_obj_log(cfg_listelt_value(element), named_g_lctx,
8145473
 				    ISC_LOG_ERROR, "invalid algorithm");
8145473
 			CHECK(result);
6f27f8e
diff --git a/lib/bind9/check.c b/lib/bind9/check.c
8145473
index f49a346..dbf9ddb 100644
6f27f8e
--- a/lib/bind9/check.c
6f27f8e
+++ b/lib/bind9/check.c
8145473
@@ -317,6 +317,10 @@ disabled_algorithms(const cfg_obj_t *disabled, isc_log_t *logctx) {
6f27f8e
 		r.length = strlen(r.base);
6f27f8e
 
6f27f8e
 		tresult = dns_secalg_fromtext(&alg, &r);
6f27f8e
+		if (tresult == ISC_R_DISABLED) {
6f27f8e
+			// Recognize disabled algorithms, disable it explicitly
6f27f8e
+			tresult = ISC_R_SUCCESS;
6f27f8e
+		}
6f27f8e
 		if (tresult != ISC_R_SUCCESS) {
6f27f8e
 			cfg_obj_log(cfg_listelt_value(element), logctx,
6f27f8e
 				    ISC_LOG_ERROR, "invalid algorithm '%s'",
dab22dd
diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c
8145473
index 327248e..78adf63 100644
dab22dd
--- a/lib/dns/rcode.c
dab22dd
+++ b/lib/dns/rcode.c
8145473
@@ -152,6 +152,7 @@ static struct tbl rcodes[] = { RCODENAMES ERCODENAMES };
dab22dd
 static struct tbl tsigrcodes[] = { RCODENAMES TSIGRCODENAMES };
dab22dd
 static struct tbl certs[] = { CERTNAMES };
dab22dd
 static struct tbl secalgs[] = { SECALGNAMES };
dab22dd
+static struct tbl md5_secalgs[] = { MD5_SECALGNAMES };
dab22dd
 static struct tbl secprotos[] = { SECPROTONAMES };
dab22dd
 static struct tbl hashalgs[] = { HASHALGNAMES };
dab22dd
 static struct tbl dsdigests[] = { DSDIGESTNAMES };
dab22dd
-- 
8145473
2.21.1
dab22dd