nusenu / ansible-relayor

An Ansible Role for Tor Relay Operators
GNU General Public License v3.0
248 stars 43 forks source link

add kitchen test case with IPv6 addresses #158

Open nusenu opened 6 years ago

nusenu commented 6 years ago

Lets add a test case with IPv6 addresses by copying and extending t-guard-2publicIPs IPv6 documentation IP range https://tools.ietf.org/html/rfc3849

nusenu commented 6 years ago
+  - name: t-guard-IPv6
+    driver:
+      network:
+      - ["private_network", {ip: "192.0.2.10"}]
+      - ["private_network", {ip: "198.51.100.10"}]
+      - ["private_network", {ip: "2001:db8::1"}]
+      - ["private_network", {ip: "2001:db8::2"}]
+    provisioner:
+      playbook: "test/integration/default/2publicIPs-guard-node.yml"
/usr/share/ruby/resolv-replace.rb:42:in `connect': Invalid argument - connect(2) for "fe80::ffff:ffff:ffff:ffff" port 80 (Errno::EINVAL)
    from /usr/share/ruby/resolv-replace.rb:42:in `connect'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/network_fix_ipv6.rb:56:in `block in call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/network_fix_ipv6.rb:46:in `each'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/network_fix_ipv6.rb:46:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/network.rb:123:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/clear_network_interfaces.rb:26:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/prepare_nfs_settings.rb:19:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/synced_folders.rb:87:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/synced_folder_cleanup.rb:28:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/synced_folders/nfs/action_cleanup.rb:25:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/prepare_nfs_valid_ids.rb:12:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb:49:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb:30:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/env_set.rb:19:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/provision.rb:80:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/clear_forwarded_ports.rb:15:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/set_name.rb:50:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/clean_machine_folder.rb:17:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/box_check_outdated.rb:79:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/match_mac_address.rb:19:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/discard_state.rb:15:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/import.rb:74:in `import'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/import.rb:13:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/prepare_clone_snapshot.rb:17:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/prepare_clone.rb:15:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/customize.rb:40:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/warden.rb:34:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/builder.rb:116:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/action/runner.rb:66:in `run'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:227:in `action_raw'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:202:in `block in action'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/environment.rb:592:in `lock'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:188:in `call'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/machine.rb:188:in `action'
    from /usr/share/vagrant/gems/gems/vagrant-2.0.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

VirtualBox 5.2.8

maybe this: https://github.com/hashicorp/vagrant/issues/6748 https://www.virtualbox.org/ticket/14855

Lirt commented 6 years ago

I am afraid we can only try to work around this, since the issue is opened for 3 years in virtualbox.

I was thinking about easy workaround by disabling IPv6 autoconfiguration, but since the process fails before shell provisioning is started, I cannot do it like that:

sudo sysctl -w net.ipv6.conf.all.autoconf=0
sudo sysctl -w net.ipv6.conf.all.accept_ra=0

Another attempt with disabling IPv6 autoconfiguration I made was using VirtualBox customizations but I couldn't find something useful there.

This leads me worst possible workaround with provisioner and shell script which will assign IPv6 addresses to 2 already defined interfaces:

  - name: t-guard-IPv6
    driver:
      network:
      - ["private_network", {ip: "192.0.2.10"}]
      - ["private_network", {ip: "198.51.100.10"}]
    provisioner:
      playbook: "test/integration/default/2publicIPs-guard-node.yml"
Vagrant.configure("2") do |config|
  config.vm.provision "shell", inline: <<-SHELL
    netif_list=$(ls -1 /sys/class/net)
    for interf in ${netif_list}; do
        if ip address show dev "${interf}" | grep '192.0.2.10'; then
            ip address add "2001:db8::1/32" dev "${interf}"
        elif ip address show dev "${interf}" | grep '198.51.100.10'; then
            ip address add "2001:db8::2/32" dev "${interf}"
        fi
    done
  SHELL
end
nusenu commented 6 years ago

thanks for this! did you test it? for which platforms?