Hi,
I am trying to use Packer to build new AMIs using the Windows 2012 CIS Benchmark (Hardened) image as the Source AMI:
The problem I am facing is that Packer is not able to connect to the EC2 instance via WinRM once the server is up. The following is the error I get in the 'packer.log' file that is generated:
2018/05/07 18:04:20 packer: 2018/05/07 18:04:20 [ERROR] connection error: http response error: 401 - invalid content type
2018/05/07 18:04:20 packer: 2018/05/07 18:04:20 [ERROR] WinRM connection err: http response error: 401 - invalid content type
After troubleshooting for many days, I found out that the following GPO that is automatically enabled by this Hardened AMI is what's causing Packer to timeout and fail:
HKLM\Software\Policies\Microsoft\Windows\WinRM\Service!AllowBasic
The GPO restricts the use of Basic Authentication. If I manually RDP into the instance and enable that from the Policy Editor, Packer successfully connects to the instance.
I read the Packer documentation and there is a way to change the Authentication mechanism by setting the field "winrm_use_ntlm" to True. I tried doing that but Packer is still timing out when it tries to connect to the instance via WinRM.
Has anybody seen this issue in the past? Is there a way to configure Packer to connect to this instance using "Non-Basic Authentication" and without having to manually edit the GPO?
Thanks for the support!
Andres