[windows] no install if bad hashsum
MODIFY
recipes/_install-windows.rb
recipes/_install-windows.rb
@@ -71,15 +71,15 @@ remote_file temp_file do
notifies :create, 'ruby_block[validate_safe_msi]', :immediately
end
-ruby_block "validate_safe_msi" do
- block do
- require 'digest'
-
unsafe_hashsums = [
'928b00d2f952219732cda9ae0515351b15f9b9c1ea1d546738f9dc0fda70c336',
'78b2bb2b231bcc185eb73dd367bfb6cb8a5d45ba93a46a7890fd607dc9188194'
]
+ruby_block "validate_safe_msi" do
+ block do
+ require 'digest'
+
sha256 = Digest::SHA256.file(temp_file)
raise "The file downloaded matches a known unsafe MSI - Agent versions 6.14.0/1 have been blacklisted. please use a different release. "\
@@ -114,4 +114,9 @@ windows_package 'Datadog Agent' do # ~FC009
else
success_codes [0, 3010]
end
+ not_if do
+ require 'digest'
+
+ unsafe_hashsums.include? Digest::SHA256.file(temp_file).hexdigest
+ end
end

[windows] no install if bad hashsum