使用 gsutil 将数据从 aws s3 传输到 gcs - SSL 证书错误

Transfer data from aws s3 to gcs by using gsutil - SSL Certification Error

我正在尝试将数据从 AWS S3 传输到 GCS。 我更改了 boto 文件中的私钥和密钥,当我尝试以下命令时出现错误。

命令:gsutil ls s3://axz

错误信息:

回溯(最近调用最后): 文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform/gsutil\gsutil",第 22 行,位于 gsutil.RunMain() RunMain 中的文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gsutil.py",第 114 行 sys.exit(gslib.main.main()) 文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib__main__.py",第 383 行,在 main 中 perf_trace_token=perf_trace_token) _RunNamedCommandAndHandleExceptions 中的文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib__main__.py",第 577 行 collect_analytics=真) RunNamedCommand 中的文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\command_runner.py",第 299 行 return_code = command_inst.RunCommand() RunCommand 中的文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\commands\ls.py",第 526 行 exp_dirs, exp_objs, exp_bytes = ls_helper.ExpandUrlAndPrint(storage_url) ExpandUrlAndPrint 中的文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\ls_helper.py",第 180 行 print_initial_newline=假) _RecurseExpandUrlAndPrint 中的文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\ls_helper.py",第 252 行 bucket_listing_fields=self.bucket_listing_fields): 文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\wildcard_iterator.py",第 476 行,在 IterAll 中 expand_top_level_buckets=expand_top_level_buckets): 文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\wildcard_iterator.py",第 157 行,在 iter 中 字段=bucket_listing_fields): ListObjects 中的文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gslib\boto_translation.py",第 380 行 在 objects_iter 中输入: 文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\third_party\boto\boto\s3\bucketlistresultset.py",第 34 行,在 bucket_lister 中 encoding_type=encoding_type) 文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\third_party\boto\boto\s3\bucket.py",第 473 行,在 get_all_keys 中 '', headers, 参数) 文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\third_party\boto\boto\s3\bucket.py",第 399 行,在 _get_all 中 query_args=query_args) 文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\third_party\boto\boto\s3\connection.py",第 668 行,在 make_request 中 retry_handler=retry_handler 文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\third_party\boto\boto\connection.py",第 1071 行,在 make_request 中 retry_handler=retry_handler) _mexe 中的文件 "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\third_party\boto\boto\connection.py",第 1030 行 抚养前任 **ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败 (_ssl.c:590)

这可能是因为您机器上的 SSL 证书包之间存在差异 - 这通常是遇到此错误的其他人的问题,例如https://github.com/aws/aws-cli/issues/1545

如果您无法更新您的证书包,您也可以尝试明确禁用证书验证(请注意,这会使您容易受到中间人攻击) 通过设置 https_validate_certificates Boto 选项:

gsutil -o 'Boto:https_validate_certificates=False' [...]


编辑:
您可能还想尝试通过
生成您自己的证书包文件 https://github.com/curl/curl/blob/master/lib/mk-ca-bundle.pl
看看使用 gsutil 是否有帮助:

gsutil -o 'Boto:ca_certificates_file=C:\path\to\ca-bundle.crt' [...]