Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This command provides functionality to pull security profiles from OCI registries, for example: ```console > ./build/spoc pull docker.io/saschagrunert/oras:latest 11:18:21.780411 Pulling profile from: docker.io/saschagrunert/oras:latest 11:18:21.780453 Verifying signature Verification for index.docker.io/saschagrunert/oras:latest -- The following checks were performed on each of these signatures: - Existence of the claims in the transparency log was verified offline - The code-signing certificate was verified using trusted certificate authority certificates [{"critical":{"identity":{"docker-reference":"index.docker.io/saschagrunert/oras"},"image":{"docker-manifest-digest":"sha256:8e88555d67c0871573a1fd161d1a9d9bea691959290232e90a83891d69e810c5"},"type":"cosign container image signature"},"optional":{"1.3.6.1.4.1.57264.1.1":"https://github.com/login/oauth","Bundle":{"SignedEntryTimestamp":"MEQCIHN8nkYyRN2YZSz7w9R4pswaPlDpaZRCAjcp5aCTVggCAiAXKuizJkZ+0MTubRqSzMwMzp7A+kDiFSeKmsxcv1QP1w==","Payload":{"body":"eyJhcGlWZXJzaW9uIjoiMC4wLjEiLCJraW5kIjoiaGFzaGVkcmVrb3JkIiwic3BlYyI6eyJkYXRhIjp7Imhhc2giOnsiYWxnb3JpdGhtIjoic2hhMjU2IiwidmFsdWUiOiJlYTg1ODNjZjU2MzE1NDRiNDg5ZGRiZjNhMDY3ZGQwMDA4ZWMxNWM3NzRlMmJiYmM3NWUzOTYzOTg1YTJhMDBjIn19LCJzaWduYXR1cmUiOnsiY29udGVudCI6Ik1FVUNJUUR0d282RnExbGN3bTd5ejc5SFhBNjJNRkpPc2JpazRwallVZkJFU2ErZi9RSWdQNDJxZXNNQ2R0bEFKNUtIQ3l0YzhWSWZWSFEvRERMcWhkRE1jY2FRN3dRPSIsInB1YmxpY0tleSI6eyJjb250ZW50IjoiTFMwdExTMUNSVWRKVGlCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2sxSlNVTnZha05EUVdscFowRjNTVUpCWjBsVlQyRkVRVVUyTTBoQ1ltVktRVVJDZWtSbFJuSnB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NZVc1MWFtZEJRVUZaWWlzS2FHMDVaa0ZCUVVWQmQwSklUVVZWUTBsUlJEa3dWbEZYYzNGTlduUnNjVVJvY0VwUlRraFJWbXgzVFVoTGNXeEtSRTVVYW1sUVdFUnZibEU1YUZGSlp3cEVOQzlSVW5KaFlTODRiV1poUVZsMFkxZHFSRXBEYTBGVVprOXRlRWRsTlcxbU1tcE1jR1JHZW5semQwTm5XVWxMYjFwSmVtb3dSVUYzVFVSaFFVRjNDbHBSU1hoQlVFOTNSbWMzVVdWNFJVTlZXRFE1V0N0RGNsSnBibTU2U0d0WWNtSXdXa0o2UlhaamN6RmtiSFpaZGpSR2JHMURkbmRtVUd4M2NXdzBiRUlLVURCQk0zbEJTWGRRYW5aUFYwa3djak5pTkd4clFqWjFOalZ2U1dGU01XbDBVa2R0VTJkR1RuaDRjM0ZOZHpjeGNsVmtlRUY2TTNKWlZtZFdhakJ2T0FwV1R6QmFhMDEyWWdvdExTMHRMVVZPUkNCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2c9PSJ9fX19","integratedTime":1679307470,"logIndex":15859996,"logID":"c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d"}},"Issuer":"https://github.com/login/oauth","Subject":"sgrunert@redhat.com"}}] 11:18:24.793283 Creating file store in: /tmp/pull-1676121632 11:18:24.793286 Verifying reference: docker.io/saschagrunert/oras:latest 11:18:24.793308 Creating repository for index.docker.io/saschagrunert/oras 11:18:24.793335 Using tag: latest 11:18:24.793336 Copying profile from repository 11:18:26.119253 Reading profile 11:18:26.119324 Trying to unmarshal seccomp profile 11:18:26.119995 Got SeccompProfile: echo 11:18:26.119998 Saving profile in: /tmp/profile.yaml ``` Which successfully pulls the image into the local directory: ``` > cat /run/user/1000/profile.yaml | head --- apiVersion: security-profiles-operator.x-k8s.io/v1beta1 kind: SeccompProfile metadata: name: echo spec: defaultAction: SCMP_ACT_ERRNO architectures: - SCMP_ARCH_X86_64 syscalls: ``` Images can be pushed in the same way using `spoc push`, which also signs them via sigstore: ```console > export USERNAME=saschagrunert > export PASSWORD=my-pw > ./build/spoc push docker.io/saschagrunert/oras:latest 11:17:40.037409 Pushing profile /run/user/1000/profile.yaml to: docker.io/saschagrunert/oras:latest 11:17:40.037430 Creating file store in: /run/user/1000/push-4212591343 11:17:40.037435 Adding profile to store: /run/user/1000/profile.yaml 11:17:40.037463 Packing files 11:17:40.037586 Verifying reference: docker.io/saschagrunert/oras:latest 11:17:40.037594 Using tag: latest 11:17:40.037598 Creating repository for index.docker.io/saschagrunert/oras 11:17:40.037602 Using username and password 11:17:40.037605 Copying profile to repository 11:17:41.708424 Signing container image Generating ephemeral keys... Retrieving signed certificate... Note that there may be personally identifiable information associated with this signed artifact. This may include the email address associated with the account with which you authenticate. This information will be used for signing this artifact and will be stored in public transparency logs and cannot be removed later. By typing 'y', you attest that you grant (or have permission to grant) and agree to have this information stored permanently in transparency logs. Your browser will now be opened to: https://oauth2.sigstore.dev/auth/auth?access_type=online&client_id=sigstore&code_challenge=58LCHWGyhOt5tGJJeJ-B7CuToZEEYDgGflLYDOYxv7g&code_challenge_method=S256&nonce=2NH423dlp97y9YtbIaV2mV49xjY&redirect_uri=http%3A%2F%2Flocalhost%3A40989%2Fauth%2Fcallback&response_type=code&scope=openid+email&state=2NH41yRpWYjoFNumCx7hAbiqeHt Successfully verified SCT... tlog entry created with index: 15859996 Pushing signature to: index.docker.io/saschagrunert/oras ``` Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
- Loading branch information