freedomofpress / securedrop-workstation

Qubes-based SecureDrop Journalist Workstation environment for submission handling
GNU Affero General Public License v3.0
141 stars 43 forks source link

Protect production users from setting up a dev or staging environment in error using production RPM #1058

Open zenmonkeykstop opened 5 months ago

zenmonkeykstop commented 5 months ago

Currently the RPM includes the test signing key and repo config - setting up a dev or staging environment involves changing the env setting involves changing one value in config.json and running sdw-admin --apply. This increases the risk that users may configure a test environment in error for a system intended for production.

There are a few options for guardrails we could put in place:

We should discuss and pick one.

zenmonkeykstop commented 5 months ago

My personal preference is for the last option - it seems like the simplest approach and is general in case we move away from Salt altogether.

rocodes commented 5 months ago

Just to expand a bit on the options here:

So I guess a slightly-more-friendly/packaged version of option 3 would be my vote--basically something that is long-term stable and doesn't get overwritten every time we run the updater, would be my criteria.

rocodes commented 5 months ago

rpm build options (option 2)

Initially I proposed conditional builds with macros ( if %buildcondition ...), where the conditions were on by default and represented prod settings. Now that we are managing those settings with systemd, what I would suggest instead for this "different RPMs" option would be to build workstation-dom0-config-dev, worksation-dom0-config-staging, and workstation-dom0-config-prod, based on the same .spec file and with most sections of the .spec file shared, and with the only differences in these packages being the .repo and signing pubkey file for easy diffing (so explicitly disallowing other forms of customization between RPMs).

That would look something like

# securedrop-workstation-dom0-config.spec
Name:       securedrop-workstation-dom0-config
Version:    0.10.0
Release:    1%{?dist}
Summary:    SecureDrop Workstation

[snip]

%install
[snip - unchanged from current]

%install dev
install -m files/test-key.asc %{buildroot}/etc/pki/rpm-gpg/RPM-GPG-SECUREDROP-WORKSTATION
install -m files/securedrop-workstation-dev.repo %{buildroot}/etc/yum.repos.d/securedrop-workstation-dom0.repo

%install staging
install -m files/securerop-release-key-2021.asc %{buildroot}/etc/pki/rpm-gpg/RPM-GPG-SECUREDROP-WORKSTATION
install -m files/securedrop-workstation-staging.repo %{buildroot}/etc/yum.repos.d/securedrop-workstation-dom0.repo

[snip]
%files
[unchanged]

%files dev
/etc/pki/rpm-gpg/RPM-GPG-SECUREDROP-WORKSTATION
/etc/yum.repos.d/securedrop-workstation-dom0.repo

%files staging
/etc/pki/rpm-gpg/RPM-GPG-SECUREDROP-WORKSTATION
/etc/yum.repos.d/securedrop-workstation-dom0.repo

[snip]

It's basically a lite version of the keyring package, without it being a separate keyring package. I'm not attached to this and it's not perfect, but it's one idea.

rocodes commented 5 months ago

Last idea: I think we could also combine the options, eg:

legoktm commented 5 months ago

I think it makes sense to discuss this as part of the SDW install story. Depending on how users get the key initially during bootstrapping affects how we split out the prod/test keys. For example, if we ship an external keyring package in qubes-contrib for prod users, it makes sense to tell dev users to manually install the test key.

zenmonkeykstop commented 5 months ago

I think it makes sense to discuss this as part of the SDW install story. Depending on how users get the key initially during bootstrapping affects how we split out the prod/test keys. For example, if we ship an external keyring package in qubes-contrib for prod users, it makes sense to tell dev users to manually install the test key.

We won't get to the separate keyring package for the initial 4.2 release, I guess this means we can defer this question for now.

rocodes commented 1 month ago

After thinking about it (and also related issues such as https://github.com/freedomofpress/securedrop-workstation/issues/1178) I am leaning towards something like this: