-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Image Signing #8371
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
Image Signing #8371
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,8 @@ type Image struct { | |
| DockerImageManifest string | ||
| // DockerImageLayers represents the layers in the image. May not be set if the image does not define that data. | ||
| DockerImageLayers []ImageLayer | ||
| // Signatures holds all signatures of the image. | ||
| Signatures []ImageSignature | ||
| } | ||
|
|
||
| // ImageLayer represents a single layer of the image. Some images may have multiple layers. Some may have none. | ||
|
|
@@ -76,6 +78,99 @@ type ImageLayer struct { | |
| Size int64 | ||
| } | ||
|
|
||
| const ( | ||
| // The supported type of image signature. | ||
| ImageSignatureTypeAtomicImageV1 string = "AtomicImageV1" | ||
| ) | ||
|
|
||
| // ImageSignature holds a signature of an image. It allows to verify image identity and possibly other claims | ||
| // as long as the signature is trusted. Based on this information it is possible to restrict runnable images | ||
| // to those matching cluster-wide policy. | ||
| // There are two mandatory fields provided by client: Type and Content. They should be parsed by clients doing | ||
| // image verification. The others are parsed from signature's content by the server. They serve just an | ||
| // informative purpose. | ||
| type ImageSignature struct { | ||
| // Required: Describes a type of stored blob. | ||
| Type string | ||
| // Required: An opaque binary string which is an image's signature. | ||
| Content []byte | ||
| // Conditions represent the latest available observations of a signature's current state. | ||
| Conditions []SignatureCondition | ||
|
|
||
| // Following metadata fields will be set by server if the signature content is successfully parsed and | ||
| // the information available. | ||
|
|
||
| // A human readable string representing image's identity. It could be a product name and version, or an | ||
| // image pull spec (e.g. "registry.access.redhat.com/rhel7/rhel:7.2"). | ||
| ImageIdentity string | ||
| // Contains claims from the signature. | ||
| SignedClaims map[string]string | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will hold arbitrary new claims added in the future that are interesting but not standard enough to become first-class fields. All the claims, once stored, will need to be kept in this mapping as well - even if they later become first-class fields. |
||
| // If specified, it is the time of signature's creation. | ||
| Created *unversioned.Time | ||
| // If specified, it holds information about an issuer of signing certificate or key (a person or entity | ||
| // who signed the signing certificate or key). | ||
| IssuedBy *SignatureIssuer | ||
| // If specified, it holds information about a subject of signing certificate or key (a person or entity | ||
| // who signed the image). | ||
| IssuedTo *SignatureSubject | ||
| } | ||
|
|
||
| // These are valid conditions of an image signature. | ||
| const ( | ||
| // SignatureTrusted means the signing key or certificate was valid and the signature matched the image at | ||
| // the probe time. | ||
| SignatureTrusted = "Trusted" | ||
| // SignatureForImage means the signature matches image object containing it. | ||
| SignatureForImage = "ForImage" | ||
| // SignatureExpired means the signature or its signing key or certificate had been expired at the probe | ||
| // time. | ||
| SignatureExpired = "Expired" | ||
| // SignatureRevoked means the signature or its signing key or certificate has been revoked. | ||
| SignatureRevoked = "Revoked" | ||
| ) | ||
|
|
||
| /// SignatureConditionType is a type of image signature condition. | ||
| type SignatureConditionType string | ||
|
|
||
| // SignatureCondition describes an image signature condition of particular kind at particular probe time. | ||
| type SignatureCondition struct { | ||
| // Type of job condition, Complete or Failed. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cp error
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thanks! Addressed in #9181 |
||
| Type SignatureConditionType | ||
| // Status of the condition, one of True, False, Unknown. | ||
| Status kapi.ConditionStatus | ||
| // Last time the condition was checked. | ||
| LastProbeTime unversioned.Time | ||
| // Last time the condition transit from one status to another. | ||
| LastTransitionTime unversioned.Time | ||
| // (brief) reason for the condition's last transition. | ||
| Reason string | ||
| // Human readable message indicating details about last transition. | ||
| Message string | ||
| } | ||
|
|
||
| // SignatureGenericEntity holds a generic information about a person or entity who is an issuer or a subject | ||
| // of signing certificate or key. | ||
| type SignatureGenericEntity struct { | ||
| // Organization name. | ||
| Organization string | ||
| // Common name (e.g. openshift-signing-service). | ||
| CommonName string | ||
| } | ||
|
|
||
| // SignatureIssuer holds information about an issuer of signing certificate or key. | ||
| type SignatureIssuer struct { | ||
| SignatureGenericEntity | ||
| } | ||
|
|
||
| // SignatureSubject holds information about a person or entity who created the signature. | ||
| type SignatureSubject struct { | ||
| SignatureGenericEntity | ||
| // If present, it is a human readable key id of public key belonging to the subject used to verify image | ||
| // signature. It should contain at least 64 lowest bits of public key's fingerprint (e.g. | ||
| // 0x685ebe62bf278440). | ||
| PublicKeyID string | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why this would be
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just trying to establish what someone familiar with signatures would expect in the usage here - fingerprint vs id.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Key ID is a shortened key fingerprint. Usually its lowest 32 or 64 bits. My reasoning for including ID instead of fingerprint is that this field is meant to be for diplaying. Not for verification. Clients that want to verify the signature should deal with The full fingerprint may be very long depending on algorithm used. It this were
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, that's the clarity I wanted. |
||
| } | ||
|
|
||
| // ImageStreamList is a list of ImageStream objects. | ||
| type ImageStreamList struct { | ||
| unversioned.TypeMeta | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
I should usually be able to get a
SignerSubjectandCertificateSubjectright? That would tell me which signing key was used and theCertificateSubjectwould let me know who confirmed the cert.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.
Sadly, GPG signatures do not carry full public keys, only key IDs, so we don’t automatically know the “certificate subject” (text describing the public key).
Of course if the public key is trusted per policy, the policy will have a copy of the key. Or we could ask a key server, and perhaps get a copy.
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.
I think the field is useful enough to have and if the server has sufficient information to complete it, it should do so. Knowing it was signed by
openshift-builderormycompany-operationsis valuable.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.
Maybe a full explosion of "Issued By" and "Issued To"