2015-11-12 17:56:08 +00:00
|
|
|
#
|
|
|
|
# change a few Windows registry keys for testing purposes
|
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
if node["platform_family"] == "windows"
|
2015-11-12 17:56:08 +00:00
|
|
|
|
2015-11-17 21:12:19 +00:00
|
|
|
registry_key 'HKLM\System\Test' do
|
|
|
|
values [{
|
2019-06-11 22:24:35 +00:00
|
|
|
name: "",
|
|
|
|
type: :string,
|
|
|
|
data: "test",
|
|
|
|
}, {
|
|
|
|
name: "string value",
|
|
|
|
type: :string,
|
|
|
|
data: nil,
|
|
|
|
}, {
|
|
|
|
name: "binary value",
|
|
|
|
type: :binary,
|
|
|
|
data: "dfa0f066",
|
|
|
|
}, {
|
|
|
|
name: "dword value",
|
|
|
|
type: :dword,
|
|
|
|
data: 0,
|
|
|
|
}, {
|
|
|
|
name: "big dword value",
|
|
|
|
type: :dword,
|
|
|
|
data: 2147483648,
|
|
|
|
}, {
|
|
|
|
name: "qword value",
|
|
|
|
type: :qword,
|
|
|
|
data: 0,
|
|
|
|
}, {
|
|
|
|
name: "multistring value",
|
|
|
|
type: :multi_string,
|
|
|
|
data: %w{test multi string data},
|
|
|
|
}, {
|
|
|
|
name: 'super\/escape',
|
|
|
|
type: :string,
|
|
|
|
data: '\/value/\\',
|
|
|
|
}, {
|
|
|
|
name: "key.with.dot",
|
|
|
|
type: :string,
|
|
|
|
data: "value.with.dot",
|
2015-11-17 21:12:19 +00:00
|
|
|
}]
|
|
|
|
recursive true
|
|
|
|
action :create
|
|
|
|
end
|
2015-11-12 17:56:08 +00:00
|
|
|
|
2015-11-17 21:12:19 +00:00
|
|
|
registry_key 'HKLM\Software\Policies\Microsoft\Windows\EventLog\System' do
|
2019-06-11 22:24:35 +00:00
|
|
|
values [{ name: "MaxSize", type: :dword, data: 67_108_864 }]
|
2015-11-17 21:12:19 +00:00
|
|
|
recursive true
|
|
|
|
action :create
|
|
|
|
end
|
2015-11-12 17:56:08 +00:00
|
|
|
|
2015-11-17 21:12:19 +00:00
|
|
|
registry_key 'HKLM\System\CurrentControlSet\Control\Session Manager' do
|
2019-06-11 22:24:35 +00:00
|
|
|
values [{ name: "SafeDllSearchMode", type: :dword, data: 1 }]
|
2015-11-17 21:12:19 +00:00
|
|
|
recursive true
|
|
|
|
action :create
|
|
|
|
end
|
|
|
|
|
|
|
|
registry_key 'HKLM\System\CurrentControlSet\Services\LanManServer\Parameters' do
|
2019-06-11 22:24:35 +00:00
|
|
|
values [{ name: "NullSessionShares", type: :multi_string, data: [] }]
|
2015-11-17 21:12:19 +00:00
|
|
|
recursive true
|
|
|
|
action :create
|
|
|
|
end
|
|
|
|
|
|
|
|
registry_key 'HKLM\Software\Policies\Microsoft\Internet Explorer\Main' do
|
2019-06-11 22:24:35 +00:00
|
|
|
values [{ name: "Isolation64Bit", type: :dword, data: 1 }]
|
2015-11-17 21:12:19 +00:00
|
|
|
recursive true
|
|
|
|
action :create
|
|
|
|
end
|
|
|
|
|
|
|
|
registry_key 'HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' do
|
2019-06-11 22:24:35 +00:00
|
|
|
values [{ name: "MinEncryptionLevel", type: :dword, data: 3 }]
|
2015-11-17 21:12:19 +00:00
|
|
|
recursive true
|
|
|
|
action :create
|
|
|
|
end
|
2015-11-12 17:56:08 +00:00
|
|
|
|
2015-11-23 14:43:47 +00:00
|
|
|
registry_key 'HKLM\System\CurrentControlSet\Control\Lsa\MSV1_0' do
|
2019-06-11 22:24:35 +00:00
|
|
|
values [{ name: "NTLMMinServerSec", type: :dword, data: 537_395_200 }]
|
2015-11-23 14:43:47 +00:00
|
|
|
recursive true
|
|
|
|
action :create
|
|
|
|
end
|
2016-08-09 14:20:43 +00:00
|
|
|
|
|
|
|
# used to verify pattern test
|
|
|
|
::Chef::Recipe.send(:include, Chef::Mixin::PowershellOut)
|
2019-06-11 22:24:35 +00:00
|
|
|
cmd = powershell_out!("Get-WmiObject -Class Win32_UserAccount | % { $_.SID } | ConvertTo-Json")
|
2016-08-09 14:20:43 +00:00
|
|
|
sids = JSON.parse(cmd.stdout)
|
2019-06-11 22:24:35 +00:00
|
|
|
sids.each do |sid|
|
2016-08-09 14:20:43 +00:00
|
|
|
registry_key "HKEY_USERS\\#{sid}\\Software\\Policies\\Microsoft\\Windows\\Installer" do
|
2019-06-11 22:24:35 +00:00
|
|
|
values [{ name: "AlwaysInstallElevated", type: :dword, data: 0 }]
|
2016-08-09 14:20:43 +00:00
|
|
|
recursive true
|
|
|
|
ignore_failure true # ignore users that have not been logged in
|
|
|
|
action :create
|
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
end
|
2015-11-12 17:56:08 +00:00
|
|
|
end
|