CentOS 인증서 확인이 프록시 뒤에서 실패함

CentOS 인증서 확인이 프록시 뒤에서 실패함

회사 프록시 뒤의 CentOS 기반 컨테이너 이미지에 Tensorflow Serving을 설치하려고 합니다. 그러나 이 빌드 명령을 실행하는 데 bazel문제가 있습니다 .

$ bazel build -c opt //tensorflow_serving/model_servers:tensorflow_model_server

결과(발췌):

ERROR: An error occurred during the fetch of repository 'upb':
   Traceback (most recent call last):
        File "/root/.cache/bazel/_bazel_root/f8d1071c69ea316497c31e40fe01608c/external/bazel_tools/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl
                download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz] to /root/.cache/bazel/_bazel_root/f8d1071c69ea316497c31e40fe01608c/external/upb/temp10914614927449415720/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
ERROR: Error fetching repository: Traceback (most recent call last):
        File "/root/.cache/bazel/_bazel_root/f8d1071c69ea316497c31e40fe01608c/external/bazel_tools/tools/build_defs/repo/http.bzl", line 111, column 45, in _http_archive_impl
                download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz] to /root/.cache/bazel/_bazel_root/f8d1071c69ea316497c31e40fe01608c/external/upb/temp10914614927449415720/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
ERROR: no such package '@upb//bazel': java.io.IOException: Error downloading [https://github.com/protocolbuffers/upb/archive/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz] to /root/.cache/bazel/_bazel_root/f8d1071c69ea316497c31e40fe01608c/external/upb/temp10914614927449415720/9effcbcb27f0a665f9f345030188c0b291e32482.tar.gz: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

다음과 같은 다른 도구를 사용하여 비슷한 문제가 있음을 발견했습니다 wget.

$ wget github.com
URL transformed to HTTPS due to an HSTS policy
--2021-03-11 16:56:32--  https://github.com/
Resolving proxy.mycompany.com (proxy.mycompany.com)... 172.18.76.212
Connecting to proxy.mycompany.com (proxy.mycompany.com)|172.18.76.212|:8080... connected.
ERROR: The certificate of ‘github.com’ is not trusted.
ERROR: The certificate of ‘github.com’ doesn't have a known issuer.

특히 의 경우 wget이러한 문제를 무시하고 얻을 수 없는 --no-check-certificate종속성을 다운로드하고 빌드 프로세스를 계속할 수 있습니다. 하지만 가능하다면 근본적인 문제를 해결하고 싶습니다.wgetbazel

내가 이해한 바에 따르면 근본 원인은 인증서 누락입니다. 그래서 저는 그것들을 설치하려고 합니다:

$ yum install ca-certificates
$ update-ca-trust force-enable
$ openssl x509 -outform der -in github-com.pem -out github.crt  # I used Firefox to download this PEM file
$ mv github.crt /etc/pki/ca-trust/source/anchors/github.crt
$ update-ca-trust extract

또한 시스템 시계를 NTP 서버와 동기화했습니다.

bazel이 프로세스 후에 및 의 출력은 wget변경되지 않습니다. Firefox를 사용하면 github.com의 인증서와 인증서 체인을 PEM으로 다운로드할 수 있을 뿐만 아니라 회사를 위한 이 두 인증서와 인증서 체인도 다운로드할 수 있습니다. 그들 중 누구도 작동하지 않습니다.

그 밖에 무엇을 시도할 수 있으며 이 문제를 어떻게 디버깅할 수 있습니까?

답변1

이것은해결책Bazel 빌드의 "cacerts"에 문제가 있다고 생각합니다.

내 경우에는 다음을 수행했습니다.

bazel **--host_jvm_args="-Djavax.net.ssl.trustStore=/usr/lib/jvm/jdk1.8.0_261/jre/lib/security/cacerts"** build -c opt --cxxopt=--std=c++11 --config=android_arm //tensorflow/lite/c:tensorflowlite_c  

행운을 빌어요! !

관련 정보