Docker Trust:无法将信任轮换到新的受信任根:无法使用当前受信任的证书验证数据

Tim*_*Tim 5 docker gitlab-ci gitlab-ci-runner notary

经过一个月的 docker trust 通过 GitLab CI 为我工作正常后,我突然收到了这条消息。

我有一个 Gitlab Runner 挂载 ~/.docker/trust (所以它被持久化)并将它推送到我们的 QA 注册表。

tag_image_test:
  stage: tag_image
  script:
    - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY
    - docker pull "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}"
    - export DOCKER_CONTENT_TRUST=1
    - export DOCKER_CONTENT_TRUST_SERVER=$QA_REGISTRY_SIGNER
    - export DOCKER_CONTENT_TRUST_ROOT_PASSPHRASE=$QA_REGISTRY_SIGNER_ROOT_PASSPHRASE
    - export DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=$QA_REGISTRY_SIGNER_REPO_PASSPHRASE
    - docker login -u "$QA_REGISTRY_USERNAME" -p "$QA_REGISTRY_PASSWORD" $QA_REGISTRY_URL
    - export PROJ_PATH=$(echo -en $CI_PROJECT_PATH | tr '[:upper:]' '[:lower:]')
    - docker tag "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}" "${QA_REGISTRY_IMAGE}/${PROJ_PATH}:${CI_COMMIT_REF_SLUG}"
    - docker push "${QA_REGISTRY_IMAGE}/${PROJ_PATH}:${CI_COMMIT_REF_SLUG}"
Run Code Online (Sandbox Code Playgroud)

但是推送命令以:

time="2019-03-18T11:51:14Z" level=debug msg="failed to verify TUF data for: qa.registry.local/mygroup/myimage, valid signatures did not meet threshold for "
time="2019-03-18T11:51:14Z" level=debug msg="downloaded 1.root is invalid: could not rotate trust to a new trusted root: failed to validate data with current trusted certificates"
time="2019-03-18T11:51:14Z" level=debug msg="Client Update (Root): could not rotate trust to a new trusted root: failed to validate data with current trusted certificates"
could not rotate trust to a new trusted root: failed to validate data with current trusted certificates
Run Code Online (Sandbox Code Playgroud)

当我查看root.json文件时,到期时间不长:

"expires":"2029-02-08T15:07:05.172338131Z"
Run Code Online (Sandbox Code Playgroud)

同样适用于targets.json

"expires":"2022-02-10T15:07:05.173954376Z"
Run Code Online (Sandbox Code Playgroud)

所以我对正在发生的事情感到茫然,可能不明白它在做什么。有没有人有任何见解?

小智 2

I\xe2\x80\x99m 仍在学习 docker,但你确定它正在查找的是root.json而不是root.json

\n\n

根据此处的配置,它应该在root.json中查找受信任的证书。

\n\n

也许您正在推送错误的文件来识别您的根,或者您的帖子中可能存在拼写错误。

\n\n

无论如何,这都是有帮助的:\n https://github.com/cirocosta/docker-cli/blob/master/vendor/github.com/theupdateframework/notary/trustpinning/certs.go

\n\n

在那里可以看到这些错误是如何生成的,并附有有关这些错误发生原因的注释。

\n\n

例如,关于您的密钥轮换错误:

\n\n
\n

// 当我们无法执行完整的根密钥轮换时,会返回 ErrRootRotationFail\n // 由于未能添加新根证书或删除旧根证书

\n
\n