vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

SSH forwarding broken during provisioning step (Windows)

Open cskwrd opened this issue 2 years ago • 2 comments

Vagrant version

Vagrant 2.2.19

Host operating system

Windows 10 - VirtualBox 6.1.34

Guest operating system

I tried: hashicorp/bionic64 and bento/debian-10

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/bionic64"

  config.ssh.forward_agent = true

  config.vm.provision "shell", inline: "ssh -Tv [email protected] -o StrictHostKeyChecking=no"
end

NOTE: A valid GitHub public key is needed in the host ssh agent.

Expected behavior

A message indicating a successful connection to GitHub SSH servers.

Actual behavior

Permission is denied.

Steps to reproduce

  1. vagrant up
  2. Observe failure
  3. vagrant ssh -c "ssh -Tv [email protected] -o StrictHostKeyChecking=no"
  4. Observe success

References

Are there any other GitHub issues (open or closed) that should be linked here? For example:

  • GH-8415

cskwrd avatar May 23 '22 21:05 cskwrd

I dug around a little more and found GH-8615, and it seems to mention the same problem. I have tested, and when running pageant.exe agent forwarding works while the provisioner is running.

Can the fact that provisioner requires pageant.exe for agent forwarding be added to the docs?

cskwrd avatar May 25 '22 00:05 cskwrd

@cskwrd: I can reproduce that SSH agent forwarding in a provisioning context does not work on Windows. See https://github.com/hashicorp/vagrant/issues/12062#issuecomment-1279788972 for a minimal test case.

But I would classify this behavior as a bug and not a lack of documentation: The official OpenSSH package works correctly on Windows. The problem is the shell provisioning implementation of Vagrant, that seems to use another mechanism than the properly functioning vagrant ssh command.

As a cross-platform SSH user, I am not willing to rely on the third party SSH authentication agent pageant (https://en.wikipedia.org/wiki/PuTTY).

countzero avatar Oct 16 '22 18:10 countzero