Blame SOURCES/dhcp-4.2.5-additional_hmac_tsig.patch

a512de
commit 71c56235c6fbdeed3ba5a75bb379a34394106619
a512de
Author: Pavel Zhukov <pzhukov@redhat.com>
a512de
Date:   Mon Apr 10 12:59:07 2017 +0200
a512de
a512de
    Backported upstream commit e4a2cb79b2679738f56b3803a44c9899f6982c09
a512de
a512de
diff --git a/includes/omapip/isclib.h b/includes/omapip/isclib.h
a512de
index ddefeb5..4dffcb9 100644
a512de
--- a/includes/omapip/isclib.h
a512de
+++ b/includes/omapip/isclib.h
a512de
@@ -104,6 +104,11 @@ extern dhcp_context_t dhcp_gbl_ctx;
a512de
 #define DHCP_MAXDNS_WIRE 256
a512de
 #define DHCP_MAXNS         3
a512de
 #define DHCP_HMAC_MD5_NAME "HMAC-MD5.SIG-ALG.REG.INT."
a512de
+#define DHCP_HMAC_SHA1_NAME "HMAC-SHA1.SIG-ALG.REG.INT."
a512de
+#define DHCP_HMAC_SHA224_NAME "HMAC-SHA224.SIG-ALG.REG.INT."
a512de
+#define DHCP_HMAC_SHA256_NAME "HMAC-SHA256.SIG-ALG.REG.INT."
a512de
+#define DHCP_HMAC_SHA384_NAME "HMAC-SHA384.SIG-ALG.REG.INT."
a512de
+#define DHCP_HMAC_SHA512_NAME "HMAC-SHA512.SIG-ALG.REG.INT."
a512de
 
a512de
 isc_result_t dhcp_isc_name(unsigned char    *namestr,
a512de
 			   dns_fixedname_t  *namefix,
a512de
diff --git a/omapip/isclib.c b/omapip/isclib.c
a512de
index 1534dde..be1982e 100644
a512de
--- a/omapip/isclib.c
a512de
+++ b/omapip/isclib.c
a512de
@@ -198,21 +198,34 @@ isclib_make_dst_key(char          *inname,
a512de
 	dns_name_t *name;
a512de
 	dns_fixedname_t name0;
a512de
 	isc_buffer_t b;
a512de
+        unsigned int algorithm_code;
a512de
 
a512de
 	isc_buffer_init(&b, secret, length);
a512de
 	isc_buffer_add(&b, length);
a512de
 
a512de
-	/* We only support HMAC_MD5 currently */
a512de
-	if (strcasecmp(algorithm, DHCP_HMAC_MD5_NAME) != 0) {
a512de
+        if (strcasecmp(algorithm, DHCP_HMAC_MD5_NAME) == 0) {
a512de
+		algorithm_code =  DST_ALG_HMACMD5;
a512de
+	} else if (strcasecmp(algorithm, DHCP_HMAC_SHA1_NAME) == 0) {
a512de
+		algorithm_code =  DST_ALG_HMACSHA1;
a512de
+	} else if (strcasecmp(algorithm, DHCP_HMAC_SHA224_NAME) == 0) {
a512de
+		algorithm_code =  DST_ALG_HMACSHA224;
a512de
+	} else if (strcasecmp(algorithm, DHCP_HMAC_SHA256_NAME) == 0) {
a512de
+		algorithm_code =  DST_ALG_HMACSHA256;
a512de
+	} else if (strcasecmp(algorithm, DHCP_HMAC_SHA384_NAME) == 0) {
a512de
+		algorithm_code =  DST_ALG_HMACSHA384;
a512de
+	} else if (strcasecmp(algorithm, DHCP_HMAC_SHA512_NAME) == 0) {
a512de
+		algorithm_code =  DST_ALG_HMACSHA512;
a512de
+	} else {
a512de
 		return(DHCP_R_INVALIDARG);
a512de
 	}
a512de
 
a512de
+
a512de
 	result = dhcp_isc_name((unsigned char *)inname, &name0, &name);
a512de
 	if (result != ISC_R_SUCCESS) {
a512de
 		return(result);
a512de
 	}
a512de
 
a512de
-	return(dst_key_frombuffer(name, DST_ALG_HMACMD5, DNS_KEYOWNER_ENTITY,
a512de
+        return(dst_key_frombuffer(name, algorithm_code, DNS_KEYOWNER_ENTITY,
a512de
 				  DNS_KEYPROTO_DNSSEC, dns_rdataclass_in,
a512de
 				  &b, dhcp_gbl_ctx.mctx, dstkey));
a512de
 }
a512de
diff --git a/server/dhcpd.conf.5 b/server/dhcpd.conf.5
a512de
index 0cb50a6..74393c2 100644
a512de
--- a/server/dhcpd.conf.5
a512de
+++ b/server/dhcpd.conf.5
a512de
@@ -1398,6 +1398,18 @@ generate a key as seen above:
a512de
 	dnskeygen -H 128 -u -c -n DHCP_UPDATER
a512de
 .fi
a512de
 .PP
a512de
+The key name, algorithm, and secret must match that being used by the DNS
a512de
+server. The DHCP server currently supports the following algorithms:
a512de
+.nf
a512de
+
a512de
+        HMAC-MD5
a512de
+        HMAC-SHA1
a512de
+        HMAC-SHA224
a512de
+        HMAC-SHA256
a512de
+        HMAC-SHA384
a512de
+        HMAC-SHA512
a512de
+.fi
a512de
+.PP
a512de
 You may wish to enable logging of DNS updates on your DNS server.
a512de
 To do so, you might write a logging statement like the following:
a512de
 .PP