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としてダウンロードできるだけでなく、会社のためのこれら2つの証明書と証明書チェーンもダウンロードできます。それらのどれも動作しません。

他に何を試すことができ、この問題をどのようにデバッグできますか?

ベストアンサー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  

頑張ってください! !

おすすめ記事