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

"Error loading certificate" when referencing SSH private key #274

Open
lorenzoiuri opened this issue Jan 12, 2025 · 0 comments
Open

"Error loading certificate" when referencing SSH private key #274

lorenzoiuri opened this issue Jan 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@lorenzoiuri
Copy link

Overview of the Issue

packer validate returns error ssh_private_key_file is invalid: Error loading certificate when using field ssh_private_key_file in source qemu block.

The key file exists. The keypair has been generated from command ssh-keygen -f rsa -t rsa with no passphrase.
Also, ed25519 keys have been tested, with the same packer results.

The private and public key pairs have been tested with commands:

PRIVKEY=rsa
TESTKEY=rsa.pub
diff <( ssh-keygen -y -e -f "$PRIVKEY" ) <( ssh-keygen -y -e -f "$TESTKEY" )

(Source: https://serverfault.com/questions/426394/how-to-check-if-an-rsa-public-private-key-pair-match)

Reproduction Steps

  • Download attached archive, uncompress, cd in folder.
  • Change èath values for ssh_certificate_file and ssh_private_key_file to reference the ssh keypair file paths in the archive.
  • Change fields values iso_url and iso_checksum.
  • Run packer validate .

Packer Plugin SDK version

  • packer version: v1.11.2
  • packer qemu plugin: github.com/hashicorp/qemu 1.1.0

Operating system and Environment details

Ubuntu Linux 24.04. Packer installed manually via binary download.

Log Fragments and crash.log files

Running packer with PACKER_LOG=1 does not add useful information about the key error.

In this repository (https://github.com/hashicorp/packer-plugin-sdk) I found that the string Error loading certificate is only present in file communicator/ssh/ssh.go and is returned after the function ssh.ParseAuthorizedKey, which does not seem to handle private keys but authorized_keys files.

Attachment: packer.zip

Thank you for your support.

@lorenzoiuri lorenzoiuri added the bug Something isn't working label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant