Bind default SSH to 127.0.0.1 [GH-1785]

This commit is contained in:
Mitchell Hashimoto 2013-06-09 15:15:59 -07:00
parent 6c99f3dfa7
commit ba91602628
5 changed files with 13 additions and 2 deletions

View File

@ -6,6 +6,7 @@ FEATURES:
- Added a `working_directory` configuration option to the Puppet apply
provisioner so you can specify the working directory when `puppet` is
called, making it friendly to Hiera data and such. [GH-1670]
- Ability to specify the host IP to bind forwarded ports to. [GH-1785]
IMPROVEMENTS:
@ -23,6 +24,8 @@ IMPROVEMENTS:
- VirtualBox: Only configure networks if there are any to configure.
This allows linux's that don't implement this capability to work with
Vagrant. [GH-1796]
- Default SSH forwarded port now binds to 127.0.0.1 so only local
connections are allowed. [GH-1785]
BUG FIXES:

View File

@ -21,6 +21,7 @@ Vagrant.configure("2") do |config|
config.vm.network :forwarded_port,
guest: 22,
host: 2222,
host_ip: "127.0.0.1",
id: "ssh",
auto_correct: true

View File

@ -70,6 +70,7 @@ module VagrantPlugins
ports << {
:adapter => fp.adapter,
:guestport => fp.guest_port,
:hostip => fp.host_ip,
:hostport => fp.host_port,
:name => fp.id,
:protocol => fp.protocol

View File

@ -140,9 +140,9 @@ module VagrantPlugins
ports.each do |options|
pf_builder = [options[:name],
options[:protocol] || "tcp",
"",
options[:hostip] || "",
options[:hostport],
"",
options[:guestip] || "",
options[:guestport]]
args.concat(["--natpf#{options[:adapter] || 1}",

View File

@ -29,6 +29,11 @@ module VagrantPlugins
# @return [Integer]
attr_reader :guest_port
# The IP that the forwarded port will bind to on the host machine.
#
# @return [String]
attr_reader :host_ip
# The port on the host used to access the port on the guest.
#
# @return [Integer]
@ -43,6 +48,7 @@ module VagrantPlugins
@auto_correct = true
@auto_correct = options[:auto_correct] if options.has_key?(:auto_correct)
@adapter = (options[:adapter] || 1).to_i
@host_ip = options[:host_ip] || nil
@protocol = options[:protocol] || "tcp"
end