schubergphilis / vagrant-chef-zero

Vagrant Plugin for Chef Zero
Apache License 2.0
91 stars 42 forks source link

Wrong IP address detection in case of multiple interfaces with private addresses #42

Open iavael opened 10 years ago

iavael commented 10 years ago

This code in lib/vagrant-chef-zero/env_helpers.rb incorrectly detects address of chef-zero server (it takes address of another interface with private address)

ip_address = Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address
electrofelix commented 9 years ago

Essentially it'll take the first match rather than checking for the one matching the network of the provider. This is currently necessary since the chef_server_url must be set before vagrant validates the configuration of any chef_client provisioner steps.

The only solutions appear to be binding to all addresses using '0.0.0.0' (any security concerns?), or insert a dummy url, move the start and upload to after the provider runs and before the provisioner steps, and extract the correct network address to use from the provider.

I've also seen problems with network interface selection and Window's systems with various firewalls (really painful in a corporate env when frequently you can't modify or disable them) where using the machines public interface worked but none of the private ones could be communicated with from within the guest.

iavael commented 9 years ago

The only solutions appear to be binding to all addresses using '0.0.0.0' (any security concerns?)

I think this is the best variant. People concerned about security of their development/testing environment already have a firewall.