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

libvirt provider fails with ssh.publicKeyCallback.auth if the SSH key is invalid #1078

Open
5 tasks
rabin-io opened this issue Mar 19, 2024 · 0 comments
Open
5 tasks

Comments

@rabin-io
Copy link

rabin-io commented Mar 19, 2024

System Information

Linux distribution

CentOS stream 9

Terraform version

# terraform -v
Terraform v1.7.5
on linux_amd64

Provider and libvirt versions

0.7.6

Checklist

  • Is your issue/contribution related with enabling some setting/option exposed by libvirt that the plugin does not yet support, or requires changing/extending the provider terraform schema?

    • Make sure you explain why this option is important to you, why it should be important to everyone. Describe your use-case with detail and provide examples where possible.
    • If it is a very special case, consider using the XSLT support in the provider to tweak the definition instead of opening an issue
    • Maintainers do not have expertise in every libvirt setting, so please, describe the feature and how it is used. Link to the appropriate documentation
  • Is it a bug or something that does not work as expected? Please make sure you fill the version information below:

Description of Issue/Question

Setup

We recently encrypted our SSH keys in our git repo using git-crypt, and when the libvirt provider tried to load it in its crypted state, if failed with a very long and cypted stack trace.

I know that it expected to fail, I just think it should be more informative and give the user a better error message, about the issue that the lib failed to load the SSH key.

Steps to Reproduce Issue

[2024-03-19T09:11:05.546Z] �[0;31m    Planning failed. Terraform encountered an error while generating this plan.�[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m    STDERR:�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    Error: Plugin did not respond�[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m      with provider["registry.terraform.io/dmacvicar/libvirt"],�[0m
[2024-03-19T09:11:05.546Z] �[0;31m      on config.tf line 44, in provider "libvirt":�[0m
[2024-03-19T09:11:05.546Z] �[0;31m      44: provider "libvirt" {�[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m    The plugin encountered an error, and failed to respond to the�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    plugin.(*GRPCProvider).ConfigureProvider call. The plugin logs may contain�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    more details.�[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m    Stack trace from the terraform-provider-libvirt_v0.6.14 plugin:�[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m    panic: runtime error: invalid memory address or nil pointer dereference�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x6812ea]�[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m    goroutine 27 [running]:�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    golang.org/x/crypto/ssh.publicKeyCallback.auth(0x11, {0xc00018b340, 0x20, 0x20}, {0xc00041460b, 0x4}, {0xfaed10, 0xc0001a8f00}, {0xf9f480, 0xc000092600})�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            golang.org/x/crypto@v0.0.0-20220112180741-5e0467b6c7ce/ssh/client_auth.go:235 +0x24a�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    golang.org/x/crypto/ssh.(*connection).clientAuthenticate(0xc0000f7000, 0xc0000de540)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            golang.org/x/crypto@v0.0.0-20220112180741-5e0467b6c7ce/ssh/client_auth.go:63 +0x3a9�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    golang.org/x/crypto/ssh.(*connection).clientHandshake(0xc0000f7000, {0xc0001dc0f0, 0x11}, 0xc0000de540)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            golang.org/x/crypto@v0.0.0-20220112180741-5e0467b6c7ce/ssh/client.go:113 +0x26a�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    golang.org/x/crypto/ssh.NewClientConn({0xfc3a48, 0xc00000f058}, {0xc0001dc0f0, 0x11}, 0xc0004eb800)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            golang.org/x/crypto@v0.0.0-20220112180741-5e0467b6c7ce/ssh/client.go:83 +0x12b�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    golang.org/x/crypto/ssh.Dial({0xe238f1, 0x5}, {0xc0001dc0f0, 0x11}, 0xc0004eb800)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            golang.org/x/crypto@v0.0.0-20220112180741-5e0467b6c7ce/ssh/client.go:190 +0x59�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri.(*ConnectionURI).dialSSH(0xc0004eb9c8)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri/ssh.go:130 +0x465�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri.(*ConnectionURI).DialTransport(0xc000414600)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            github.com/dmacvicar/terraform-provider-libvirt/libvirt/uri/connection_uri.go:83 +0x45�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    github.com/dmacvicar/terraform-provider-libvirt/libvirt.(*Config).Client(0xe4d2b3)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            github.com/dmacvicar/terraform-provider-libvirt/libvirt/config.go:35 +0x73�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    github.com/dmacvicar/terraform-provider-libvirt/libvirt.providerConfigure(0xc0001aac40)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            github.com/dmacvicar/terraform-provider-libvirt/libvirt/provider.go:68 +0xff�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Configure(0xc0000f6900, 0xc00000eff0)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            github.com/hashicorp/terraform-plugin-sdk@v1.9.0/helper/schema/provider.go:275 +0xb4�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).Configure(0xc00000ec58, {0xc0001815c0, 0x516766}, 0xc0001815c0)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            github.com/hashicorp/terraform-plugin-sdk@v1.9.0/internal/helper/plugin/grpc_provider.go:487 +0x1d2�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_Configure_Handler({0xdf5140, 0xc00000ec58}, {0xfb64b0, 0xc0001a48d0}, 0xc00019b020, 0x0)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            github.com/hashicorp/terraform-plugin-sdk@v1.9.0/internal/tfplugin5/tfplugin5.pb.go:3251 +0x170�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    google.golang.org/grpc.(*Server).processUnaryRPC(0xc000106780, {0xfc3c00, 0xc000106900}, 0xc0000ed300, 0xc0004d53e0, 0x155bf38, 0x0)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            google.golang.org/grpc@v1.27.1/server.go:1024 +0xd1e�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    google.golang.org/grpc.(*Server).handleStream(0xc000106780, {0xfc3c00, 0xc000106900}, 0xc0000ed300, 0x0)�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            google.golang.org/grpc@v1.27.1/server.go:1313 +0xa56�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    google.golang.org/grpc.(*Server).serveStreams.func1.1()�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            google.golang.org/grpc@v1.27.1/server.go:722 +0x98�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    created by google.golang.org/grpc.(*Server).serveStreams.func1�[0m
[2024-03-19T09:11:05.546Z] �[0;31m            google.golang.org/grpc@v1.27.1/server.go:720 +0xef�[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m    Error: The terraform-provider-libvirt_v0.6.14 plugin crashed!�[0m
[2024-03-19T09:11:05.546Z] �[0;31m  �[0m
[2024-03-19T09:11:05.546Z] �[0;31m    This is always indicative of a bug within the plugin. It would be immensely�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    helpful if you could report the crash with the plugin's maintainers so that it�[0m
[2024-03-19T09:11:05.546Z] �[0;31m    can be fixed. The output above should help diagnose the issue.�[0m

Additional information:

The logs are from 0.6.14 but is happens with latest release as well.

@rabin-io rabin-io changed the title libvirt provider fails with ssh.publicKeyCallback.auth is SSH key is invalid libvirt provider fails with ssh.publicKeyCallback.auth if the SSH key is invalid Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant