-
Notifications
You must be signed in to change notification settings - Fork 100
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
Sign/Verify with Non-PGP Key Material #1120
Conversation
d29c3c9
to
e7216cf
Compare
65cd03b
to
158763d
Compare
Extend singularity package to support signing with a signature.Signer and verifying with a signature.Verifier.
Add basic sign/verify using PEM-encoded SSL keys. Add E2E tests for the same.
a598e77
to
8c861ce
Compare
8c861ce
to
a0d3eb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good to me. I have a couple of questions...
-
Should the '--key' flag have an associated env var, so that it's straightforward to set a default key for all verification operations etc.?
-
If the top level
test
directory is only going to contain test data, and not code for tests, would it be reasonable to usetestdata
instead? As I understand it, the go toolchain would then ignore any.go
files in there.... which would make it a good place to 'hide' deprecated plugin examples that we may still need to test compile for a time, but don't want to keepin inexamples
, have appearing in go doc etc.
Directory and file names that begin with "." or "_" are ignored by the go tool, as are directories named "testdata".
👍 on centralising the test data. I think there might be some more that is essentially duplicated between unit and e2e tests, that should be found and dug out at some point when we have some time.
DefaultValue: "", | ||
Name: "key", | ||
Usage: "path to the private key file", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to associate this with an env var also?
Potentially a user could set an env var to have the key used always, without needing to specify the flag, in an environment that requires that?
DefaultValue: "", | ||
Name: "key", | ||
Usage: "path to the public key file", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto the signing - do we want to expose with an env var also?
Good idea, although this may introduce some subtlety for signing, since the type of signature being generated would then depend on the environment. Perhaps it would be worth adding some visual feedback? Environment variable not set: $ singularity sign image.sif
Signing image with PGP key material
Signature created and applied to image.sif Environment variable set:
I wonder if it might be worth following the guidelines here, as I think the current structure was based on those recommendations to some extent? That wouldn't preclude us from having a |
Also going to raise a situation that just occurred to me... in the event that an image is signed both with PGP and non-PGP key material: $ singularity sign image.sif
$ singularity sign --key private.pem image.sif This can't be successfully verified, since using $ singularity verify image.sif
Verifying image: image.sif
FATAL: Failed to verify container: integrity: key material not provided for DSSE envelope signature $ singularity verify --key public.pem image.sif
Verifying image: image.sif
FATAL: Failed to verify container: integrity: key material not provided for PGP clear-sign signature Perhaps |
Okay, agreed. I don't really think that pattern is one we should necessarily be wedded to, for the reasons articulated in golang-standards/project-layout#117 - but we are sorta following it in places :-)
That would make sense to me... but, tbh, I'd prefer to throw it out to at least some minimal discussion if we can. The reason being that there is also a bit of a question on and / or behavior on PGP signatures alone... before we possibly combine them with DSSE. This on the apptainer/sif fork also comes to mind once we think about signature combinations - apptainer/apptainer#462 R.E. the env var stuff... yup, the visual feedback makes perfect sense. These latter 2 points seem like they can be captured as separate issues, and addressed. So putting a ✅ on here now. |
Description of the Pull Request (PR):
Add
--key
option tosingularity sign
andsingularity verify
, which expect PEM-encoded key material that will be used to sign/verify the image. Add end-to-end tests to cover--key
usage.Extend
internal/app/singularity
package to support signing with asignature.Signer
and verifying with asignature.Verifier
.Centralize test keys and images that are used by multiple packages to
test/
.This fixes or addresses the following GitHub issues: