Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need to set default nic type via Vagrantfile for virttualbox #390

Open
oss-chapman opened this issue Jan 20, 2019 · 1 comment
Open

need to set default nic type via Vagrantfile for virttualbox #390

oss-chapman opened this issue Jan 20, 2019 · 1 comment

Comments

@oss-chapman
Copy link

Description

(patch to fix this is included in ticket)
When booting a kitchen created virtualbox, one receives the following message:

Vagrant has detected a configuration issue which exposes a
vulnerability with the installed version of VirtualBox. The
current guest is configured to use an E1000 NIC type for a
network adapter which is vulnerable in this version of VirtualBox.
Ensure the guest is trusted to use this configuration or update
the NIC type using one of the methods below:
https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type
https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type
To correct it we need to be able to pass "default_nic_type" to vagrant itself.
The current test kitchen-vagrant driver does not allow for this option to be passed.

The bug is described here and other places: geerlingguy/drupal-vm#1869

Kitchen Version

1.24.0

Vagrant Version

2.2.3

virtualbox Version

5.2.18_Ubuntur123745

Config file sample (doesn't actually work):

---
driver:
  name: vagrant
  customize:
    default_nic_type: "virtio"

Patch to fix this issue:

mchapman@debian:~/pub/kitchen-vagrant$ git diff 1cad7a7
diff --git a/templates/Vagrantfile.erb b/templates/Vagrantfile.erb
index bf6154a..efb7db9 100644
--- a/templates/Vagrantfile.erb
+++ b/templates/Vagrantfile.erb
@@ -190,6 +190,8 @@ Vagrant.configure("2") do |c|
            ids << "\"#{id}\""
          end %>
     p.customize ["modifyvm", :id, "--cpuidset", <%= ids.join(', ') %>]
+    <% elsif key == :default_nic_type %>
+    p.default_nic_type = "<%= value %>"
     <% else %>
     p.customize ["modifyvm", :id, "--<%= key %>", "<%= value %>"]
     <% end %>

Expected Output

In the generated vagrant file (given the patch and config sample above, we now see:

Vagrant.configure("2") do |c|
  c.berkshelf.enabled = false if Vagrant.has_plugin?("vagrant-berkshelf")
  c.vm.box = "ubuntu/bionic64"
  c.vm.hostname = "default-ubuntu-bionic64.vagrantup.com"
  c.vm.synced_folder ".", "/vagrant", disabled: true
  c.vm.provider :virtualbox do |p|
    p.name = "kitchen-ami-confluence-default-ubuntu-bionic64"
    p.default_nic_type = "virtio"
  end
end

So the patch seems to work, the warning from vagrant goes away.

@cheeseplus
Copy link
Contributor

This issue needs to be over on https://github.com/test-kitchen/kitchen-vagrant, it's not an issue with core test-kitchen.

@cheeseplus cheeseplus transferred this issue from test-kitchen/test-kitchen Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants