-
Notifications
You must be signed in to change notification settings - Fork 47
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
[4.2] Write vm-specific config values to qubesdb #936
Comments
Thanks for starting this ticket, @rocodes. I've expanded your list into a table tracing each value currently defined in Here's a straw proposal for how to handle each type:
But we don't have to settle this now. Next week I'll start working on the Salt states to get these values into |
I think |
I'm not really sure how to do this, but if it's possible and straightforward, it would be my preference just because it avoids us from needing to prepend
In principle I agree with this as step 3, but I would rather write small Python/Rust scripts that do this interpolation instead of relying on bash scripts and retrofitting error handling into them. |
@cfm and I discussed this more just now, starting with focusing on the proxy's needs and then looking at everything else. We started looking at point 2 of the straw proposal, and noticed that whether we set everything in the environment (likely via a shell), or use a with-vm-config wrapper, there is some intermediary between the process. Then we moved to, if we have to write/implement this intermediary, why not just stick it in the application itself? In the proxy v2 we read from an environment variable, which is great for non-Qubes testing, but there's no reason it couldn't also check with qubesdb first or after. The only other user we control is the client, which could have the same logic too (just in Python). The cases we don't control are Tor and GPG, which require us to write to a file, so we will already need some script to do that, which can read from QubesDB. |
Just as a general note, I'm a little skittish of managing the contents of sd-journalist.sec through qubesdb - the impact of a compromised vm getting hold of the fingerprint is zero (it's public) and of the JI address is mitigated by the login+2FA requirement, but the key has no protection beyond qubes-rpc policies and general VM isolation. It might be worth considering continuing to manage that one thing via the initial provisioning and not having it available in dom0 (ideally at all after the fact). (I'm thinking of a bug or config error that makes vm-specific qubesdb entries available to unspecified vms) |
It's a fair point, @zenmonkeykstop. The complications I see are that:
Nothing we do will change (2). But I'll think more about how we can reconcile (1) and your concern, which as you note is relevant just in the case of a bug, without requiring |
(1) is more of a guideline than an actual rule. This is a valid exception IMO. |
I agree, @zenmonkeykstop, except that to my eye it's a significant-enough exception that it may mean that the guideline itself is wrong (or at least incomplete). :-) Today I started looking into how the |
I think @zenmonkeykstop's point about sd-journalist.sec is fair, since we're not trying to protect the key from dom0, but from untrusted vms, and since only relying on one form of isolation does kind of break with our longstanding efforts of defense in depth. I also don't think it has to be all or nothing; if we start with the non sensitive (or less sensitive) credentials we will still have made significant headway in terms of making the configuration flexible and easier to reason about. I haven't thought it all the way through, but one idea could be, rather than putting the private key itself in qubesdb, to put one (or more) flag entries representing valid keys that are accepted for decrypting submissions. (For example, if we write pubkey fingerprint to qubesdb but still require the addition of the private key to the vm itself). This doesn't move us towards a disposable vault vm yet, but sets us on a path to using qubesdb to reason about the system's provisioning. Just trying to brainstorm a little here. |
Oh, the more I consider @zenmonkeykstop's concern in #936 (comment), the more convinced I am by it. I'm just trying to spell out the implications. Bear with me. We're trying to triangulate (read: test against reality :-) three of our work-in-progress principles, namely:
What I think we've just discovered is that as written there is a tension between (1) and (3) versus (2). That is, in assuming (1) and (3) for the purposes of this ticket, we've run up against the edge of our own comfort with (2). I think we're just missing half of it:
@zenmonkeykstop, I hear you prioritizing (2)(b) as an exception to (1) and (3). @rocodes, I hear you prioritizing (2)(b) as the thing we must preserve, versus (2) and (3) as things we should work towards incrementally. Acknowledged! My hypothesis is that we can still find a way to preserve (2)(b) with (1) and (3), especially given that (1) is a security goal in itself. Here's one version of what this could (eventually) look like:
Now, this approach would be out of the scope of this ticket, which is now all about (2)(a), excluding Footnotes
|
I'm sorry, @cfm, I had a bit of a hard time following your last, specifically this part:
I don't think I need it re- explained, I'll touch base with you oob if I need. (I was just +1'ing kev about sd-journalist.sec sensitivity, not necessarily stating a design principle/constraint). I don't think we have to all or nothing our disposability efforts (note: I don't think disposable == stateless; secrets are still somewhere!). I think we should make a plan to start with other components and then revisit the vault vm, which seems like what you and others are maybe saying too. I will add some thoughts on vault key stuff in a followup comment. |
Followup thoughts about vaults and keys
|
Thanks, @rocodes! I think the principles you've expressed in #936 (comment) are consistent with the approach I outlined at the end of #936 (comment). |
In Python, it turns out that we can do this trivially via In Rust: @legoktm, do you see a reason not to call |
Nice! I think we can do the same thing that we do for the PyQt packages in the client, which is create the virtualenv with try:
import QubesDB
except ImportError:
# Inside dev environment
QubesDB = False
Seems reasonable to me, as long as the Qubes team is providing a stable ABI (aka they're fine with us doing so). We should probably be aware of QubesOS/qubes-issues#8406 and do whatever necessary I think we'd do something at compile time, so something like: #[cfg(feature = "qubesdb")]
fn read(name: &str) -> Option<String> {
todo!("FFI wrapper around libqubesdb")
}
#[cfg(not(feature = "qubesdb"))]
fn read(name: &str) -> Option<String> {
env::var(name).ok()
} And then |
Thanks for the reality-check, @legoktm. I've drafted the Python version in freedomofpress/securedrop-client#1883 (with the caveat in freedomofpress/securedrop-client#1882) and started work on the Rust version. |
Here's an alternative way to install the Python QubesDB library that doesn't rely on diff --git a/client/pyproject.toml b/client/pyproject.toml
index bc317cf3..740f45bf 100644
--- a/client/pyproject.toml
+++ b/client/pyproject.toml
@@ -42,6 +42,7 @@ pytest-qt = "^4.2.0"
pytest-random-order = "*"
pytest-vcr = "*"
pytest-xdist = "^3.0.2"
+qubesdb = { git = "https://github.com/QubesOS/qubes-core-qubesdb", branch = "release4.1", subdirectory = "python"}
semgrep = "*"
translate-toolkit = "*"
types-polib = "*" Then after
It links against the system libqubesdb.so:
Now if you run
So we still have to install libqubesdb somehow, which (still) means pulling down the qubes apt repo. |
I've drafted the Rust implementation against |
Found another one which could benefit from being tracked / listed here #1029 |
We are setting the proxy's origin in QubesDB (via dom0 salt), and as discussed/agreed upon in <freedomofpress/securedrop-workstation#1013>, we're reading it directly in the proxy. We link directly to libqubesdb, generating the Rust wrapper with bindgen so it stays in sync (at build time at least). As a result, some unsafe is needed, but it is clearly annotated with relevant SAFETY notes. If we're not building with QubesDB (for development purposes), we'll continue to read from the environment and skip the bindgen and linking steps entirely. Fixes <freedomofpress/securedrop-workstation#853>. Co-authored-by: Kunal Mehta <[email protected]>
I believe #1051 and freedomofpress/securedrop-client#2032 now give us all the tools and options we've wanted here. Is there anything left on anyone's wishlist? |
I've taken the liberty of marking that #1051 |
Tracking/discussion. Let's make use of
.vm-config
part of qubesdb (internal to a VM) to store vm-specific configuration. Eventually this will allow us to get rid of config.json.Upstream documentation:
https://dev.qubes-os.org/projects/core-admin-client/en/latest/manpages/qvm-features.html#vm-config
Configurable components
dom0
[1]sd-app
sd-gpg
sd-log
sd-proxy
sd-whonix
$QUBES_GPG_DOMAIN
$QUBES_GPG_DOMAIN
[2]config.json:.environment
/etc/apt/sources.list.d/securedrop_workstation.list
config.json:.hidserv.hostname
/home/user/.securedrop_proxy/sd-proxy.yaml
[2]/var/lib/tor/keys/app_journalist.auth_private
[3]config.json:.hidserv.key
/var/lib/tor/keys/app_journalist.auth_private
[3]config.json:.submission_key_fpr
/home/user/.securedrop_client/config.json
[2]config.json:.vmsizes.sd_app
qvm-volume resize sd-app:private ...
config.json:.vmsizes.sd_log
qvm-volume resize sd-log:private ...
salt://sd/sd-journalist.sec
/home/user/.gnupg/sd-journalist.sec
[4]dom0
NB. Only testable on Qubes 4.2, where QubesDB starts to return
vm-config.*
as/vm-config/*
.Related
The text was updated successfully, but these errors were encountered: