summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-01-14 08:44:02 -0800
committerJohn McCrae <john.mccrae@progress.com>2022-01-31 15:55:55 -0800
commit6326c681edf1d050ddac2d777270521f3ce9ab79 (patch)
tree57041a9b93d43c364f958dca0acc604370e97ecf
parent238e59873a0c6fe1237e4b9758f09d6a14ef17e7 (diff)
downloadchef-6326c681edf1d050ddac2d777270521f3ce9ab79.tar.gz
Update Chef Client to retrieve client.pem from Windows CertStore
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r--spec/integration/client/client_spec.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index a3d42ac081..e126c5a088 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -42,14 +42,14 @@ describe "chef-client" do
end
def create_registry_key
- powershell_exec! <<~EOH
- $pfx_password = New-Object -TypeName PSObject
- $pfx_password | Add-Member -MemberType ScriptProperty -Name "Password" -Value { (#{SOME_CHARS}.tochararray() | Sort-Object { Get-Random })[0..14] -join '' }
- if (-not (Test-Path HKLM:\\SOFTWARE\\Progress)){
- New-Item -Path "HKLM:\\SOFTWARE\\Progress\\Authentication" -Force
- New-ItemProperty -path "HKLM:\\SOFTWARE\\Progress\\Authentication" -name "PfxPass" -value $pfx_password.Password -PropertyType String
- }
- EOH
+ @win32registry = Chef::Win32::Registry.new
+ path = "HKEY_LOCAL_MACHINE\\Software\\Progress\\Authentication"
+ unless @win32registry.key_exists?(path)
+ @win32registry.create_key(path, true)
+ end
+ password = SOME_CHARS.sample(1 + rand(SOME_CHARS.count)).join[0...14]
+ values = { name: "PfxPass", type: :string, data: password }
+ @win32registry.set_value(path, values)
end
def remove_certificate_from_store