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

Relabel / and /rw if needed #541

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DemiMarie
Copy link
Contributor

Creating /.autorelabel must cause a Qubes OS VM to relabel everything, as otherwise users will not be able to troubleshoot their systems and upstream packages that create it will break. However, it was ignored, so fix that.

Furthermore, relabel the filesystem of a TemplateBasedVM whenever its TemplateVM has been relabeled since the TemplateBasedVM was. This ensures that policy changes propagate to TemplateBasedVMs too.

@marmarek
Copy link
Member

This fails to build...

But also, shouldn't this reference #9663 ?
And additionally, I think we need the updater to support handling reboot for relabeling after an update that requires it...

@DemiMarie DemiMarie marked this pull request as draft December 23, 2024 01:51
@DemiMarie
Copy link
Contributor Author

I meant for this to be a draft because I hadn’t tested it, hence the build failure.

@DemiMarie DemiMarie force-pushed the relabel-rw-if-needed branch from 2abb91f to ee39235 Compare December 23, 2024 02:14
@DemiMarie
Copy link
Contributor Author

I didn’t reference #9663 because I don’t know if this actually fixes that issue.

@DemiMarie DemiMarie force-pushed the relabel-rw-if-needed branch 3 times, most recently from 523b6d5 to da46272 Compare December 27, 2024 14:09
Copy link

codecov bot commented Dec 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.57%. Comparing base (74d07bb) to head (31bb12a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #541   +/-   ##
=======================================
  Coverage   70.57%   70.57%           
=======================================
  Files           3        3           
  Lines         469      469           
=======================================
  Hits          331      331           
  Misses        138      138           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -0,0 +1,6 @@
#!/bin/bash --
Copy link
Member

Choose a reason for hiding this comment

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

What bash features you use here? I'd prefer /bin/sh (and consequently shellcheck noticing non-POSIX features) in scritpts that don't absolutely need bash (for example to have proper arrays).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

-nt is not part of POSIX.

init/relabel-rw.sh Outdated Show resolved Hide resolved
@DemiMarie DemiMarie force-pushed the relabel-rw-if-needed branch from da46272 to d3212f6 Compare January 5, 2025 18:30
@DemiMarie DemiMarie force-pushed the relabel-rw-if-needed branch 2 times, most recently from b026dca to 360c8aa Compare January 7, 2025 19:07
@DemiMarie DemiMarie marked this pull request as ready for review January 8, 2025 03:26
@DemiMarie DemiMarie force-pushed the relabel-rw-if-needed branch from 360c8aa to 6a12d32 Compare January 8, 2025 03:28
@DemiMarie DemiMarie requested a review from marmarek January 8, 2025 03:29
@marmarek
Copy link
Member

marmarek commented Jan 8, 2025

shellcheck needs a comment near sourcing /etc/selinux/config

@DemiMarie DemiMarie force-pushed the relabel-rw-if-needed branch 3 times, most recently from 612c68c to 93141bd Compare January 8, 2025 17:57
Creating /.autorelabel must cause a Qubes OS VM to relabel everything,
as otherwise users will not be able to troubleshoot their systems and
upstream packages that create it will break.  However, it was ignored,
so fix that.

Furthermore, relabel the filesystem of a TemplateBasedVM whenever its
TemplateVM has been relabeled since the TemplateBasedVM was.  This
ensures that policy changes propagate to TemplateBasedVMs too.
@qubesos-bot
Copy link

qubesos-bot commented Jan 11, 2025

OpenQA test summary

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

Test run included the following:

New failures, excluding unstable

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

  • system_tests_basic_vm_qrexec_gui

  • system_tests_pvgrub_salt_storage

    • TC_10_VMSalt_archlinux: test_000_simple_sls (failure)
      AssertionError: Salt command '['qubesctl', '--skip-dom0', '--show-o...

    • TC_10_VMSalt_archlinux: test_001_multi_state_highstate (failure)
      AssertionError: Salt command '['qubesctl', '--skip-dom0', '--show-o...

    • TC_10_VMSalt_archlinux: test_003_update (failure)
      AssertionError: Salt command '['qubesctl', '--skip-dom0', '--show-o...

    • TC_10_VMSalt_archlinux: test_004_user_sls (failure)
      AssertionError: Salt command '['qubesctl', '--skip-dom0', '--show-o...

  • system_tests_extra

    • TC_00_PDFConverter_archlinux: test_000_one_page (failure)
      AssertionError: 127 != 0 : qvm-convert-pdf failed: b'bash: qvm-conv...

    • TC_00_PDFConverter_archlinux: test_001_two_pages (failure)
      AssertionError: 127 != 0 : qvm-convert-pdf failed: b'bash: qvm-conv...

    • TC_00_PDFConverter_archlinux: test_002_500_pages (failure)
      AssertionError: 127 != 0 : qvm-convert-pdf failed: b'bash: line 1: ...

    • TC_00_PDFConverter_archlinux: test_003_filename_with_spaces (failure)
      AssertionError: 127 != 0 : qvm-convert-pdf failed: b'bash: qvm-conv...

  • system_tests_guivm_gui_interactive

    • update_post_templates: Failed (test died)
      # Test died: command '(set -o pipefail; qubesctl --skip-dom0 --show...
  • system_tests_network_updates

    • TC_10_QvmTemplate_archlinux: test_000_template_list (failure)
      AssertionError: qvm-template failed: [Qrexec] ERROR: dnf command is...

    • TC_10_QvmTemplate_archlinux: test_010_template_install (failure)
      AssertionError: qvm-template failed: [Qrexec] ERROR: dnf command is...

  • system_tests_backupdispvm

    • TC_10_RestoreInDispVM_archlinux: test_000_basic_backup (error)
      qubesadmin.exc.QubesException: qvm-backup-restore tool missing in a...
  • system_tests_dispvm

    • TC_20_DispVM_archlinux: test_030_edit_file (failure + cleanup)
      AssertionError: Timeout waiting for editor window

    • TC_20_DispVM_archlinux: test_100_open_in_dispvm (error)
      subprocess.CalledProcessError: Command 'cat > /etc/thunderbird/pref...

  • system_tests_kde_gui_interactive

    • clipboard_and_web: unnamed test (unknown)
    • clipboard_and_web: Failed (test died)
      # Test died: no candidate needle with tag(s) 'clipboard-copy-notifi...
  • system_tests_guivm_vnc_gui_interactive

    • update_post_templates: Failed (test died)
      # Test died: command '(set -o pipefail; qubesctl --skip-dom0 --show...
  • system_tests_audio

  • system_tests_basic_vm_qrexec_gui_btrfs

  • system_tests_basic_vm_qrexec_gui_ext4

  • system_tests_basic_vm_qrexec_gui_xfs

  • system_tests_audio@hw1

  • system_tests_basic_vm_qrexec_gui@hw7

Failed tests

96 failures
  • system_tests_basic_vm_qrexec_gui

  • system_tests_pvgrub_salt_storage

    • TC_10_VMSalt_archlinux: test_000_simple_sls (failure)
      AssertionError: Salt command '['qubesctl', '--skip-dom0', '--show-o...

    • TC_10_VMSalt_archlinux: test_001_multi_state_highstate (failure)
      AssertionError: Salt command '['qubesctl', '--skip-dom0', '--show-o...

    • TC_10_VMSalt_archlinux: test_003_update (failure)
      AssertionError: Salt command '['qubesctl', '--skip-dom0', '--show-o...

    • TC_10_VMSalt_archlinux: test_004_user_sls (failure)
      AssertionError: Salt command '['qubesctl', '--skip-dom0', '--show-o...

  • system_tests_extra

    • TC_00_PDFConverter_archlinux: test_000_one_page (failure)
      AssertionError: 127 != 0 : qvm-convert-pdf failed: b'bash: qvm-conv...

    • TC_00_PDFConverter_archlinux: test_001_two_pages (failure)
      AssertionError: 127 != 0 : qvm-convert-pdf failed: b'bash: qvm-conv...

    • TC_00_PDFConverter_archlinux: test_002_500_pages (failure)
      AssertionError: 127 != 0 : qvm-convert-pdf failed: b'bash: line 1: ...

    • TC_00_PDFConverter_archlinux: test_003_filename_with_spaces (failure)
      AssertionError: 127 != 0 : qvm-convert-pdf failed: b'bash: qvm-conv...

  • system_tests_guivm_gui_interactive

    • update_post_templates: Failed (test died)
      # Test died: command '(set -o pipefail; qubesctl --skip-dom0 --show...
  • system_tests_network_updates

    • TC_10_QvmTemplate_archlinux: test_000_template_list (failure)
      AssertionError: qvm-template failed: [Qrexec] ERROR: dnf command is...

    • TC_10_QvmTemplate_archlinux: test_010_template_install (failure)
      AssertionError: qvm-template failed: [Qrexec] ERROR: dnf command is...

  • system_tests_backupdispvm

    • TC_10_RestoreInDispVM_archlinux: test_000_basic_backup (error)
      qubesadmin.exc.QubesException: qvm-backup-restore tool missing in a...
  • system_tests_dispvm

    • TC_20_DispVM_archlinux: test_030_edit_file (failure + cleanup)
      AssertionError: Timeout waiting for editor window

    • TC_20_DispVM_archlinux: test_100_open_in_dispvm (error)
      subprocess.CalledProcessError: Command 'cat > /etc/thunderbird/pref...

  • system_tests_kde_gui_interactive

    • clipboard_and_web: unnamed test (unknown)
    • clipboard_and_web: Failed (test died)
      # Test died: no candidate needle with tag(s) 'clipboard-copy-notifi...
  • system_tests_basic_vm_qrexec_gui_zfs

    • switch_pool: Failed (test died)
      # Test died: command 'qubes-dom0-update -y zfs' failed at /usr/lib/...
  • system_tests_guivm_vnc_gui_interactive

    • update_post_templates: Failed (test died)
      # Test died: command '(set -o pipefail; qubesctl --skip-dom0 --show...
  • system_tests_audio

  • system_tests_basic_vm_qrexec_gui_btrfs

  • system_tests_basic_vm_qrexec_gui_ext4

  • system_tests_basic_vm_qrexec_gui_xfs

  • system_tests_audio@hw1

  • system_tests_basic_vm_qrexec_gui@hw7

Fixed failures

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

3 fixed
  • system_tests_extra

    • TC_00_QVCTest_whonix-gateway-17: test_010_screenshare (failure)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^... AssertionError: 0 == 0
  • system_tests_kde_gui_interactive

    • gui_keyboard_layout: Failed (test died)
      # Test died: command 'test "$(cd ~user;ls e1*)" = "$(qvm-run -p wor...
  • system_tests_audio@hw1

Unstable tests

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.

3 participants