Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert windows login leaks #699

Merged
merged 3 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Changes
=======

# 4.2.0 / 2020-02-27
# 4.2.0 / 2020-02-27 - KNOWN BUG

* [FEATURE] Automatically uninstall and then install the Agent only when trying to downgrade agent version on Windows. See [#690][] [@kbogtob][]
* [BUGFIX] Set Windows installer as sensitive resource and use env var to specify Windows user credentials to avoid leaks of credentials in logs. See [#691][] and [#694][] [@julien-lebot][]
* [BUGFIX] Set Windows installer as sensitive resource and use env var to specify Windows user credentials to avoid leaks of credentials in logs. See [#691][] and [#694][] [@julien-lebot][] - Known bug: This bugfix introduces a new bug blocking users not using credentials to install on Windows
* [FEATURE] Support tags feature on directory integration. See [#687][] [@dimier]
* [FEATURE] Support options feature on memcache integration. See [#689][] [@mikelaning]

Expand Down
47 changes: 2 additions & 45 deletions recipes/_install-windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,6 @@
# limitations under the License.
#

include_recipe 'chef_handler'

module Windows
class Helper
def do_cleanup(context)
Chef::Log.info 'Windows environment vars cleanup started.'
resource = context.resource_collection.lookup('windows_env[DDAGENTUSER_NAME]')
resource.run_action(:delete) if resource
resource = context.resource_collection.lookup('windows_env[DDAGENTUSER_PASSWORD]')
resource.run_action(:delete) if resource
Chef::Log.info 'Windows environment vars cleanup finished.'
end
end
end

Chef.event_handler do
on :run_failed do
Windows::Helper.new.do_cleanup(
Chef.run_context
)
end
end

dd_agent_version = Chef::Datadog.agent_version(node)

if dd_agent_version.nil?
Expand Down Expand Up @@ -69,8 +46,8 @@ def do_cleanup(context)
# Since 6.11.0, the core and APM/trace components of the Windows Agent run under
# a specific user instead of LOCAL_SYSTEM, check whether the user has provided
# custom credentials and use them if that's the case.
install_options.concat(' DDAGENTUSER_NAME=%DDAGENTUSER_NAME%')
install_options.concat(' DDAGENTUSER_PASSWORD=%DDAGENTUSER_PASSWORD%')
install_options.concat(' DDAGENTUSER_NAME=').concat(Chef::Datadog.ddagentuser_name(node)) if Chef::Datadog.ddagentuser_name(node)
install_options.concat(' DDAGENTUSER_PASSWORD=').concat(Chef::Datadog.ddagentuser_password(node)) if Chef::Datadog.ddagentuser_password(node)
end

package 'Datadog Agent removal' do
Expand Down Expand Up @@ -131,16 +108,6 @@ def do_cleanup(context)
notifies :remove, 'package[Datadog Agent removal]', :immediately
end

windows_env 'DDAGENTUSER_NAME' do
value Chef::Datadog.ddagentuser_name(node) if Chef::Datadog.ddagentuser_name(node)
sensitive true
end

windows_env 'DDAGENTUSER_PASSWORD' do
value Chef::Datadog.ddagentuser_password(node) if Chef::Datadog.ddagentuser_password(node)
sensitive true
end

# Install the package
windows_package 'Datadog Agent' do # ~FC009
source temp_file
Expand All @@ -164,13 +131,3 @@ def do_cleanup(context)
unsafe
end
end

windows_env 'DDAGENTUSER_NAME' do
action :delete
sensitive true
end

windows_env 'DDAGENTUSER_PASSWORD' do
action :delete
sensitive true
end