core: guard against SSH to localhost:22 [GH-4070]
This commit is contained in:
parent
7cce4cbc90
commit
62561f2844
|
@ -19,6 +19,7 @@ IMPROVEMENTS:
|
|||
|
||||
BUG FIXES:
|
||||
|
||||
- core: Guard against SSHing to localhost:22 [GH-4070]
|
||||
- core: Downloading box files should resume in more cases since the
|
||||
temporary file is preserved in more cases. [GH-4301]
|
||||
- core: Windows is not detected as NixOS in some cases. [GH-4302]
|
||||
|
|
|
@ -434,6 +434,13 @@ module Vagrant
|
|||
File.expand_path(path, @env.root_path)
|
||||
end
|
||||
|
||||
# If we're connecting to localhost:22, then short-circuit
|
||||
# and return nil here since this is something that nobody ever
|
||||
# really wants.
|
||||
if info[:host] == "127.0.0.1" && info[:port] == 22
|
||||
return nil
|
||||
end
|
||||
|
||||
# Return the final compiled SSH info data
|
||||
info
|
||||
end
|
||||
|
|
|
@ -605,6 +605,13 @@ describe Vagrant::Machine do
|
|||
expect(instance.ssh_info[:password]).to eql("")
|
||||
end
|
||||
|
||||
it "should return nil if localhost:22" do
|
||||
provider_ssh_info[:host] = "127.0.0.1"
|
||||
instance.config.ssh.port = 22
|
||||
|
||||
expect(instance.ssh_info).to be_nil
|
||||
end
|
||||
|
||||
context "with no data dir" do
|
||||
let(:base) { true }
|
||||
let(:data_dir) { nil }
|
||||
|
|
Loading…
Reference in New Issue