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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when connecting with insecure_connection=false #436

Closed
lindhe opened this issue May 15, 2024 · 3 comments 路 Fixed by #437
Closed

Crash when connecting with insecure_connection=false #436

lindhe opened this issue May 15, 2024 · 3 comments 路 Fixed by #437
Assignees
Milestone

Comments

@lindhe
Copy link

lindhe commented May 15, 2024

Community Note

  • Please vote on this issue by adding a 馃憤 reaction 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

Overview of the Issue

I'm working towards a vcenter server with a TLS certificate form a private CA. If I'm trying to build a VM using Packer, with insecure_connection=false, then it crashes. If I add the cert to my host, or if I use insecure_connection=true, it works as intended.

Posting this since I was greeted with this:

!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Packer crashed! This is always indicative of a bug within Packer.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Packer[1] so that we can fix this.

[1]: https://github.com/hashicorp/packer/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reproduction Steps

Run packer build . with the simplified packer template shown below.

Packer version

$ packer version
Packer v1.10.3

Simplified Packer Template

packer {
  required_version = ">= 1.7.0"
  required_plugins {
    vsphere = {
      version = "~> 1.2.0"
      source  = "github.com/hashicorp/vsphere"
    }
  }
}

source "vsphere-iso" "foo" {

  insecure_connection = false  # 馃憟 If this is `false`, things crash!

  cluster              = var.vcenter_cluster
  datacenter           = var.vcenter_datacenter
  datastore            = var.vcenter_datastore
  password             = var.vcenter_password
  ssh_username         = "bar"
  storage {
    disk_size             = 32 * 1024
    disk_thin_provisioned = true
  }
  username       = var.vcenter_username
  vcenter_server = var.vcenter_server
  vm_name        = "buz"

}

build {
  sources = ["source.vsphere-iso.foo"]
}

Operating system and Environment details

Ubuntu 22.04.4 LTS as a WSL2 environment on Windows 11.

Log Fragments and crash.log files

crash.log

@lindhe lindhe added the bug label May 15, 2024
@lbajolet-hashicorp lbajolet-hashicorp transferred this issue from hashicorp/packer May 17, 2024
@tenthirtyam tenthirtyam added this to the Backlog milestone May 17, 2024
@lbajolet-hashicorp
Copy link
Contributor

Hi @lindhe,

Thanks for the bug report!

While this Unexpected EOF which caused Packer to crash is coming from the SDK (likely even gob), the underlying problem is coming from a nil driver that gets coerced in the Cleanup code of the connect step for some reason.

Fixing the serialisation/stream EOF error will take some time, but this vsphere bug can be independently addressed I'd think.

@tenthirtyam
Copy link
Collaborator

Interestingly, I get the expected error:

==> vsphere-iso.linux-photon: Post "https://m01-vc01.rainpole.io/sdk":
    tls: failed to verify certificate: x509: certificate signed by unknown authority

@lindhe
Copy link
Author

lindhe commented May 31, 2024

Oh really? That is surprising. Same packer version? And did you try with my example or a different one?

Is your vcenter_server variable set to m01-vc01.rainpole.io or https://m01-vc01.rainpole.io or something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants