Pulp
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: Container signing/verification support tags: Container plugin --- # Container signing/verification support - #### Container signing and verification EPIC https://pulp.plan.io/issues/9502 ## Container Signature usecases (Treat signature as a content in pulp) ### Signature sync https://pulp.plan.io/issues/9507 **(MVP)** As a user I want to sync containers with its original signatures * from sigstore * **from extentions API** **(MVP)** As a user on re-sync I want to sync new signatures ### Signature removal https://pulp.plan.io/issues/9512 **(MVP)** As a user, I have signatures garbage collected with manifest deletion(from pulp) **(MVP)** As a user when I remove manifest from a repo its signatures are removed as well https://pulp.plan.io/issues/9582 ### Content signing https://pulp.plan.io/issues/9509 As a user I want to sign content: - **What is the criteria?** - **(MVP)** per repo: sign every manifest in this repo (signing service has a relation to a repo) and add those signatures to the repo - POST /v3/repositories/container/container/<id>/sign/ - **(MVP)** per content/list of content in the repo - sign specific content from this repo (signing service has a relation to a repo) and add signature(s) to it - POST /v3/repositories/container/container/<id>/sign/ list_of_content_hrefs=[] - *per content/list of content in pulp - sign specific content and create signature for it. Signature will not be part of any repo, it can be deleted from pulp since it is an orphan. Signature can be added to a repo.Does this usecase make sense?* - *POST /v3/content/container/manifest/<manifest-id>/sign/ signing_service_href* ### Signature invalidation - https://pulp.plan.io/issues/9557 As a user I want to invalidate(remove from repo) existing signatures: - API TBD - **What is the criteria?** - **(MVP) invalidate per key**(due to the key rotation, key leakage): find all content that was signed with this key, lock on the repos that has this content, remove signatures, create new repo-versions - add a field on signature model that contains info about the key(fingerprint) or signing service? - https://en.wikipedia.org/wiki/Certificate_revocation_list /OCSP protocol TODO read more on this - **per repo**: lock on the repo, remove all signatures from repo, create new repo-version - **per content in repo**: lock on the repo, remove the content signatures from repo, create new repo-version - **per content in pulp** - find all repos it is present in, lock repos, remove signatures, create new repo-versions. **Does this usecase make sense?** ### Signature import/export - https://pulp.plan.io/issues/9558 **(MVP)** As a user, I have my signatures imported/exported together with the content - will work out of the box, just add new signature content entry to the modelresources list( valid for synced repos only) ### Signature push/pull via Container Registry API **(MVP)** As a user, I can push(create) signature via docker api extentions https://pulp.plan.io/issues/9511 :::info Note that container/image(library) code checks for manifest exitense first i.e signature cannot exist without manifest ::: ```bash $ curl -X PUT --data @signature.json http://<registry_endpoint>:24817/extensions/v2/<namespace>/<repo-name>/signatures/<imagesha256digest> cat signature.json { "version": 2, "type": "atomic", "name": "sha256:4028782c08eae4a8c9a28bf661c0a8d1c2fc8e19dbaae2b018b21011197e1484@cddeb7006d914716e2728000746a0b23", "content": "<base64 encoded signature>", } ``` **(MVP)** As a user, I can get/list signatures via docker api extentions https://pulp.plan.io/issues/9513 ```bash GET /extensions/v2/<namespace>/<repo-name>/signatures/ GET /extensions/v2/<namespace>/<repo-name>/signatures/<imagesha256digest> ``` ### Signature management via pulp API **(MVP)** As a user, I can get/list signatures via pulp api - **GET /v3/content/container/signatures/** - **GET /v3/content/container/signatures/<signature-id>/** ### Post-MVP? (To be discussed) **As a user I can audit existing content and verify its' signature - https://pulp.plan.io/issues/9581 - wait until December 13 meeting, might get into MVP** -- not going into MVP As a user when I copy manifest only manifest is copied by default As a user when I copy signature, its manifest is copied as well * NOTE: it does not make sense to cope signatures between the repos, docker-refence will stay same while base_path from distribution will differ As a user I can add signatures to the repo but ensure such manifest is already present in the repo As a user I can remove signatures from repos ### Testing related to sigstore #### Repositories EXD does not want to help with test content, so we are on our own. Ideally, find repositories on registry.redhat.io which are tiny in size and are deprecated https://catalog.redhat.com/software/containers/search?include_deprecated=1 (so the repositories do not change) with the following content: * a tagged and signed image with docker-reference as a tag * a tagged and signed image with docker-reference as a digest (unlikely to be found) * a manifest list with a signed per-arch images It would be great to find also: * a repo with a mixed content (some signed, some not), or wait till we can properly test pulp2pulp sync. * a repo with no signatures (but registry is supporting sigstore - can be mimicked) #### High-level test scenarios * Test that repositories found above are synced successfully: * if sigstore is not provided, signatures are not synced * if sigstore is provided, signatures are synced * Test that repositories with no signatures sync successfully: * sigstore is provided, registry supports sigstore * Test signed_only option * should not work if registry does not support either sigstore or docker API extensions * syncs all content and their signatures for a repo where all content has signatures * syncs only signed content and their signatures for a repo with a mix of signed and not signed content * does not sync any content for a repo where no signatures are available (but registry is supporting sigstore or the docker API extension) * does not sync a manifest list at all if any of its per-arch images are not signed * Test bad signature handling * this requires our own solution, aka simulate/mock that registry returned a bad signature * sync should skip bad signatures and not fail * if signed_only=True, and content has only bad signatures, it should not be synced * if signed_only=True, and a per-arch has only bad signatures, its manifest list and related images should not be synced at all ### Container Signature model - https://github.com/openshift/openshift-docs/pull/3556/files ```py class ContainerManifestSignature(Content): PROTECTED_FROM_RECLAIM = False TYPE = "signature" name = models.CharField(max_length=255, db_index=True) content = Binaryfield() manifest_digest type creator timestamp manifest = models.ForeignKey(Manifest, on_delete=models.CASCADE) key_id = models.CharField(max_length=255, db_index=True) sha256_encrypted_file = class Meta: default_related_name = "%(app_label)s_%(model_name)s" unique_together = ("sha256_encrypted_file", "manifest_digest") ``` uniqueness constraint - name FK to Manifest add a field that contains info about the key(fingerprint)? **Read till here :)** --- Investigation part: #### Container image signing workflow https://www.redhat.com/en/blog/container-image-signing https://www.redhat.com/en/blog/signed-images-red-hat-container-catalog https://access.redhat.com/articles/2750891 #### Red Hat container sigstore https://access.redhat.com/webassets/docker/content/sigstore https://registry.redhat.io/containers/sigstore https://access.redhat.com/articles/3116561 https://access.redhat.com/security/team/key https://registry.redhat.io/containers/sigstore/ubi8/ubi-micro@sha256=43520d9634eaaa007a697be79eb604fcbfd348afe5e620c1407629bf20ced542/signature-1 #### Registry Sigstore config https://github.com/containers/image/blob/main/docs/containers-registries.d.5.md https://github.com/containers/image/blob/main/docs/containers-registries.d.5.md#developing-and-signing-containers-staging-signatures * one can have sigstore per namespace but not multiple sigstores per registry * "file:/// signature storage can be both read and written, http/https only supports reading." #### Container Signature specs https://github.com/containers/image/blob/main/docs/signature-protocols.md https://github.com/containers/image/blob/main/docs/containers-signature.5.md * the signatures are associated with an immutable image. * An image can have any number of signatures so signature distribution systems SHOULD support associating more than one signature with an image. * is a blob which contains a cryptographic signature in an industry-standard format, carrying a signed JSON payload (i.e. the blob contains both the JSON document and a signature of the JSON document; it is not a “detached signature” with independent blobs containing the JSON document and a cryptographic signature). * Consumers of container signatures SHOULD verify the cryptographic signature against one or more trusted public keys defined in policy * "type": "atomic container signature" TODO - ask why only this type? * * because that's the only supported today * important note on the schema1 manifests https://github.com/containers/image/blob/main/docs/containers-signature.5.md#criticalimagedocker-manifest-digest #### Registry Signature API extension https://docs.openshift.com/container-platform/3.10/admin_guide/image_signatures.html#accessing-image-signatures-using-registry-api https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/managing_containers/signing_container_images https://github.com/openshift/origin/pull/12504/files https://github.com/openshift/openshift-docs/pull/3556/files https://github.com/mtrmac/image/commit/6c17ca34793b19accc3d278fc93ce68e9943fcb4 `X-Registry-Supports-Signatures` * it supports only Atomic sig. type #### Container image verification Policy Policy should be configured on the client, it gets applied on pull/run commands https://github.com/containers/image/blob/main/docs/containers-policy.json.5.md https://github.com/containers/image/blob/main/docs/containers-policy.json.5.md#examples * condition evaluation? 2 condition as or? * no lazy evaluation both conditions should be satisfied ``` "hostname:5000/vendor/product": [ { /* Require the image to be signed by the original vendor, using the vendor's repository location. */ "type": "signedBy", "keyType": "GPGKeys", "keyPath": "/path/to/vendor-pubkey.gpg", "signedIdentity": { "type": "exactRepository", "dockerRepository": "vendor-hostname/product/repository" } }, { /* Require the image to _also_ be signed by a local reviewer. */ "type": "signedBy", "keyType": "GPGKeys", "keyPath": "/path/to/reviewer-pubkey.gpg" } ], ``` #### Sign and push sig to the local(not shared) sigstore https://github.com/containers/podman/blob/main/docs/tutorials/image_signing.md $ cat /etc/containers/registries.d/default.yaml | tail -10 ``` docker: localhost:24817: #sigstore: http://inapprivateregistry.com/sigstore/ #sigstore: https://registry.redhat.io/containers/sigstore sigstore-staging: file:///var/lib/containers/sigstore registry.redhat.io: sigstore: https://registry.redhat.io/containers/sigstore #sigstore-staging: /mnt/nfs/privateregistry/sigstore (pulp) [vagrant@pulp3-source-fedora34 ~]$ ``` gpg2 --gen-key gpg2 --armor --export --output mysignkey.gpg ipanova@redhat.com gpg2 --list-keys sudo -E GNUPGHOME=/home/vagrant/.gnupg podman push --log-level=debug --tls-verify=false --sign-by ipanova@redhat.com localhost:24817/alpine #### Evaluate skopeo/podman/co-sign https://github.com/sigstore/cosign https://github.com/containers/skopeo/blob/main/docs/skopeo-standalone-sign.1.md https://github.com/containers/skopeo/blob/main/docs/skopeo-standalone-verify.1.md Cosign stores signatures as manifests, so no additional registry API needs to be created Skopeo/Podman do not support cosign but there are plans to integrate with Cosign signatures will not be deleted or garbage-collected when the image is deleted

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully