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

Use bullseye templates on 4.1 and and use apt-test+nightlies repos for dev apt-test+main packages for staging #784

Merged
merged 15 commits into from
Jun 24, 2022

Conversation

eaon
Copy link
Contributor

@eaon eaon commented Jun 15, 2022

Description of Changes

Towards #600

Draft PR for now, but this will include a collection of 4.1 bullseye template related changes to salt state logic, as well as @legoktm's work from the bullseye-nightlies branch. It also removes the qa-switch.sh utility (at least for now) as it would introduce unnecessary complexity for keeping 4.0 compatibility, and at least for this upcoming stage of testing it isn't useful to us and could probably be implemented in a cleaner way if we need it again in the future.

Fixes #787

Testing

Qubes OS R4.1 only:

  • make dev installs without errors, with bullseye based templates which in turn use bullseye+nightlies repositories
  • make test in dom0 passes except for 1 failure about a securedrop-workstation-grsec that is not up to date (seems to be a nightly package/apt problem, the package hasn't been changed, there's no negative effects to this failure)

Checklist

  • I have updated MANIFEST.in and rpm-build/SPECS/securedrop-workstation-dom0-config.spec
  • I would appreciate help with the documentation

legoktm and others added 3 commits June 9, 2022 18:30
* `make dev` now defaults to installing nightlies, which restores the
  old behavior before the apt-test component split.
* Running qa-switch will now configure templates to use the "main"
  component, which is where release candidates go.
* Fix the list of templates that qa-switch modifies, so it actually
  works.

Co-authored-by: Cory Francis Myers <cory@freedom.press>
It's a weird tool that we don't really use in our current strategy and
would introduce unnecessary complexity if we want to keep compatibility
with 4.0 and 4.1 at the same time as we have done so far.
* dev environment uses apt-test nightlies repo for Debian, and yum-test
  for dom0
* staging environment uses apt-test main repo for Debian, and yum-test
  for dom0
* prod environment uses apt main repo for Debian and yum for dom0
@cfm cfm self-requested a review June 15, 2022 01:06
@eaon eaon force-pushed the 600-bullseye-template-and-repo-magic branch 4 times, most recently from cfd6baa to 9d57526 Compare June 15, 2022 23:24
@eaon eaon force-pushed the 600-bullseye-template-and-repo-magic branch 3 times, most recently from 0954d44 to 0b790cd Compare June 16, 2022 17:03
@sssoleileraaa
Copy link
Contributor

Test Plan

  • make dev installs
  • make test passes for both 4.0 and 4.1
    ^ Should be sufficient before we enter phase 1 QA, right?

@sssoleileraaa
Copy link
Contributor

@sssoleileraaa
Copy link
Contributor

Deployment

@eaon eaon marked this pull request as ready for review June 16, 2022 22:41
@cfm
Copy link
Member

cfm commented Jun 17, 2022

As of 62224e7:

Qubes OS R4.0

  • make dev installs without errors, with buster based templates which in turn use buster+nightlies repositories

Exits 20:

Add SecureDrop export device handling to sys-usb
sys-usb:
  
  Summary for sys-usb
  -----------
  Succeeded: 0
  Failed:   0
  -----------
  Total states run:    0
  Total run time:  0.000 ms
  • make test in dom0 passes

Qubes OS R4.1

  • make dev installs without errors, with bullseye based templates which in turn use bullseye+nightlies repositories
  • make test in dom0 passes

With the following patch, passes except for tests:

  • test_sd_export_package_installed
  • test_mime_types
  • test_all_sd_vms_uptodate
  • test_debian_keyring_config
diff --git a/tests/test_dom0_rpm_repo.py b/tests/test_dom0_rpm_repo.py
index 99cb395..5362e58 100644
--- a/tests/test_dom0_rpm_repo.py
+++ b/tests/test_dom0_rpm_repo.py
@@ -2,6 +2,14 @@ import json
 import unittest
 
 
+DEBIAN_VERSION = "bullseye"
+FEDORA_VERSION = "f32"
+with open("/etc/qubes-release") as qubes_release:
+    if "R4.0" in qubes_release.read():
+        DEBIAN_VERSION = "buster"
+        FEDORA_VERSION = "f25"
+
+
 class SD_Dom0_Rpm_Repo_Tests(unittest.TestCase):
 
     pubkey_wanted = ""
@@ -9,8 +17,8 @@ class SD_Dom0_Rpm_Repo_Tests(unittest.TestCase):
     pubkey_actual = "/etc/pki/rpm-gpg/RPM-GPG-KEY-securedrop-workstation"  # noqa
     pubkey_wanted_prod = "sd-workstation/securedrop-release-signing-pubkey-2021.asc"
     pubkey_wanted_test = "sd-workstation/apt-test-pubkey.asc"
-    yum_repo_url_prod = "https://yum.securedrop.org/workstation/dom0/f25"
-    yum_repo_url_test = "https://yum-test.securedrop.org/workstation/dom0/f25"
+    yum_repo_url_prod = f"https://yum.securedrop.org/workstation/dom0/{FEDORA_VERSION}"
+    yum_repo_url_test = f"https://yum-test.securedrop.org/workstation/dom0/{FEDORA_VERSION}"
 
     def setUp(self):
         # Enable full diff output in test report, to aid in debugging
diff --git a/tests/test_vms_exist.py b/tests/test_vms_exist.py
index 90cc499..0d7295c 100644
--- a/tests/test_vms_exist.py
+++ b/tests/test_vms_exist.py
@@ -5,7 +5,7 @@ from qubesadmin import Qubes
 from base import WANTED_VMS
 
 
-EXPECTED_KERNEL_VERSION = "4.14.241-grsec-workstation"
+EXPECTED_KERNEL_VERSION = "5.15.41-grsec-workstation"  # whoops; make conditional!
 
 DEBIAN_VERSION = "bullseye"
 with open("/etc/qubes-release") as qubes_release:
diff --git a/tests/test_vms_platform.py b/tests/test_vms_platform.py
index 31d7e2a..25917c5 100644
--- a/tests/test_vms_platform.py
+++ b/tests/test_vms_platform.py
@@ -6,13 +6,15 @@ from qubesadmin import Qubes
 from base import WANTED_VMS, CURRENT_FEDORA_TEMPLATE
 
 
+BULLSEYE_STRING = "Debian GNU/Linux 11 (bullseye)"
+BUSTER_STRING = "Debian GNU/Linux 10 (buster)"
 with open("/etc/qubes-release") as qubes_release:
     if "R4.1" in qubes_release.read():
-        SUPPORTED_SD_PLATFORMS = ["Debian GNU/Linux 11 (bullseye)"]
+        SUPPORTED_SD_PLATFORMS = [BULLSEYE_STRING]
     else:
-        SUPPORTED_SD_PLATFORMS = ["Debian GNU/Linux 10 (buster)"]
+        SUPPORTED_SD_PLATFORMS = [BUSTER_STRING]
 
-SUPPORTED_WHONIX_PLATFORMS = ["Debian GNU/Linux 11 (bullseye)"]
+SUPPORTED_WHONIX_PLATFORMS = [BULLSEYE_STRING]
 
 
 apt_url = ""
@@ -29,10 +31,9 @@ class SD_VM_Platform_Tests(unittest.TestCase):
             if "environment" not in config:
                 config["environment"] = "dev"
 
-            if "buster" in SUPPORTED_SD_PLATFORMS:
+            dist = "bullseye"
+            if BUSTER_STRING in SUPPORTED_SD_PLATFORMS:
                 dist = "buster"
-            elif "bullseye" in SUPPORTED_SD_PLATFORMS:
-                dist = "bullseye"
 
             if config["environment"] == "prod":
                 self.apt_url = FPF_APT_SOURCES.format(dist=dist, component="main")

`fedora-35-dvm` does not magically come into existence just by
installing the `fedora-35` template, but we do want to update the
sys-vms that use disposable templates to the most recent Fedora template
we support, so we just create it before updating the qube preferences.

We also create `sd-fedora-dvm`, which we need to customize to support
consistent USB auto-attach to sd-devices
@eaon eaon force-pushed the 600-bullseye-template-and-repo-magic branch from 62224e7 to 2225bfa Compare June 17, 2022 00:39
@cfm cfm force-pushed the 600-bullseye-template-and-repo-magic branch from 14bb418 to 0fdbed4 Compare June 17, 2022 01:03
@eloquence
Copy link
Member

Trying to make dev from this branch, I get many Jinja syntax errors of the form:

  [CRITICAL] Rendering SLS 'base:sd-logging-setup' failed: Jinja syntax error: expected token ',', got 'for'; line 4
  
  ---
  # -*- coding: utf-8 -*-
  # vim: set syntax=yaml ts=2 sw=2 sts=2 et :
  
  {% if grains['id'] in [name.format(grains['oscodename']) for name in ["securedrop-workstation-{}", "sd-small-{}-template", "sd-large-{}-template"]] %}    <======================
  include:
    - fpf-apt-repo

It looks like the for syntax used here is erroring out at least on my system, if that's working for you/others, let's do a bit of a version comparison.

Dropping support for 4.0 to avoid unnecessary complexity. This removes
4.0 support from: salt states, scripts, Makefile, and tests.

(Also removes sd-devices from sd-workstation.top as it's a DispVM rather
than a DispVM template)
@eaon eaon force-pushed the 600-bullseye-template-and-repo-magic branch from 6743412 to 3181092 Compare June 23, 2022 15:51
Update to signing key with 2023 expiry
@sssoleileraaa
Copy link
Contributor

Running through the test plan in #786 (comment) for Qubes 4.1, and will update here in case there are any issues.

@sssoleileraaa sssoleileraaa mentioned this pull request Jun 23, 2022
5 tasks
@eloquence
Copy link
Member

I took the liberty to remove a tiny print statement (8060842), for testing purposes it should not matter whether you're including that commit or not.

"remove",
"qubes-template-securedrop-workstation-buster",
]
)
Copy link
Member

Choose a reason for hiding this comment

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

Should this be removed, or updated to remove the Bullseye template?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So what's happening here is that while the qubes-template-securedrop-workstation-bullseye rpm exists, it's not installed via DNF and doesn't show up when you list installed packages. As far as I can tell, the qvm-template tool installs the relevant template files but then discards the downloaded package, which saves space when compared to 4.0. So the keep template functionality would have to be implemented in a different manner to avoid repeated downloads. I'll file a new ticket for this, but I don't think it's a problem for the first 4.1 release as it's a developer convenience feature

@eloquence
Copy link
Member

eloquence commented Jun 24, 2022

  • make dev installs without errors, with bullseye based templates which in turn use bullseye+nightlies repositories

  • ❌ make test in dom0 passes except for 1 failure about a securedrop-workstation-grsec that is not up to date (seems to be a nightly package/apt problem, the package hasn't been changed, there's no negative effects to this failure)

  • I can reproduce the securedrop-workstation-grsec issue. I've opened [4.1] securedrop-workstation-grsec package not upgradeable #793 for that, and added a hypothesis about what might be causing it.

  • I get one additional test failure related to the MIME tests (test_mime_types). Our test fixture hasn't been updated yet to account for the eog.desktop -> org.gnome.eog.desktop changes in Update securedrop-workstation-config for bullseye, refrain from building buster nightlies securedrop-builder#349 and checks for eog.desktop explicitly:

image/jpeg=eog.desktop
image/gif=eog.desktop
image/tiff=org.gnome.Evince.desktop
image/png=eog.desktop
image/svg+xml=eog.desktop

@eloquence
Copy link
Member

eloquence commented Jun 24, 2022

Beyond that, things are looking great so far.

  • Updater is happily updating Bullseye templates
  • Auto-attach for USB device is working
  • securedrop-client is starting without AppArmor denials

(I've not tested client functionality yet as this workstation is provisioned with a dummy configuration for now.)

After freedomofpress/securedrop-builder#349, this change is
required for SD_Viewer_Tests.test_mime_types() to pass on Debian
bullseye (thus, Qubes 4.1) and will fail on Debian buster (thus, Qubes
4.0).
@cfm cfm force-pushed the 600-bullseye-template-and-repo-magic branch from 933ae9e to d2a2a52 Compare June 24, 2022 01:07
Copy link
Member

@cfm cfm left a comment

Choose a reason for hiding this comment

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

Beyond @eloquence's findings, I'm able to sign off on the test plan as below! I'm approving but leaving for @eaon or @creviera to do the merging honors tomorrow. :-)

  • make dev installs without errors, with bullseye based templates which in turn use bullseye+nightlies repositories

After make clean, make dev passed after several runs encountered transient failures:

  • in DNS resolution (probably due to something weird with my sys-net); and

  • from qvm-sync-appmenus in sd-devices-template-sync-appmenus.

  • make test in dom0 passes except for 1 failure about a securedrop-workstation-grsec that is not up to date (seems to be a nightly package/apt problem, the package hasn't been changed, there's no negative effects to this failure)

With d2a2a52. Following 3181092, this entails that SD_Viewer_Tests.test_mime_types() will begin to fail on buster. If this is not acceptable, this commit should be refactored to parameterize the test.

@sssoleileraaa
Copy link
Contributor

Thanks everyone for all the hard work 🚀

@sssoleileraaa sssoleileraaa merged commit b7eebfe into main Jun 24, 2022
@sssoleileraaa sssoleileraaa deleted the 600-bullseye-template-and-repo-magic branch June 24, 2022 17:38
@eloquence eloquence mentioned this pull request Jun 28, 2022
@eaon eaon mentioned this pull request Mar 22, 2023
6 tasks
cfm pushed a commit that referenced this pull request Apr 1, 2024
…-repo-magic

Use bullseye templates on 4.1 and and use apt-test+nightlies repos for dev apt-test+main packages for staging
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.

Updater needs to reference Bullseye templates on 4.1
5 participants