Repository navigation
Conversation
|
OpenQA should fail because the corresponding securedrop-admin PR hasn't been merged yet... |
|
@vickiniu I ended up finding the time to take a look at this today. So I'll grab it, if you don't mind. |
|
sounds great, thanks @deeplow ! |
deeplow
left a comment
There was a problem hiding this comment.
I appreciate the generalization already done of the USB testing. I've suggested a few changes.
| # sd-admin-usb: USB devices attached manually from dom0 (e.g. via the devices | ||
| # widget). Unlike sd-devices, sys-usb doesn't auto-attach (qubes.USBAttach). | ||
| qubes.USB * sd-admin-usb sys-usb allow |
There was a problem hiding this comment.
| # sd-admin-usb: USB devices attached manually from dom0 (e.g. via the devices | |
| # widget). Unlike sd-devices, sys-usb doesn't auto-attach (qubes.USBAttach). | |
| qubes.USB * sd-admin-usb sys-usb allow |
When the user attaches via dom0, this permission is already temporarily allowed, for the specified device. So, we shouldn't have this here.
More details in the usb-proxy's README.
There was a problem hiding this comment.
This actually had a side-effect. OpenQA failed here. It seems that our general deny rule is interfering with this.
The "temporary allowing" done by Qubes USB proxy is implemented with the legacy policy rules, where it should actually just be calling something like what qubes-video-companion does. I filed an issue: QubesOS/qubes-issues#11282.
Our immediate options to work around this:
- remove the
qubes.USBdeny rule and leave it up for defaults - explicitly allow (reverting my suggestion)
I think option 1. is preferable since:
- when doing attaching via GUI or
qvm-attachthe USB proxy ends up creating a rule per device instead of an overly-generic rule - we've also ran into problems in the past with these hard-coded USB rules for
qubes.USBAttach
There was a problem hiding this comment.
I would kind of prefer to to do 2 since that was working before
IIUC, once QubesOS/qubes-issues#11282 is resolved, then we can keep the deny rule and let it correctly create the allow rule?
There was a problem hiding this comment.
Per discussion w/ deeplow I'm going to go with option 1 for now.
2c2b621 to
2bc4459
Compare
This VM will be used for whenever the admin needs to mount USBs, e.g. formatting drives, or importing/exporting config. Abstract the USB mounting tests in sd-devices to be reusable for this VM without relying on the auto-attach logic. Fixes #1942
| @pytest.fixture(scope="module") | ||
| def qube_sd_admin_usb() -> QubeWrapper: | ||
| return QubeWrapper("sd-admin-usb") |
There was a problem hiding this comment.
OpenQA failed due to a missing qube fixture:
file /home/user/securedrop-workstation/tests/base.py, line 302
def test_vm_config_keys(self, qube: QubeWrapper) -> None:
E fixture 'qube' not found
The reason that's needed is because common tests in base.py, need to know what was the qube under testing. So in order to avoid needing test classes and subclassing, we need this qube fixture.
Two suggestions:
| @pytest.fixture(scope="module") | |
| def qube_sd_admin_usb() -> QubeWrapper: | |
| return QubeWrapper("sd-admin-usb") | |
| @pytest.fixture(scope="module") | |
| def qube() -> QubeWrapper: | |
| return QubeWrapper("sd-admin-usb") |
or
| @pytest.fixture(scope="module") | |
| def qube_sd_admin_usb() -> QubeWrapper: | |
| return QubeWrapper("sd-admin-usb") | |
| @pytest.fixture(scope="module") | |
| def qube_sd_admin_usb() -> QubeWrapper: | |
| return QubeWrapper("sd-admin-usb") | |
| @pytest.fixture(scope="module") | |
| def qube(qube_sd_admin_usb: QubeWrapper) -> QubeWrapper: | |
| return qube_sd_admin_usb |
There was a problem hiding this comment.
I do admit it's a bit non-intuitive. Maybe renaming it everywhere tested_qube helps? 🤔 #1983
There was a problem hiding this comment.
I'll rename it to qube for now.
|
Thanks for addressing this thorough review! Tests are failing, one specifically because of my suggestion. Please see my review comments. |
This needs freedomofpress/securedrop#7972 to be merged first.
For the purpose of creating Export Devices.
The primary purpose of this PR is to add the necessary RPC rule, however most of the code is adapting the existing USB attachment tests to support verifying sd-admin can also mount USBs.
Fixes #1942
Test plan
Checklist
This change accounts for:
rpm-build/SPECS/securedrop-workstation-dom0-config.spec)