summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-06-07 14:10:30 -0700
committerJohn McCrae <john.mccrae@progress.com>2022-06-07 14:10:30 -0700
commit900a0ec61d64ce6908b83732b831213a1898558f (patch)
tree8720601eac5a0a25a220317fab585c683184c3a2
parent1e990f8a335b2d42eae76d073546a32218144e17 (diff)
downloadchef-900a0ec61d64ce6908b83732b831213a1898558f.tar.gz
KTLO - password generator was randomly failing, replaced the method
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r--lib/chef/http/authenticator.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb
index 6fbc2a74ba..23d7b0024b 100644
--- a/lib/chef/http/authenticator.rb
+++ b/lib/chef/http/authenticator.rb
@@ -26,8 +26,6 @@ class Chef
class HTTP
class Authenticator
DEFAULT_SERVER_API_VERSION = "2".freeze
- # cspell:disable-next-line
- SOME_CHARS = "~!@#%^&*_-+=`|\\(){}[<]:;'>,.?/0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".each_char.to_a
extend Chef::Mixin::PowershellExec
@@ -190,8 +188,9 @@ class Chef
unless @win32registry.key_exists?(new_path)
@win32registry.create_key(new_path, true)
end
+ require "securerandom"
size = 14
- password = (0...size).map { SOME_CHARS[rand(SOME_CHARS.size)] }.join
+ password = SecureRandom.alphanumeric(size)
encrypted_pass = encrypt_pfx_pass(password)
values = { name: "PfxPass", type: :string, data: encrypted_pass }
@win32registry.set_value(new_path, values)