hashicorp / hashicorp/packer-plugin-amazon

Amazon Builder couldn't connect via SSH to a Windows box

Open
#49 0 comments 0 reactions 0 assignees View on GitHub
bug builder/amazon enhancement need-more-info windows-guest
Dominant language
Go
Stars
91
Forks
141
Avg merge
2d 18h
Merged PRs (30d)
3

Description

_This issue was originally opened by @phoewass as hashicorp/packer#4958. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._


I tried to bake SSH service into my images and use it instead of WinRM, since Microsoft is supporting SSH for Windows[1].

So I created a Windows AMI image with SSH enabled using Packer and everything went fine.
Now when I'm trying to use it as a base image in Packer using ssh communicator it fails.

```
==>amazon-ebs: Prevalidating AMI Name...`
amazon-ebs: Found Image ID: ami-xxxxxxxx
==> amazon-ebs: Creating temporary keypair: packer_5931600e-8bca-8eab-3416-f5f9b63283e1
==> amazon-ebs: Creating temporary security group for this instance...
==> amazon-ebs: Authorizing access to port 22 the temporary security group...
==> amazon-ebs: Launching a source AWS instance...
amazon-ebs: Instance ID: i-xxxxxxxxxxxxxxxxx
==> amazon-ebs: Waiting for instance (i-xxxxxxxxxxxxxxxxx) to become ready...
==> amazon-ebs: Adding tags to source instance
amazon-ebs: Adding tag: "Name": "Packer Builder"
==> amazon-ebs: Waiting for SSH to become available...
==> amazon-ebs: Error waiting for SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

==> Builds finished but no artifacts were created.
```

I did some digging and I found out that amazon ssh communicator uses the generated key pair to connect to the box. While Windows boxes need to wait for the generated password then use it to connect, just like what WinRM communicator does.

[1] https://blogs.msdn.microsoft.com/powershell/2015/06/03/looking-forward-microsoft-support-for-secure-shell-ssh/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.