summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Powell <powell@progress.com>2023-02-24 14:54:30 -0500
committerThomas Powell <powell@progress.com>2023-02-24 16:13:26 -0500
commit201ab2fb6c1ed01357840d1ec6f88341c7a93fa0 (patch)
treea21ee94415c599e57792b2cdc99f8747a6dec782
parent41d1c24f767e95e548e9719ea15f0c39b89a832c (diff)
downloadchef-201ab2fb6c1ed01357840d1ec6f88341c7a93fa0.tar.gz
Debugging with 1.0.15 chef-powershell
Signed-off-by: Thomas Powell <powell@progress.com>
-rw-r--r--Gemfile.lock6
-rw-r--r--chef-universal-mingw-ucrt.gemspec4
-rw-r--r--lib/chef/http/authenticator.rb9
-rw-r--r--omnibus/Gemfile.lock2
4 files changed, 14 insertions, 7 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index 983ade445c..a1b595bb43 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -90,7 +90,7 @@ PATH
aws-sdk-s3 (~> 1.91)
aws-sdk-secretsmanager (~> 1.46)
chef-config (= 18.1.25)
- chef-powershell (~> 1.0.12)
+ chef-powershell (~> 1.0.15)
chef-utils (= 18.1.25)
chef-vault
chef-zero (>= 14.0.11)
@@ -187,7 +187,7 @@ GEM
debug_inspector (>= 0.0.1)
builder (3.2.4)
byebug (11.1.3)
- chef-powershell (1.0.14)
+ chef-powershell (1.0.15)
ffi (~> 1.15)
ffi-yajl (~> 2.4)
chef-telemetry (1.1.1)
@@ -440,7 +440,7 @@ GEM
webrick (1.8.1)
win32-api (1.10.1-universal-mingw32)
win32-certstore (0.6.15)
- chef-powershell (>= 1.0.12)
+ chef-powershell (>= 0.0.13)
ffi
win32-event (0.6.3)
win32-ipc (>= 0.6.0)
diff --git a/chef-universal-mingw-ucrt.gemspec b/chef-universal-mingw-ucrt.gemspec
index 2edfd751f9..1a9be4f8df 100644
--- a/chef-universal-mingw-ucrt.gemspec
+++ b/chef-universal-mingw-ucrt.gemspec
@@ -15,9 +15,9 @@ gemspec.add_dependency "wmi-lite", "~> 1.0"
gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
gemspec.add_dependency "iso8601", ">= 0.12.1", "< 0.14" # validate 0.14 when it comes out
gemspec.add_dependency "win32-certstore", "~> 0.6.15" # 0.5+ required for specifying user vs. system store
-gemspec.add_dependency "chef-powershell", "~> 1.0.12" # The guts of the powershell_exec code have been moved to its own gem, chef-powershell. It's part of the chef-powershell-shim repo.
+gemspec.add_dependency "chef-powershell", "~> 1.0.15" # The guts of the powershell_exec code have been moved to its own gem, chef-powershell. It's part of the chef-powershell-shim repo.
gemspec.extensions << "ext/win32-eventlog/Rakefile"
gemspec.files += Dir.glob("{distro,ext}/**/*")
-gemspec \ No newline at end of file
+gemspec
diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb
index c795297397..009a6297bb 100644
--- a/lib/chef/http/authenticator.rb
+++ b/lib/chef/http/authenticator.rb
@@ -209,10 +209,17 @@ class Chef
def self.decrypt_pfx_pass(password)
powershell_code = <<~CODE
$secure_string = "#{password}" | ConvertTo-SecureString
+ $secure_string | Out-File -FilePath C:\\secure_string.txt
$string = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR((($secure_string))))
+ $string | Out-File -FilePath C:\\decrypted_string.txt
return $string
CODE
- powershell_exec!(powershell_code).result
+ result = powershell_exec!(powershell_code).result
+ secure_string = File.read("C:/secure_string.txt")
+ decrypted_string = File.read("C:/decrypted_string.txt")
+ puts "======== secure string |#{secure_string}|"
+ puts "======== decrypted |#{decrypted_string}|"
+ result
end
def self.retrieve_certificate_key(client_name)
diff --git a/omnibus/Gemfile.lock b/omnibus/Gemfile.lock
index 9d90793879..a308495143 100644
--- a/omnibus/Gemfile.lock
+++ b/omnibus/Gemfile.lock
@@ -155,7 +155,7 @@ GEM
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
tomlrb (~> 1.2)
- chef-powershell (1.0.13)
+ chef-powershell (1.0.15)
ffi (~> 1.15)
ffi-yajl (~> 2.4)
chef-telemetry (1.1.1)