[ec2] reset password on Windows VMs #1124
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Reset password and configure it to a random string at init time
Which scenarios this will impact?
EC2 on Windows
Motivation
EC2 configures Windows hosts with a random password. The password is base64 encrypted with the public SSH key, to decrypt it we would need to first decrypt the private SSH key that is passphrase protected on our laptops, then decrypt the key. As this has multiple potential points of failure, and it would require storing the private key password somewhere accessible, it is quicker to reset the password through SSH once we are connected to the VM, at init time.
This allows for any code creating a
NewVM
on Windows to have a proper, accessible password in theRemoteHost
output.It is safe to print it in our CI logs as the instance is protected behind our network.
Additional Notes
Tested on datadog-agent, the only failure is not related to the change, the test failed on
main
too