Blame SOURCES/dhcp-4.2.5-additional_hmac_tsig.patch

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