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

ssh issue when using multiple builders of same type #238

Open
mike-19 opened this issue Oct 13, 2024 · 0 comments
Open

ssh issue when using multiple builders of same type #238

mike-19 opened this issue Oct 13, 2024 · 0 comments
Labels

Comments

@mike-19
Copy link

mike-19 commented Oct 13, 2024

Overview of the Issue

our usecase involves building multiple types of images within our tech ecosystem , This has become a new requirement as since we used to build individual images and it incurred lot of time as since the number of images we build took lot of time , We consolidated the types into single packer file instead individual packer files

when building multiple images using the same builder type googlecompute we see only one suceed and others fail with the.
Sample packer file

{
  "builders": [
    {
      "name": "google-ch",
      "type": "googlecompute",
      "account_file": "./account.json",
      "project_id": "project-id",
      "ssh_username" : "imageautomation",
      "source_image_project_id": "our-project-for-golden-image",
      "source_image_family": "proc-ubuntu22",
      "use_os_login": "true",
      "temporary_key_pair_bits": "2048",
      "ssh_clear_authorized_keys": "true",
      "disk_size": 60,
      "image_name": "ch-beta-81a74dd-20241013152639",
      "image_family": "ch",
      "zone": "us-west1-a",
      "machine_type": "n1-standard-4",
      "omit_external_ip": "true",
      "use_internal_ip": "true",
      "tags": "clusters",
      "image_labels": {
        "image-type": "ch",
        "git-commit-id": "81a74dd",
        "built-on": "20241013152639"
      },
      "subnetwork": "ournetwork/subnetworks/hashi"
    },
    {
      "name": "google-ncv",
      "type": "googlecompute",
      "account_file": "./account.json",
      "project_id": "project-id",
      "source_image_project_id": "our-project-for-golden-image",
      "ssh_username": "imageautomation",
      "source_image_family": "proc-ubuntu22",
      "use_os_login": "true",
      "temporary_key_pair_bits": "2048",
      "ssh_clear_authorized_keys": "true",
      "disk_size": 60,
      "image_name": "ncv-beta-81a74dd-20241013152639",
      "image_family": "ncv",
      "zone": "us-west1-a",
      "machine_type": "n1-standard-4",
      "omit_external_ip": "true",
      "use_internal_ip": "true",
      "tags": "clusters",
      "image_labels": {
        "image-type": "ncv",
        "git-commit-id": "81a74dd",
        "built-on": "20241013152639"
      },
      "subnetwork": "ournetwork/subnetworks/hashi"
    }
  ]
}

error

Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

When checked on the image ch i see public key uploaded in the ssh metadata is different compared to the one uploaded in the ncv hence one of them works as expected since the public/private key pair matches while the other fails due to public public/private key pair is wrong

Reproduction Steps

Try multiple builders of same type in single packer.json file , using the code i provided

Steps to reproduce this issue

Plugin and Packer version

1.11.2

Log Fragments and crash.log files

Logs

  • Fingerprint of Public Key uploaded for **CH** 2048 SHA256:0+u21irk2GNDe9NxibNwMFm4YUJa9ooN0dOdL/YYl9Y sa_102136215908502294195 (RSA)

  • Fingerprint of Public Key uploaded for **NCV** 2048 SHA256:c62VEBhoKdvSaXHEVbtQ7KrJCi+6uWeePm28ofrHTfc sa_102136215908502294195 (RSA)

Error

Build 'googlecompute.google-ncv' errored after 35 minutes 48 seconds: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Oct 13 09:01:13 packer-670bee7b-f981-759f-1235-2e39c630827b sshd[2401]: Failed publickey for sa_102136215908502294195 from 10.60.109.199 port 57828 ssh2: RSA SHA256:c62VEBhoKdvSaXHEVbtQ7KrJCi+6uWeePm28ofrHTfc
Oct 13 09:01:14 packer-670bee7b-f981-759f-1235-2e39c630827b sshd[2401]: Connection closed by authenticating user sa_102136215908502294195 10.60.109.199 port 57828 [preauth]
Oct 13 09:01:14 packer-670bee7b-f981-759f-1235-2e39c630827b chronyd[2357]: Selected source 169.254.169.254 (metadata.google.internal)
Oct 13 09:01:21 packer-670bee7b-f981-759f-1235-2e39c630827b sshd[2409]: Connection from 10.60.109.199 port 57854 on 10.163.100.85 port 22 rdomain ""
Oct 13 09:01:21 packer-670bee7b-f981-759f-1235-2e39c630827b sshd[2409]: error: kex_exchange_identification: Connection closed by remote host
Oct 13 09:01:21 packer-670bee7b-f981-759f-1235-2e39c630827b sshd[2409]: Connection closed by 10.60.109.199 port 57854
Oct 13 09:01:22 packer-670bee7b-f981-759f-1235-2e39c630827b sshd[2410]: Connection from 10.60.109.199 port 57855 on 10.163.100.85 port 22 rdomain ""
Oct 13 09:01:27 packer-670bee7b-f981-759f-1235-2e39c630827b sshd[2410]: Failed publickey for sa_102136215908502294195 from 10.60.109.199 port 57855 ssh2: RSA SHA256:c62VEBhoKdvSaXHEVbtQ7KrJCi+6uWeePm28ofrHTfc
@mike-19 mike-19 added the bug label Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant