-
Notifications
You must be signed in to change notification settings - Fork 62
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
Support Private Sigstore with ENV config only. #320
Comments
I've been thinking for a bit that we should just port cc @znewman01 who knows more than I do about the TUF + Sigstore. 🙂 |
Alternatively, you should be able to set the Fulcio / Rekor certs manually via the following environment variables:
But you won't get all the TUF magic for root key management. See https://docs.sigstore.dev/cosign/custom_components/ for some documentation for how this works - this was written for cosign but it should be the same for gitsign as well |
Added |
Oh wow! That's super quick. Thanks @wlynch. Massively impressed with the support you all provide for this project! With that, will there be anything that needs to exist on disk still to use a private sigstore stack? Any certificates or files that should be present or will initialize pull everything it needs from config and env variables? |
I realized some context for my objective might help with understanding my request. Gitpod are making moves to add gitsign into all of there workspaces so that all commits from all users are automatically signed. I have some clients working on sensitive workloads that wish to host a private sigstore for their work. Gitpod provides a way for users or teams to define a set of environment variables that are loaded in to a gitpod workspace at startup. My objective is define a set of environment variables so that gitpods gitsign client automatically switches to the private sigstore instance, without the user having to run any additional scripts. I would ideally like it to silently switch over to the private sigstore for signing |
cc @priyawadhwa who's been looking into getting gitsign working with Chainguard's private sigstore service and might know some more tricks. |
Does this also handle populating the Timestamping service Authority trust roots using the specified TSA URL in env variables using the |
My worry is that this still requires a local file (the root.json) and a command Our workspaces are ephemeral and varied, and setting env vars is the only real universal way I have of configuring them all simultaneously |
@wlynch is there any appetite for this feature? We are keen to use a private sigstore stack, but the |
I'm open to it! If you have control over the user environment, you could consider a workaround like running If you're interested in adding this as a new feature, there's some subtleties we'd have to work through -
/cc @znewman01 who probably has opinions about this. 🙂 |
So most of our environments are virtualised, so limit access to the underlying image and OS, but environment variables are easy for us to configure, which is why I'm keen on this approach. We also have potentially a few different sigstores so being able to say which one a container is using just in those env variables, and being able to switch them around, would be massive.
I think so, though specifically I think we need to avoid the need to have a file on disk. That can certainly be another option, but if the JSON could instead be in the env variable's content that would be ideal for this kind of free flowing control.
Good question. I think if the env is present then it should be used. if no env is present then the default should be used, and if the user calls |
Taking a step back: Sigstore recommends using TUF as a single root of trust to distribute the root key material for Rekor/Fulcio. There are two actions that you would do:
This suggests to me that there are two knobs to configure: a TUF root to initialize from, and where the TUF repo state lives. Right now, we don't make it very easy to change either. Note that the "TUF root to initialize from" is only going to get used the first time.
Great, let's figure out what changes we need to make to support that use case, which seems reasonable. Are these environments ephemeral? So you're mostly just initializing the TUF configuration once? If that's the case, I'd actually consider skipping TUF and just supplying the root keys for Fulcio/Rekor directly in the config for these environments, as you're not really getting the benefits of TUF. If they're longer-lived, then you'll want configure both the initial TUF root and the location of the TUF repo in tandem.
I'd actually argue the opposite: if the local repo is configured, that should override the root to initialize from. The reason being that the local TUF repo will update the root of trust.
Despite my aesthetic objections to putting a file's worth of JSON in an environment variable, this should work 😛 So spitballing, I think I'd actually recommend the following (feel free to change the names):
A cleaner approach might be to introduce some notion of "profiles"—basically, a config file with a bunch of options. Then each profile could have its own TUF repo and all you'd have to do to switch between them is set |
Thanks @znewman01 , all that sounds very sensible and I defer to your expertise on the matter. Yes, our environments are meant to be ephemeral, so the initialize is the only part I think we need for us to focus on. As mentioned, we have limited ability to configure files into them, but env we can set easily. I agree, JSON in a env feels inelegant (maybe Base64 it?) But requiring the file is not something we can do at scale. An additional thought, would this also mean you could provide the json direct to I think the profile idea makes sense. I know that initialize is called automatically on first run of gitsign, and my worry was that this change might confuse some users. Having a profile which would mean users could explicitly choose to use a different setup if they want to would be great for testing and user freedom. All of this looks sensible though. Is there anything we can do to help delivery? |
There's some limits we'd need to worry about, though this will probably be okay in most cases? As an alternative, I was talking with @mnm678 yesterday and she recommended using the root mirror URL + checksum and the snapshot URL + checksum. e.g. SIGSTORE_TUF_ROOT_INIT="https://tuf-repo-cdn.sigstore.dev/1.root.json"
SIGSTORE_TUF_ROOT_INIT_SHA="cd7549b15e7b4e660a89c950bca1bce262a524a5cf909952b66951b5c8667bc6"
This would be easy to add -
👍 I'm also worried that it might be unexpected if we blow away the existing client cache because an environment variable is set, though as long as we have the profile /
If you're interested in contributing, https://github.com/sigstore/sigstore/blob/585296cf6ea94a9a808f82547727edbe1497362e/pkg/tuf/client.go#L351 is where you'd want to look! |
I like the checksum trick too, that feels less awkward than sticking the whole JSON in the env var. CC @haydentherapper—we've talked in the past about "grown-up" configuration management for Cosign and other Sigstore clients, like config files, "profiles", etc. |
I'd love to have a mapping between CLI flag, env var name, and profile configuration. We've got a mapping between the first two in Cosign currently, there might be a library we can pull in to take care of the latter. |
Description
I am currently running a Private Sigstore stack using the Scaffold Helm chart. I cureently have gitsign installed using the following:
using this I am able to get gitsign to properly sign the commits, however I am unable to get gitsign to verify any commits I make.
I understand this is something to do with TUF, and the documentation here is almost non-existant so I did some digging. I have tuf enabled and hosted via the scaffold helm chart, though I don't quite understand how this works or how to interact with it to properly manage my roots.
I have read that if you are using a private sigstore instance you must run
cosign initialize
first however this breaks my setup as I don't have cosign installed and I want to be able to configure everything using environment variables so I can easily point my machine at any private sigstore instance I wish.Is there a way to use only environment variables to configure gitsign to securely connect to, trust, and verify a private sigstore instance? I am happy to encode json into such a variable, or have a root.json file downloaded if it will help.
Is the scaffold helm chart complete and does its tuf config require any more additional manual steps? the helm chart has been deployed successfully and is running smoothly, but I am certain I've missed something.
The text was updated successfully, but these errors were encountered: