|
|
376cca |
From ebbc83c1ca52620179d94dc1d92c44883273e4ef Mon Sep 17 00:00:00 2001
|
|
|
376cca |
From: jmaloy <jmaloy@redhat.com>
|
|
|
376cca |
Date: Thu, 28 May 2020 08:44:02 +0200
|
|
|
376cca |
Subject: [PATCH 2/4] utils: use SystemRandom when generating random password.
|
|
|
376cca |
(#204)
|
|
|
376cca |
|
|
|
376cca |
RH-Author: jmaloy <jmaloy@redhat.com>
|
|
|
376cca |
Message-id: <20200313184329.16696-2-jmaloy@redhat.com>
|
|
|
376cca |
Patchwork-id: 94294
|
|
|
376cca |
O-Subject: [RHEL-8.2 cloud-init PATCH 1/1] utils: use SystemRandom when generating random password. (#204)
|
|
|
376cca |
Bugzilla: 1812174
|
|
|
376cca |
RH-Acked-by: Eduardo Otubo <eterrell@redhat.com>
|
|
|
376cca |
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
376cca |
RH-Acked-by: Mohammed Gamal <mgamal@redhat.com>
|
|
|
376cca |
|
|
|
376cca |
From: Dimitri John Ledkov <xnox@ubuntu.com>
|
|
|
376cca |
|
|
|
376cca |
As noticed by Seth Arnold, non-deterministic SystemRandom should be
|
|
|
376cca |
used when creating security sensitive random strings.
|
|
|
376cca |
|
|
|
376cca |
(cherry picked from commit 3e2f7356effc9e9cccc5ae945846279804eedc46)
|
|
|
376cca |
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
|
|
|
376cca |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
376cca |
---
|
|
|
376cca |
cloudinit/util.py | 3 ++-
|
|
|
376cca |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
376cca |
|
|
|
376cca |
diff --git a/cloudinit/util.py b/cloudinit/util.py
|
|
|
376cca |
index 9d9d5c7..5d51ba8 100644
|
|
|
376cca |
--- a/cloudinit/util.py
|
|
|
376cca |
+++ b/cloudinit/util.py
|
|
|
376cca |
@@ -401,9 +401,10 @@ def translate_bool(val, addons=None):
|
|
|
376cca |
|
|
|
376cca |
|
|
|
376cca |
def rand_str(strlen=32, select_from=None):
|
|
|
376cca |
+ r = random.SystemRandom()
|
|
|
376cca |
if not select_from:
|
|
|
376cca |
select_from = string.ascii_letters + string.digits
|
|
|
376cca |
- return "".join([random.choice(select_from) for _x in range(0, strlen)])
|
|
|
376cca |
+ return "".join([r.choice(select_from) for _x in range(0, strlen)])
|
|
|
376cca |
|
|
|
376cca |
|
|
|
376cca |
def rand_dict_key(dictionary, postfix=None):
|
|
|
376cca |
--
|
|
|
376cca |
1.8.3.1
|
|
|
376cca |
|