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

Switch to nftables #407

Merged
merged 4 commits into from
May 7, 2023
Merged

Switch to nftables #407

merged 4 commits into from
May 7, 2023

Conversation

DemiMarie
Copy link
Contributor

@DemiMarie DemiMarie commented Feb 5, 2023

Draft as packaging has not been updated.

Fixes: QubesOS/qubes-issues#5031
Fixes: QubesOS/qubes-issues#6062

@DemiMarie DemiMarie force-pushed the nftables branch 5 times, most recently from 48a3f0d to e727dc9 Compare February 9, 2023 01:49
@DemiMarie DemiMarie marked this pull request as ready for review February 12, 2023 00:17
network/setup-ip Show resolved Hide resolved
network/setup-ip Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 12, 2023

Codecov Report

Merging #407 (911ae30) into main (8c3de49) will decrease coverage by 3.45%.
The diff coverage is 0.00%.

❗ Current head 911ae30 differs from pull request most recent head 8320a24. Consider uploading reports for the commit 8320a24 to get more accurate results

@@            Coverage Diff             @@
##             main     #407      +/-   ##
==========================================
- Coverage   74.47%   71.03%   -3.45%     
==========================================
  Files           3        3              
  Lines         615      466     -149     
==========================================
- Hits          458      331     -127     
+ Misses        157      135      -22     
Impacted Files Coverage Δ
qubesagent/firewall.py 76.62% <0.00%> (-2.64%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@DemiMarie DemiMarie requested review from marmarek and removed request for marmarek March 13, 2023 03:58
@DemiMarie DemiMarie requested a review from marmarek April 3, 2023 22:35
network/qubes-iptables Outdated Show resolved Hide resolved
network/setup-ip Outdated Show resolved Hide resolved
@qubesos-bot
Copy link

qubesos-bot commented Apr 8, 2023

OpenQA test summary

Complete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.2&build=2023050602-4.2&flavor=pull-requests

New failures, excluding unstable

Compared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.2&build=2023021823-4.2&flavor=update

  • system_tests_gui_tools

    • qui_widgets_update: unnamed test (unknown)

    • qui_widgets_update: Failed (test died)
      # Test died: no candidate needle with tag(s) 'qubes-update-finish' ...

    • qui_widgets_update: unnamed test (unknown)

  • system_tests_basic_vm_qrexec_gui

    • TC_20_AudioVM_Pulse_debian-11: test_223_audio_play_hvm (failure)
      AssertionError: frequency 3517.628022516466 not in specified range,...

    • TC_20_NonAudio_whonix-ws-16: test_105_qrexec_filemove (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...

    • TC_20_NonAudio_whonix-ws-16: test_130_qrexec_filemove_disk_full (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...

  • system_tests_network

    • VmNetworking_fedora-37: test_040_inter_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
  • system_tests_splitgpg

  • system_tests_gui_interactive

    • clipboard_and_web: unnamed test (unknown)
    • clipboard_and_web: Failed (test died)
      # Test died: no candidate needle with tag(s) 'personal-firefox' mat...
  • system_tests_guivm_gui_interactive

    • guivm_manager: unnamed test (unknown)
    • guivm_manager: Failed (test died)
      # Test died: no candidate needle with tag(s) 'vm-settings-ok' match...
  • system_tests_network_ipv6

    • VmIPv6Networking_fedora-37: test_111_dynamic_detach_attach (error + cleanup)
      raise exceptions.TimeoutError() from exc... TimeoutError

    • VmIPv6Networking_fedora-37: test_540_ipv6_inter_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...

  • system_tests_dispvm

  • system_tests_vm_qrexec_gui_pipewire

  • system_tests_qwt_win7@hw1

    • windows_install: Failed (test died)
      # Test died: command './install.sh' failed at /usr/lib/os-autoinst/...
  • system_tests_gui_tools@hw1

    • qui_widgets_update: unnamed test (unknown)

    • qui_widgets_update: Failed (test died)
      # Test died: no candidate needle with tag(s) 'qubes-update-finish' ...

    • qui_widgets_update: unnamed test (unknown)

Failed tests

31 failures
  • system_tests_gui_tools

    • qui_widgets_update: unnamed test (unknown)

    • qui_widgets_update: Failed (test died)
      # Test died: no candidate needle with tag(s) 'qubes-update-finish' ...

    • qui_widgets_update: unnamed test (unknown)

  • system_tests_basic_vm_qrexec_gui

    • TC_20_AudioVM_Pulse_debian-11: test_223_audio_play_hvm (failure)
      AssertionError: frequency 3517.628022516466 not in specified range,...

    • TC_20_NonAudio_whonix-ws-16: test_105_qrexec_filemove (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...

    • TC_20_NonAudio_whonix-ws-16: test_130_qrexec_filemove_disk_full (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...

  • system_tests_network

    • VmNetworking_fedora-37: test_040_inter_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
  • system_tests_pvgrub_salt_storage

    • [unstable] TC_41_HVMGrub_debian-11: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...

    • [unstable] TC_42_PVHGrub_debian-11: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...

  • system_tests_splitgpg

  • system_tests_gui_interactive

    • clipboard_and_web: unnamed test (unknown)
    • clipboard_and_web: Failed (test died)
      # Test died: no candidate needle with tag(s) 'personal-firefox' mat...
  • system_tests_guivm_gui_interactive

    • guivm_manager: unnamed test (unknown)
    • guivm_manager: Failed (test died)
      # Test died: no candidate needle with tag(s) 'vm-settings-ok' match...
  • system_tests_network_ipv6

    • VmIPv6Networking_fedora-37: test_111_dynamic_detach_attach (error + cleanup)
      raise exceptions.TimeoutError() from exc... TimeoutError

    • VmIPv6Networking_fedora-37: test_540_ipv6_inter_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...

  • system_tests_dispvm

  • system_tests_vm_qrexec_gui_pipewire

  • system_tests_qwt_win10@hw1

    • windows_install: Failed (test died)
      # Test died: command './install.sh' failed at /usr/lib/os-autoinst/...
  • system_tests_qwt_win7@hw1

    • windows_install: Failed (test died)
      # Test died: command './install.sh' failed at /usr/lib/os-autoinst/...
  • system_tests_gui_tools@hw1

    • qui_widgets_update: unnamed test (unknown)

    • qui_widgets_update: Failed (test died)
      # Test died: no candidate needle with tag(s) 'qubes-update-finish' ...

    • qui_widgets_update: unnamed test (unknown)

Fixed failures

Compared to: https://openqa.qubes-os.org/tests/60652#dependencies

8 fixed
  • system_tests_network

  • system_tests_pvgrub_salt_storage

    • StorageFile: test_001_non_volatile (error)
      subprocess.CalledProcessError: Command '/usr/lib/qubes/destroy-snap...
  • system_tests_network_ipv6

  • system_tests_network_updates

    • TC_11_QvmTemplateMgmtVM_whonix-gw-16: test_000_template_list (failure)
      qvm-template: error: No matching templates to list
  • system_tests_dispvm

  • system_tests_qwt_win10@hw1

    • windows_install: wait_serial (wait serial expected)
      # wait_serial expected: qr/Rt7qO-\d+-/...
  • system_tests_basic_vm_qrexec_gui@hw1

Unstable tests

  • system_tests_whonix

    whonix_torbrowser/ (1/5 times with errors)
    whonix_torbrowser/ (1/5 times with errors)
    whonix_torbrowser/ (2/5 times with errors)
    whonix_torbrowser/ (1/5 times with errors)
    whonix_torbrowser/ (1/5 times with errors)
    whonix_torbrowser/Failed (1/5 times with errors)
    • job 70358 # Test died: no candidate needle with tag(s) 'tor-browser-ipcheck-o...
    whonix_torbrowser/Failed (1/5 times with errors)
    • job 69775 # Test died: no candidate needle with tag(s) 'anon-whonix-tor-brows...
    whonix_torbrowser/Failed (1/5 times with errors)
    • job 69402 # Test died: no candidate needle with tag(s) 'anon-whonix-tor-brows...
  • system_tests_gui_tools

    qubesmanager_vmsettings/ (1/5 times with errors)
    qubesmanager_vmsettings/Failed (1/5 times with errors)
    • job 71327 # Test died: no candidate needle with tag(s) 'vm-settings-warn-mem'...
  • system_tests_basic_vm_qrexec_gui

    TC_00_AppVM_debian-11/test_105_qrexec_filemove (1/5 times with errors)
    • job 69778 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11/test_110_qrexec_filecopy_deny (1/5 times with errors)
    • job 69778 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11/test_220_audio_play (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37/test_220_audio_play (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16/test_220_audio_play (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_debian-11/test_223_audio_play_hvm (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37/test_223_audio_play_hvm (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16/test_223_audio_play_hvm (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
  • system_tests_network

    VmNetworking_debian-11/test_020_simple_proxyvm_nm (1/5 times with errors)
    • job 69420 AssertionError: 1 != 0 : nm-applet window not found
    VmNetworking_fedora-37/test_111_dynamic_detach_attach (1/5 times with errors)
    • job 69420 self.assertEqual(self.run_cmd(self.testvm1, ... AssertionError: 2 != 0
  • system_tests_pvgrub_salt_storage

    TC_41_HVMGrub_debian-11/test_000_standalone_vm (2/5 times with errors)
    • job 69762 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    • job 70379 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_42_PVHGrub_debian-11/test_000_standalone_vm (1/5 times with errors)
    • job 70379 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_41_HVMGrub_debian-11/test_010_template_based_vm (3/5 times with errors)
    • job 69762 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    • job 70379 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    • job 71319 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_42_PVHGrub_debian-11/test_010_template_based_vm (3/5 times with errors)
    • job 69423 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    • job 69762 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    • job 70379 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
  • system_tests_splitgpg

    TC_10_Thunderbird_fedora-37/test_020_send_receive_inline_with_attachment (2/5 times with errors)
    • job 69764 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^... AssertionError
    • job 71330 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^... AssertionError
  • system_tests_usbproxy

    TC_20_USBProxy_core3_whonix-gw-16/test_030_detach (1/5 times with errors)
    • job 71748 AssertionError: <AppVM at 0x7832c9e2ec10 name='test-inst-frontend' ...
    TC_20_USBProxy_core3_whonix-gw-16/test_061_auto_attach_on_reconnect (1/5 times with errors)
    • job 69740 AssertionError: 1 != 0 : Device reconnection failed
  • system_tests_network_ipv6

    VmIPv6Networking_debian-11/test_000_simple_networking (1/5 times with errors)
    • job 71732 qubes.exc.QubesMemoryError: Not enough memory to start domain 'test...
    VmIPv6Networking_debian-11/test_030_firewallvm_firewall (1/5 times with errors)
    • job 71329 raise exceptions.TimeoutError() from exc... TimeoutError
    VmIPv6Networking_debian-11/test_040_inter_vm (1/5 times with errors)
    • job 69421 raise exceptions.TimeoutError() from exc... TimeoutError
    VmIPv6Networking_debian-11/test_203_fake_ip_inter_vm_allow (1/5 times with errors)
    • job 70377 raise exceptions.TimeoutError() from exc... TimeoutError
    VmIPv6Networking_debian-11/test_520_ipv6_simple_proxyvm_nm (1/5 times with errors)
    • job 71329 AssertionError: 1 != 0 : nm-applet window not found
    VmIPv6Networking_debian-11/test_712_ipv6_custom_ip_firewall (1/5 times with errors)
    • job 69760 raise exceptions.TimeoutError() from exc... TimeoutError
  • system_tests_network_updates

    TC_10_QvmTemplate_debian-11/test_000_template_list (1/5 times with errors)
    • job 71318 AssertionError: libvirt event impl drain timeout
    TC_11_QvmTemplateMgmtVM_debian-11/test_010_template_install (1/5 times with errors)
    • job 71750 AssertionError: libvirt event impl drain timeout
  • system_tests_dispvm

    TC_20_DispVM_debian-11/test_030_edit_file (1/5 times with errors)
    • job 69461 AssertionError: Timeout while waiting for disp[0-9]* window to show
    TC_20_DispVM_fedora-37/test_030_edit_file (1/5 times with errors)
    • job 69755 AssertionError: b'test1\n' != b'Test test 2\ntest1\n'
    TC_20_DispVM_fedora-37/test_100_open_in_dispvm (3/5 times with errors)
    • job 69461 self.assertEqual(test_txt_content.s... AssertionError: b'' != b'test1'
    • job 69755 AssertionError: './open-file test.txt' failed with ./open-file test...
    • job 70372 self.assertEqual(test_txt_content.s... AssertionError: b'' != b'test1'
  • system_tests_devices

    TC_10_Attach_debian-11/test_000_attach_reattach (1/5 times with errors)
    • job 71726 assert not leaked... AssertionError
    TC_10_Attach_fedora-37/test_000_attach_reattach (1/5 times with errors)
    • job 71726 assert not leaked... AssertionError
    TC_10_Attach_whonix-gw-16/test_000_attach_reattach (1/5 times with errors)
    • job 71726 assert not leaked... AssertionError
    TC_10_Attach_whonix-ws-16/test_000_attach_reattach (1/5 times with errors)
    • job 71726 assert not leaked... AssertionError
    TC_10_Attach_debian-11/test_000_attach_reattach [attach] (1/5 times with errors)
    • job 71726 subprocess.CalledProcessError: Command 'ls /dev/xvdi' returned non-...
  • system_tests_basic_vm_qrexec_gui_xfs

    TC_30_Gui_daemon/test_000_clipboard (1/5 times with errors)
    • job 69753 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_whonix-ws-16-pool/test_000_start_shutdown (2/5 times with errors)
    • job 70370 qubes.exc.QubesVMShutdownTimeoutError: Domain shutdown timed out: '...
    • job 71310 qubes.exc.QubesVMShutdownTimeoutError: Domain shutdown timed out: '...
    TC_00_AppVM_debian-11-pool/test_100_qrexec_filecopy (1/5 times with errors)
    • job 69753 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_whonix-ws-16-pool/test_105_qrexec_filemove (1/5 times with errors)
    • job 69753 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11-pool/test_110_qrexec_filecopy_deny (1/5 times with errors)
    • job 69753 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11-pool/test_210_time_sync (1/5 times with errors)
    • job 69753 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11-pool/test_220_audio_play (1/5 times with errors)
    • job 69460 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37-pool/test_220_audio_play (1/5 times with errors)
    • job 69460 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16-pool/test_220_audio_play (1/5 times with errors)
    • job 69460 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_debian-11-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 69460 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 69460 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 69460 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
  • system_tests_whonix@hw1

    whonix_torbrowser/ (1/5 times with errors)
    whonix_torbrowser/ (1/5 times with errors)
    whonix_torbrowser/ (2/5 times with errors)
    whonix_torbrowser/ (1/5 times with errors)
    whonix_torbrowser/ (1/5 times with errors)
    whonix_torbrowser/Failed (1/5 times with errors)
    • job 70358 # Test died: no candidate needle with tag(s) 'tor-browser-ipcheck-o...
    whonix_torbrowser/Failed (1/5 times with errors)
    • job 69775 # Test died: no candidate needle with tag(s) 'anon-whonix-tor-brows...
    whonix_torbrowser/Failed (1/5 times with errors)
    • job 69402 # Test died: no candidate needle with tag(s) 'anon-whonix-tor-brows...
  • system_tests_basic_vm_qrexec_gui@hw1

    TC_00_AppVM_debian-11/test_105_qrexec_filemove (1/5 times with errors)
    • job 69778 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11/test_110_qrexec_filecopy_deny (1/5 times with errors)
    • job 69778 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11/test_220_audio_play (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37/test_220_audio_play (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16/test_220_audio_play (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_debian-11/test_223_audio_play_hvm (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37/test_223_audio_play_hvm (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16/test_223_audio_play_hvm (1/5 times with errors)
    • job 69411 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
  • system_tests_gui_tools@hw1

    qubesmanager_vmsettings/ (1/5 times with errors)
    qubesmanager_vmsettings/Failed (1/5 times with errors)
    • job 71327 # Test died: no candidate needle with tag(s) 'vm-settings-warn-mem'...
  • system_tests_basic_vm_qrexec_gui_ext4

    TC_00_AppVM_debian-11-pool/test_220_audio_play (1/5 times with errors)
    • job 69413 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37-pool/test_220_audio_play (1/5 times with errors)
    • job 69413 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16-pool/test_220_audio_play (1/5 times with errors)
    • job 69413 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_debian-11-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 69413 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 69413 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 69413 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
  • system_tests_basic_vm_qrexec_gui_zfs

    TC_00_AppVM_whonix-ws-16-pool/test_105_qrexec_filemove (1/2 times with errors)
    • job 71716 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
  • system_tests_basic_vm_qrexec_gui_btrfs

    TC_00_AppVM_debian-11-pool/test_100_qrexec_filecopy (2/5 times with errors)
    • job 70394 subprocess.CalledProcessError: Command 'cp /etc/passwd /tmp/passwd'...
    • job 71308 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_fedora-37-pool/test_100_qrexec_filecopy (1/5 times with errors)
    • job 71308 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_fedora-37-pool/test_105_qrexec_filemove (1/5 times with errors)
    • job 70394 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11-pool/test_110_qrexec_filecopy_deny (1/5 times with errors)
    • job 71308 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_fedora-37-pool/test_110_qrexec_filecopy_deny (1/5 times with errors)
    • job 70394 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11-pool/test_115_qrexec_filecopy_no_agent (1/5 times with errors)
    • job 71308 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11-pool/test_130_qrexec_filemove_disk_full (1/5 times with errors)
    • job 70394 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11-pool/test_210_time_sync (1/5 times with errors)
    • job 70394 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_00_AppVM_debian-11-pool/test_220_audio_play (1/5 times with errors)
    • job 69412 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37-pool/test_220_audio_play (1/5 times with errors)
    • job 69412 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16-pool/test_220_audio_play (1/5 times with errors)
    • job 69412 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_debian-11-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 69412 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_fedora-37-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 69412 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...
    TC_00_AppVM_whonix-ws-16-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 69412 subprocess.CalledProcessError: Command '['pkill', 'parecord']' retu...

@marmarek
Copy link
Member

marmarek commented Apr 9, 2023

setup-ip fails with:

iptables: No chain/target/match by that name.
iptables-restore: line 6 failed

My guess is https://github.com/QubesOS/qubes-core-agent-linux/blob/71d2fb884451eea25411c7e589c02f9eff02adc3/network/qubes-setup-dnat-to-ns called from setup-ip

@DemiMarie DemiMarie force-pushed the nftables branch 3 times, most recently from 578219c to 7c6e904 Compare April 16, 2023 00:06
@marmarek
Copy link
Member

PipelineRetry

network/qubes-setup-dnat-to-ns Outdated Show resolved Hide resolved
network/vif-route-qubes Outdated Show resolved Hide resolved
@DemiMarie DemiMarie force-pushed the nftables branch 2 times, most recently from 1cba057 to 567775f Compare April 22, 2023 00:17
@DemiMarie
Copy link
Contributor Author

PipelineRetryFailed

@marmarek
Copy link
Member

Please drop the selinux change, there is an alternative: #417

@marmarek
Copy link
Member

Besides the Whonix compat issue, the "fake IP" still fails:

Apr 26 22:22:22 test-inst-netvm1 root[1080]: /etc/xen/scripts/vif-route-qubes: online type_if=vif XENBUS_PATH=backend/vif/41/0
Apr 26 22:22:23 test-inst-netvm1 root[1116]: /etc/xen/scripts/vif-route-qubes: /etc/xen/scripts/vif-route-qubes failed; error detected.
...
cat /var/log/xen/xen-hotplug.log: b'Cannot remove namespace file "/run/netns/vif41.0-nat": No such file or directory\n/etc/xen/scripts/vif-qubes-nat.sh: line 51: /proc/sys/net/ipv6/conf//disable_ipv6: No such file or directory\n'

No functional change intended.
@DemiMarie
Copy link
Contributor Author

Besides the Whonix compat issue,

Should this be part of this or a separate PR?

the "fake IP" still fails:

Apr 26 22:22:22 test-inst-netvm1 root[1080]: /etc/xen/scripts/vif-route-qubes: online type_if=vif XENBUS_PATH=backend/vif/41/0
Apr 26 22:22:23 test-inst-netvm1 root[1116]: /etc/xen/scripts/vif-route-qubes: /etc/xen/scripts/vif-route-qubes failed; error detected.
...
cat /var/log/xen/xen-hotplug.log: b'Cannot remove namespace file "/run/netns/vif41.0-nat": No such file or directory\n/etc/xen/scripts/vif-qubes-nat.sh: line 51: /proc/sys/net/ipv6/conf//disable_ipv6: No such file or directory\n'

Fixed.

@marmarek
Copy link
Member

Besides the Whonix compat issue,

Should this be part of this or a separate PR?

Yes, this one, otherwise this PR regresses Whonix support.

@DemiMarie
Copy link
Contributor Author

PipelineRetryFailed

@marmarek
Copy link
Member

No network traffic is passed through, /var/log/xen/xen-hotplug.log:

Error: No such file or directory
add element ip qubes allowed { "vif3.0" . 10.138.16.176 }

First issue is that qubes-antispoof.service is not started, because it's neither enabled via preset file, nor pulled in via dependency (qubes-firewall.service references wrong name - qubes-iptables-antispoof.service). But even after starting it manually, it still doesn't work, because qubes-antispoof.service actually starts the same qubes-iptables script (and so, the same nft rules), instead of qubes-antispoof.nft. Loading qubes-antispoof.nft manually fixes the issue.

vm-systemd/qubes-iptables.service Outdated Show resolved Hide resolved
DemiMarie added 3 commits May 1, 2023 12:47
nftables is the modern replacement for iptables.  It has more features
and is actively maintained.  iptables is deprecated and may be removed
from distributions in the future.

Instead of a 1-to-1 translation, update the code to use nftables
features such as sets and maps.  This makes anti-spoofing checks either
O(1) or O(log N) (depending on how sets and maps are implemented) in the
number of downstream network interfaces.  The masquerading path benefits
even more, as it now uses netdev rules to directly forward a packet
to a specific destination while statelessly changing its addresses.

This also removes the legacy iptables support from the firewall daemon.
Since the anti-spoofing rules require nftables, supporting iptables in
the firewall daemon makes no sense anymore.

Furthermore, software flow offload allows NATd traffic to bypass all
layer 3 processing.  This is implemented using flowtables, which use the
ingress hook and therefore come before the prerouting hook.

DNS is now handled entirely in Python, rather than by a combination of
Python and Bash scripts.  This allows much better error checking and
makes the code actually possible to understand.  It will also be much
more extensible in the future.  As just one example, this Python code
could be used by the firewall daemon to automatically update DNS in
response to systemd-resolved events.

Instead of using network interface names, the nftables rules use
interface groups.  This should speed up processing (though no benchmarks
have been done) and avoids problems if interface names change in the
future.  The only exception is the prerouting hooks, which use interface
names to ensure that interface ID reuse does not cause problems.

The new anti-spoofing rules are deny-by-default.  If there is no entry
in the "allowed" nftables map for a given IP protocol, all traffic with
that protocol will be considered spoofed and dropped.  This avoids
having to explicitly disable IPv6 on interfaces with no ipv6 addresses.
Previously, neighbor discovery used ARP or NDP, both of which have
nonzero attack surface.  Additionally, the strict anti-spoofing rules
used by Qubes OS tend to break NDP, causing IPv6 traffic to be
unreliable.

This solves the second problem by adding permanent entries to Linux's
neighbor cache.  Since the peer MAC address is already known, it is not
necessary to use ARP or NDP to discover it.  This allows NDP to be
blocked outright if it has not been blocked already.
Tiny speedup; otherwise no functional change.
@marmarek
Copy link
Member

marmarek commented May 2, 2023

system_tests_network

VmNetworking_debian-11: test_111_dynamic_detach_attach (failure)
self.assertEqual(self.run_cmd(self.testvm1, ... AssertionError: 2 != 0

This looks like a legitimate failure, happens for both debian and fedora. The test starts the VM with netvm attached, detaches it and the attaches it again. I'm not sure what specifically failed there, but logs say eth0 is not configured at the end (it isn't "up"). I haven't found specific error in the logs.
Note the test when VM starts with netvm detached (set to "none") and is attached only after starting the VM passes.

@DemiMarie
Copy link
Contributor Author

system_tests_network
VmNetworking_debian-11: test_111_dynamic_detach_attach (failure)
self.assertEqual(self.run_cmd(self.testvm1, ... AssertionError: 2 != 0

This looks like a legitimate failure, happens for both debian and fedora. The test starts the VM with netvm attached, detaches it and the attaches it again. I'm not sure what specifically failed there, but logs say eth0 is not configured at the end (it isn't "up"). I haven't found specific error in the logs. Note the test when VM starts with netvm detached (set to "none") and is attached only after starting the VM passes.

This is actually a race condition in the test. I can reproduce this with normal qvm-run commands if I add sleep 5 (smaller amounts might also work) to /usr/lib/qubes/setup-ip just before bringing up the interface. With the script in this PR things work for me. QubesOS/qubes-core-admin#532 should fix it.

@DemiMarie
Copy link
Contributor Author

PipelineRetryFailed

@DemiMarie
Copy link
Contributor Author

QubesOS/qubes-core-admin#533 fixes the testsuite race

@adrelanos
Copy link
Member

  1. Modify vif-route-qubes to keep using iptables on Whonix (IMO least preferred).

Not ideal but OK with me.

  1. Modify Whonix's firewall to use nft and include qubes-specific chains for antispoofing rules (while the first part might be the desirable long term, not sure about the second part).

For porting Whonix to nft there's Whonix ticket Consider nftables / Berkeley Packet Filter (BPF) as a replacement for iptables. But not easy at all. Critical task. Could use help with this one.

  1. Split creating antispoofing nft chains to a separate service that that is not going to be disabled on Whonix and do not interfere with its firewall (really does nothing more than blocking IP spoofing attempts). IMO this is the most preferred option.

Also sounds good.

@adrelanos do you have any preference about this?

For context, this is QubesOS/qubes-issues#5031, which is going to be included in R4.2. Schedule-wise, first rc will be released "soon"(TM), but the final release will most likely happen after Debian bookworm release. I'm not sure how that aligns with Whonix 17 release schedule, if that would be relevant here.

Whonix 17 development (port to Debian bookworm) will start after Debian bookworm release.

Copy link
Member

@marmarek marmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While there are still few network-related issues (QubesOS/qubes-issues#8178, QubesOS/qubes-issues#8169, QubesOS/qubes-core-admin#533), there doesn't seem to be any remaining issue in the changes introduced here. Letslets handle remaining issue in a follow-up PR(s)

/var/run/$1 $3 gen_context(system_u:object_r:$2_t,s0)
/run/$1 $3 gen_context(system_u:object_r:$2_t,s0)
')dnl
slash_run(`xen(/.*)?',`xend_var_run')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be noted in the commit message (was it separate commit in an earlier version?).

@marmarek marmarek merged commit 5ce5dd9 into QubesOS:main May 7, 2023
@DemiMarie DemiMarie deleted the nftables branch May 7, 2023 16:27
3hhh added a commit to 3hhh/qubes-dns that referenced this pull request Jun 7, 2023
Qubes OS 4.2 does that switch. Do the same.

The code remains compatible to Qubes OS 4.1 for now and wasn't tested
on 4.2 yet.

QubesOS/qubes-core-agent-linux#407
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use flowtables to accelerate IP forwarding iptables →nftables
4 participants