Detect PuTTY Link on Windows and show error [GH-1518]
This commit is contained in:
parent
0874d4a77a
commit
868f8d4061
|
@ -40,6 +40,7 @@ IMPROVEMENTS:
|
||||||
- Specify the default provider with the `VAGRANT_DEFAULT_PROVIDER`
|
- Specify the default provider with the `VAGRANT_DEFAULT_PROVIDER`
|
||||||
environmental variable. [GH-1478]
|
environmental variable. [GH-1478]
|
||||||
- Invalid settings are now caught and shown in a user-friendly way. [GH-1484]
|
- Invalid settings are now caught and shown in a user-friendly way. [GH-1484]
|
||||||
|
- Detect PuTTY Link SSH client on Windows and show an error. [GH-1518]
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
|
|
|
@ -411,6 +411,10 @@ module Vagrant
|
||||||
error_key(:ssh_host_down)
|
error_key(:ssh_host_down)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class SSHIsPuttyLink < VagrantError
|
||||||
|
error_key(:ssh_is_putty_link)
|
||||||
|
end
|
||||||
|
|
||||||
class SSHKeyBadOwner < VagrantError
|
class SSHKeyBadOwner < VagrantError
|
||||||
error_key(:ssh_key_bad_owner)
|
error_key(:ssh_key_bad_owner)
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,7 @@ require "log4r"
|
||||||
require "vagrant/util/file_mode"
|
require "vagrant/util/file_mode"
|
||||||
require "vagrant/util/platform"
|
require "vagrant/util/platform"
|
||||||
require "vagrant/util/safe_exec"
|
require "vagrant/util/safe_exec"
|
||||||
|
require "vagrant/util/subprocess"
|
||||||
require "vagrant/util/which"
|
require "vagrant/util/which"
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
|
@ -60,7 +61,8 @@ module Vagrant
|
||||||
def self.exec(ssh_info, opts={})
|
def self.exec(ssh_info, opts={})
|
||||||
# Ensure the platform supports ssh. On Windows there are several programs which
|
# Ensure the platform supports ssh. On Windows there are several programs which
|
||||||
# include ssh, notably git, mingw and cygwin, but make sure ssh is in the path!
|
# include ssh, notably git, mingw and cygwin, but make sure ssh is in the path!
|
||||||
if !Which.which("ssh")
|
ssh_path = Which.which("ssh")
|
||||||
|
if !ssh_path
|
||||||
if Platform.windows?
|
if Platform.windows?
|
||||||
raise Errors::SSHUnavailableWindows,
|
raise Errors::SSHUnavailableWindows,
|
||||||
:host => ssh_info[:host],
|
:host => ssh_info[:host],
|
||||||
|
@ -72,6 +74,19 @@ module Vagrant
|
||||||
raise Errors::SSHUnavailable
|
raise Errors::SSHUnavailable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# On Windows, we need to detect whether SSH is actually "plink"
|
||||||
|
# underneath the covers. In this case, we tell the user.
|
||||||
|
if Platform.windows?
|
||||||
|
r = Subprocess.execute(ssh_path)
|
||||||
|
if r.stdout.include?("PuTTY Link")
|
||||||
|
raise Errors::SSHIsPuttyLink,
|
||||||
|
:host => ssh_info[:host],
|
||||||
|
:port => ssh_info[:port],
|
||||||
|
:username => ssh_info[:username],
|
||||||
|
:key_path => ssh_info[:private_key_path]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# If plain mode is enabled then we don't do any authentication (we don't
|
# If plain mode is enabled then we don't do any authentication (we don't
|
||||||
# set a user or an identity file)
|
# set a user or an identity file)
|
||||||
plain_mode = opts[:plain_mode]
|
plain_mode = opts[:plain_mode]
|
||||||
|
|
|
@ -364,6 +364,16 @@ en:
|
||||||
While attempting to connect with SSH, a "host is down" (EHOSTDOWN)
|
While attempting to connect with SSH, a "host is down" (EHOSTDOWN)
|
||||||
error was received. Please verify your SSH settings are correct
|
error was received. Please verify your SSH settings are correct
|
||||||
and try again.
|
and try again.
|
||||||
|
ssh_is_putty_link: |-
|
||||||
|
The `ssh` executable found in the PATH is a PuTTY Link SSH client.
|
||||||
|
Vagrant is only compatible with OpenSSH SSH clients. Please install
|
||||||
|
an OpenSSH SSH client or manually SSH in using your existing client
|
||||||
|
using the information below.
|
||||||
|
|
||||||
|
Host: %{host}
|
||||||
|
Port: %{port}
|
||||||
|
Username: %{username}
|
||||||
|
Private key: %{key_path}
|
||||||
ssh_key_bad_owner: |-
|
ssh_key_bad_owner: |-
|
||||||
The private key to connect to the machine via SSH must be owned
|
The private key to connect to the machine via SSH must be owned
|
||||||
by the user running Vagrant. This is a strict requirement from
|
by the user running Vagrant. This is a strict requirement from
|
||||||
|
|
Loading…
Reference in New Issue