hashicorp / hashicorp/packer

Insecure defaults for WinRM Communicator

Open
#12,406 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

#### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

#### Description

https://developer.hashicorp.com/packer/docs/communicators/winrm

The documentation for configuring the WinRM communicator encourages bad security practises by enabling unencrypted WinRM and basic authentication. This configuration means that the server accepts plain text passwords sent over unencrypted HTTP.

This configuration is absolutely not required, because the Packer communicator supports setting `winrm_use_ssl` and `winrm_use_ntlm`

This documentation should be updated to stop encouraging insecure configuration

#### Use Case(s)

Even when engineers copy the more secure example code from this page, it still leaves the unencrypted WinRM endpoint enabled (although doesn't actually allow traffic to it)

#### Potential configuration

Removing the following would leave the server in a more secure configuration:

```
cmd.exe /c winrm set "winrm/config/service" '@{AllowUnencrypted="true"}'
cmd.exe /c winrm set "winrm/config/client" '@{AllowUnencrypted="true"}'
cmd.exe /c winrm set "winrm/config/service/auth" '@{Basic="true"}'
cmd.exe /c winrm set "winrm/config/client/auth" '@{Basic="true"}'
```

The following configuration should be enough:

```
cmd.exe /c winrm quickconfig -q
cmd.exe /c winrm set "winrm/config/service/auth" '@{CredSSP="true"}'
cmd.exe /c winrm set "winrm/config/listener?Address=*+Transport=HTTPS" "@{Port=`"5986`";Hostname=`"packer`";CertificateThumbprint=`"$($Cert.Thumbprint)`"}"
```

This would require the following Packer configuration (which might make sense to change to default to true):

```
winrm_use_ssl = true
winrm_insecure = true
winrm_use_ntlm = true
```

This is still not ideal because it doesn't use a known certificate authority for winrm, but it is a big improvement on the current example

#### Potential References

Contributor guide

Open the contributing guide

Research direction

Open the WinRM communicator documentation linked in the issue and review its setup examples alongside the proposed commands. Remove examples that enable unencrypted WinRM or basic authentication, and verify that the documented configuration matches the more secure Packer options described in the issue.

Written by the indexing model from the issue text.

Assessment

Domain
documentation, security
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.