Skip to content
This repository was archived by the owner on Oct 10, 2020. It is now read-only.
This repository was archived by the owner on Oct 10, 2020. It is now read-only.

Atomic pull tries to get signature files that don't exist off http sigstore #1251

Description

@ServerNinja

My problem:

The issue is that when I do an sudo atomic pull, it tries to download signature-1 and then signature-2 but signature-2 was never generated when I previously did sudo atomic push.

I'm not sure what I'm doing wrong or if this is an actual bug. The sudo atomic pull command just tries to download signature-1, signature-2, signature-3, etc... even though sudo atomic push only generates a single signature-1 file.

Steps I took:

  1. On image creation workstation: downloaded alpine image (as a test), re-tag and use sudo atomic push to push to atomic registry (running on a "stand-alone" openshift 3.9 docker registry configuration)
sudo docker pull alpine:latest
sudo docker tag alpine:latest docker-registry-default.common.xxx.com/test/alpine:latest
sudo atomic push docker-registry-default.common.xxx.com/test/alpine:latest --sign-by ops@xxx.com --gnupghome /home/vagrant/.gnupg

  1. Copy signatures created to s3 bucket
  2. On "destination" workstation, I log into docker and sudo atomic pull:
oc login https://atomic-registry01.common.xxx.com:8443 -u registryuser -p xxxxxxxxx
sudo docker login -u registryuser -p $(oc whoami -t) docker-registry-default.common.xxx.com

sudo atomic pull docker-registry-default.common.xxx.com/test/alpine
FATA[0004] Source image rejected: Error reading signature from https://s3.amazonaws.com/dis.xxx.com/test/alpine@sha256=cf2d5c15199a1f6161650f2cfe35fd502d0b661823030c7df599050ad895580e/signature-2: status 403

On Image Creation workstation:

/etc/containers/registries.d/*

cat /etc/containers/registries.d/docker-registry-default.common.xxx.com-test.yaml
docker:
  docker-registry-default.common.xxx.com/test:
    sigstore: https://s3.amazonaws.com/dis.xxx.com
    sigstore-staging: file:///home/vagrant/atomic-sigstore

cat /etc/containers/registries.d/default.yaml
# This is a default registries.d configuration file.  You may
# add to this file or create additional files in registries.d/.
#
# sigstore: indicates a location that is read and write
# sigstore-staging: indicates a location that is only for write
#
# sigstore and sigstore-staging take a value of the following:
#   sigstore:  {schema}://location
#
# For reading signatures, schema may be http, https, or file.
# For writing signatures, schema may only be file.

# This is the default signature write location for docker registries.
default-docker:
#  sigstore: file:///var/lib/atomic/sigstore
  sigstore-staging: file:///var/lib/atomic/sigstore

# The 'docker' indicator here is the start of the configuration
# for docker registries.
#
# docker:
#
#   privateregistry.com:
#    sigstore: http://privateregistry.com/sigstore/
#    sigstore-staging: /mnt/nfs/privateregistry/sigstore

policy.json

cat /etc/containers/policy.json
{
    "default": [
        {
            "type": "insecureAcceptAnything"
        }
    ],
    "transports": {
        "docker": {
            "docker-registry-default.common.xxx.com/test": [
                {
                    "keyType": "GPGKeys",
                    "type": "signedBy",
                    "keyData": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                }
            ]
        },
        "docker-daemon": {
            "": [
                {
                    "type": "insecureAcceptAnything"
                }
            ]
        }
    }
}

atomic.conf

cat /etc/atomic.conf
# Atomic CLI configuration file

default_scanner:
default_docker: docker
registry_confdir: /etc/containers/registries.d/
discover_sigstores: true
sigstore_metadata_image: sigstore


# Default storage backend [ostree, docker]
# default_storage: docker
# ostree_repository: /ostree/repo
# checkout_path: /var/lib/containers/atomic
#

# Default identity for signing images
# default_signer:
# Absolute path to GPG keyring. Value set as environment variable GNUPGHOME
#gnupg_homedir: /home/USER/.gnupg
#
# To always use a proxy with atomic, you can uncomment and fill out
# below.
#
#http_proxy:
#https_proxy:
#no_proxy:

On Destination workstation:

/etc/containers/policy.json

$ cat /etc/containers/policy.json
{
    "default": [
        {
            "type": "reject"
        }
    ],
    "transports": {
        "docker": {
            "docker-registry-default.common.xxx.com/test": [
                {
                    "keyType": "GPGKeys",
                    "type": "signedBy",
                    "keyPath": "/home/vagrant/docker_image_key.gpg"
                }
            ]
        },
        "docker-daemon": {
            "": [
                {
                    "type": "insecureAcceptAnything"
                }
            ]
        }
    }
}

/etc/containers/registries.d/*

$ cat /etc/containers/registries.d/docker-registry-default.common.xxx.com-test.yaml
docker:
  docker-registry-default.common.xxx.com/test:
    sigstore: https://s3.amazonaws.com/dis.xxx.com

$ cat /etc/containers/registries.d/default.yaml
# This is a default registries.d configuration file.  You may
# add to this file or create additional files in registries.d/.
#
# sigstore: indicates a location that is read and write
# sigstore-staging: indicates a location that is only for write
#
# sigstore and sigstore-staging take a value of the following:
#   sigstore:  {schema}://location
#
# For reading signatures, schema may be http, https, or file.
# For writing signatures, schema may only be file.

# This is the default signature write location for docker registries.
default-docker:
#  sigstore: file:///var/lib/atomic/sigstore
  sigstore-staging: file:///var/lib/atomic/sigstore

# The 'docker' indicator here is the start of the configuration
# for docker registries.
#
# docker:
#
#   privateregistry.com:
#    sigstore: http://privateregistry.com/sigstore/
#    sigstore-staging: /mnt/nfs/privateregistry/sigstore

atomic.conf:

$ cat /etc/atomic.conf
# Atomic CLI configuration file

default_scanner:
default_docker: docker
registry_confdir: /etc/containers/registries.d/
discover_sigstores: false
sigstore_metadata_image: sigstore


# Default storage backend [ostree, docker]
# default_storage: docker
# ostree_repository: /ostree/repo
# checkout_path: /var/lib/containers/atomic
#

# Default identity for signing images
# default_signer:
# Absolute path to GPG keyring. Value set as environment variable GNUPGHOME
#gnupg_homedir: /home/USER/.gnupg
#
# To always use a proxy with atomic, you can uncomment and fill out
# below.
#
#http_proxy:
#https_proxy:
#no_proxy:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions