ssl - Earthly 中的自签名证书

标签 ssl cacerts earthly

我想在企业网络上使用 Earthly,该网络使用 SSL 探测来颁发自签名证书。
我有自定义的 ca-cert pem 文件,我已经成功地将其与 python、curl 等其他工具和工具链一起使用。
我无法用地球来配置它。 Documentation说这可以在 $HOME/.earthly/config.yml 的地球配置中完成,所以我跟着它,我的配置文件看起来像

global:
  buildkit_additional_args:
    - "-v"
    - "/Users/maca/.config/corporate/cert/cacerts"
无论我尝试什么,我都会收到此错误
    ongoing |
            internal | --> GIT CLONE https://github.com/earthly/hello-world.git
            internal | --> docker-image://docker.io/alpine/git:v2.30.1
            internal | [          ] resolve docker.io/alpine/git:v2.30.1 ... 0%
            internal | fatal: unable to access 'https://github.com/earthly/hello-world.git/': SSL certificate problem: self signed certificate in certificate chain
            internal | WARN: (GIT CLONE https://github.com/earthly/hello-world.git) error fetching default branch for repository https://github.com/earthly/hello-world.git: exit status 128
            internal | Completed in 121.889053ms
            internal | WARN: Canceled
            internal | Completed in 122.010694ms
            internal | [██████████] resolve docker.io/alpine/git:v2.30.1 ... 100%
Summary of timing information
Note that the times do not include the expansion of commands like BUILD, FROM, COPY (artifact).
            internal | () 243.899747ms
===============================================================
Total           243.899747ms
Total (real)    1m15.652038067s
Error stack trace:
github.com/moby/buildkit/util/stack.Enable
    github.com/moby/buildkit@v0.8.2-0.20210129065303-6b9ea0c202cf/util/stack/stack.go:77
github.com/moby/buildkit/util/grpcerrors.FromGRPC
    github.com/moby/buildkit@v0.8.2-0.20210129065303-6b9ea0c202cf/util/grpcerrors/grpcerrors.go:188
github.com/moby/buildkit/util/grpcerrors.UnaryClientInterceptor
    github.com/moby/buildkit@v0.8.2-0.20210129065303-6b9ea0c202cf/util/grpcerrors/intercept.go:41
google.golang.org/grpc.(*ClientConn).Invoke
    google.golang.org/grpc@v1.38.0/call.go:35
github.com/moby/buildkit/api/services/control.(*controlClient).Solve
    github.com/moby/buildkit@v0.8.2-0.20210129065303-6b9ea0c202cf/api/services/control/control.pb.go:1321
github.com/moby/buildkit/client.(*Client).solve.func2
    github.com/moby/buildkit@v0.8.2-0.20210129065303-6b9ea0c202cf/client/solve.go:215
golang.org/x/sync/errgroup.(*Group).Go.func1
    golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c/errgroup/errgroup.go:57
runtime.goexit
    runtime/asm_amd64.s:1371
似乎 Earthly 忽略了我的 cacerts 文件。有谁知道如何解决这个问题?

最佳答案

您需要做的不仅仅是挂载 certs 目录; Buildkit 不会接收它们。要为注册表指定自定义证书,您链接的文档详细说明了如何将自定义自签名证书与单个 Docker 注册表一起使用,而不是在整个构建中更一般的情况下。如果您需要使用自定义证书从注册表推送或拉取,您可以使用这些文档。不要忘记 buildkit_additional_config 中的附加配置如果需要根据您的情况进行配置。
现在,为什么 +hello-world失败了。 GIT CLONE命令使用 git在引擎盖下。而git在您的本地机器上可能配置为使用这些自定义证书,git这里的内部构建是不同的,并且不共享相同的证书配置。您需要通过 COPY 手动引入证书。 ,或使用 --secret / --secret-file / --build-arg 使其可访问,具体取决于您的用例。
我们的单元测试中有一些例子涵盖了这个用例。 Here is using one with a custom clone over HTTPS using a custom cert ;和 here is how we are adding a custom cert to a build .

关于ssl - Earthly 中的自签名证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69627623/

相关文章:

php - 旧的 php 容器显示 : curl: (60) SSL certificate problem: certificate has expired

facebook - Whatsapp Business API 注册 - 从 whatsapp 业务经理处获取证书

build - 是否可以使用 Earthly 建立动态目标列表

ssl - ArgumentError - 未知的 SSL 方法 `TLSv1_2'

ios - swift/XCode 7 : how to temporarily set to use TSL < 1. 2

.htaccess - 在 .htaccess 中强制使用 SSL + WWW,同时启用其他子域

javascript - 忽略 Android React Native 上的 SSL 证书检查

java - 创建java识别的证书链的过程

earthly - 如何从 Earthfile 目录外部复制文件?