spring-boot - spring boot bootBuildImage paketo ssl 证书位置?

标签 spring-boot buildpack zscaler paketo

TLDR: Spring Boot 梯度bootBuildImage任务因 x509 证书验证错误而失败(由于 zscaler)。在哪里添加根证书?
信息
我们正在使用 Spring Boot (2.3) 的新“bootBuildImage”来构建 docker 镜像。
最近,我们的 IT 团队开启了“zscaler 无处不在”,它有效地通过受公司祝福的“中间人”路由所有 http 和 https 流量,即使用 DNS 来“网关/检查点”网络流量
错误
在此更改之后,gradle 失败并出现 X509 证书验证错误:

2021-03-01T08:40:42.120-0600 [QUIET] [system.out]     [creator]     unable to request https://repo.
spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0
.jar
2021-03-01T08:40:42.120-0600 [QUIET] [system.out]     [creator]     Get "https://repo.spring.io/release/org/springframework/cloud/spring-cloud-bindings/1.7.0/spring-cloud-bindings-1.7.0.jar": x509: certificate signed by unknown authority
202
更多内容
  • Spring Boot 3.7
  • Gradle
  • 马克
  • Docker 桌面
  • 在 spring-cloud-bindings
  • 上特别失败

    问题
  • 如何通过 x509 ssl 证书验证错误?

  • 我知道应该能够在信任存储中安装 zscaler 根证书,但不清楚哪个信任存储? (文件系统在哪里?)
  • docker
  • 帕克托

  • 我不清楚为什么'spring cloud download'失败,但其他下载成功,即这个下载成功:
    2021-03-01T08:40:34.790-0600 [QUIET] [system.out]     [creator]       BellSoft Liberica JRE 8.0.282
    : Contributing to layer
    2021-03-01T08:40:34.790-0600 [QUIET] [system.out]     [creator]         Downloading from https://github.com/bell-sw/Liberica/releases/download/8u282+8/bellsoft-jre8u282+8-linux-amd64.tar.gz
    2021-03-01T08:40:38.913-0600 [QUIET] [system.out]     [creator]         Verifying checksum
    
    提前致谢!

    最佳答案

    类似的问题已经在 Github 上报告过,比如 this one与 Spring Cloud 相关,尤其是 this other ,在 Spring Boot 项目中。
    如上一期所述,目前最好的解决方案可能是自定义应在构建过程中使用的镜像,如 this comment 中所述。在相关的 Github 问题中。
    这个想法是生成一个配置了必要证书的新图像,并将其用作您的builder。基础(例如从指示的评论中复制):

    FROM gcr.io/paketo-buildpacks/builder:base
    
    USER root
    
    ADD server.crt /usr/local/share/ca-certificates/server.crt
    RUN chmod 644 /usr/local/share/ca-certificates/server.crt \
     && update-ca-certificates
    
    USER cnb
    
    这个自定义镜像将是 Spring Boot 在构建任务中使用的镜像。请参阅 relevant documentation .
    上述问题indicates as well ,就在几天前,最新的 Spring Boot 快照版本包含绑定(bind)功能,允许您使用 Maven 和 Gradle 插件将自定义证书添加到构建器容器。此功能将在 2.5.0-M3 Spring Boot milestone 中提供,3 月 18 日。

    关于spring-boot - spring boot bootBuildImage paketo ssl 证书位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66425605/

    相关文章:

    java - 如何使用 AccessLevel.NONE 设置 JPA 属性进行单元测试?

    python - 无法使用 Cloud Foundry 推送启动 Django 应用程序

    ruby-on-rails - 我怎样才能在 heroku 上使用 firefox

    heroku - 在heroku buildpack期间运行knex迁移

    git - 将 Git、Gradle 和 Maven 与 ZScaler 证书一起使用?

    java - Intellij/Gradle 同步在公司代理之后失败

    Maven 依赖项上的 java.lang.ClassNotFoundException

    java - 如何在 Rest Api 调用中设置多个响应类型

    java - spring-boot 微服务注册到eureka失败

    amazon-web-services - SSL 证书错误 : [SSL: CERTIFICATE_VERIFY_FAILED] when using aws client in windows 10