814232
From a503519533eb375a5ce1f7566bfc153aac980d87 Mon Sep 17 00:00:00 2001
814232
From: Petr Mensik <pemensik@redhat.com>
814232
Date: Fri, 9 Jul 2021 20:52:21 +0200
814232
Subject: [PATCH] Use proper entropy to initialize tsig keyname
814232
814232
Random names used on GSS backed nsupdate can conflict in specific
814232
situations. That might include starting a lot of machines from
814232
containers, where they took all similar time to start. PID and timestamp
814232
would be similar and therefore randomness is quite low. Use entropy to
814232
generate more random identifier and reduce chance of conflict.
814232
---
814232
 bin/nsupdate/nsupdate.c | 4 +++-
814232
 1 file changed, 3 insertions(+), 1 deletion(-)
814232
814232
diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c
814232
index 458aa76..d9e5a2b 100644
814232
--- a/bin/nsupdate/nsupdate.c
814232
+++ b/bin/nsupdate/nsupdate.c
814232
@@ -2941,7 +2941,9 @@ start_gssrequest(dns_name_t *master) {
814232
 
814232
 	keyname = dns_fixedname_initname(&fkname);
814232
 
814232
-	isc_random_get(&val;;
814232
+	result = isc_entropy_getdata(entropy, &val, sizeof(val), NULL, 0);
814232
+	if (result != ISC_R_SUCCESS)
814232
+		isc_random_get(&val;;
814232
 	result = isc_string_printf(mykeystr, sizeof(mykeystr), "%u.sig-%s",
814232
 				   val, namestr);
814232
 	if (result != ISC_R_SUCCESS)
814232
-- 
814232
2.31.1
814232