googleapis / googleapis/google-cloud-cpp

[Windows] quickstart.exe fails with CURL error 60 even with GOOGLE_CLOUD_CPP_REST_DISABLE_SSL_VERIFICATION=true

Open
#15,169 3 comments 0 reactions 1 assignee Claimed by @phenriqueol View on GitHub
priority: p3 type: bug
Dominant language
C++
Stars
659
Forks
462
Avg merge
1d 2h
Merged PRs (30d)
89

Description

### **Descrição do Problema**

Estou tentando executar o exemplo `quickstart` do Google Cloud Storage em um ambiente Windows, compilado com Bazel. A aplicação falha consistentemente com `CURL error [60]=SSL peer certificate or SSH remote key was not OK`, mesmo após diversas tentativas de depuração e desativação da verificação SSL.

### **Passos para Reproduzir**

1. **Ambiente:**
* **Sistema Operacional:** Windows 10 Pro (versão 10.0.26100.4061)
* **Compilador:** Visual Studio 2022 (versão 17.14.2 do Developer Command Prompt)
* **Ferramenta de Build:** Bazel (assumo que seja uma versão recente compatível com o `google-cloud-cpp` no Windows, mas não tenho a versão exata da instalação do Bazel).

2. **Configuração de Variáveis de Ambiente (executadas no `Visual Studio 2022 Developer Command Prompt`):**
```cmd
set GOOGLE_CLOUD_PROJECT=asr-vsecb
set GOOGLE_APPLICATION_CREDENTIALS=D:\Projetos\Outros\Google\asr-vsecb-178e38df48f1.json
set CURL_CA_BUNDLE=D:\Projetos\Outros\Google\cacert.pem
set GOOGLE_CLOUD_CPP_REST_DISABLE_SSL_VERIFICATION=true
set GOOGLE_CLOUD_CPP_ENABLE_CLOG=rpc;auth;http;network;curl;flow;tracing
```

3. **Execução do Exemplo:**
```cmd
C:/users/phenrique/_bazel_phenrique/5kg47tsu/execroot/_main/bazel-out/x64_windows-fastbuild/bin/google/cloud/storage/quickstart/quickstart.exe phenriquefly-asr-vs-cb-teste
```

4. **Resultado Obtido:**
```
Error creating object: UNKNOWN: Permanent error, with a last message of PerformWork() - CURL error [60]=SSL peer certificate or SSH remote key was not OK error_info={reason=, domain=, metadata={gcloud-cpp.retry.original-message=PerformWork() - CURL error [60]=SSL peer certificate or SSH remote key was not OK, gcloud-cpp.retry.function=CreateResumableUpload, gcloud-cpp.retry.reason=permanent-error}}
```
(Note: Não há logs adicionais do `GOOGLE_CLOUD_CPP_ENABLE_CLOG` antes do erro, o que sugere que a falha ocorre em um nível muito baixo.)

### **Depuração e Testes Adicionais Realizados**

Foram realizados os seguintes testes para isolar o problema:

1. **Data/Hora do Sistema:** Confirmado que a data e hora do sistema estão corretas e sincronizadas automaticamente.
2. **Antivírus/Firewall:** Norton 360 foi desabilitado, mas o problema persistiu.
3. **Teste de Conectividade HTTPS com `curl.exe` do Sistema (fora do `Developer Command Prompt`):**

* **Teste 1: `curl -v -k https://www.google.com`**
```
* Host [www.google.com:443](https://www.google.com:443) was resolved.
* IPv6: (none)
* IPv4: 172.217.29.228
* Trying 172.217.29.228:443...
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* Connected to [www.google.com](https://www.google.com) (172.217.29.228) port 443
* using HTTP/1.x
> GET / HTTP/1.1
> Host: [www.google.com](https://www.google.com)
> User-Agent: curl/8.12.1
> Accept: */*
>
* Request completely sent off
* schannel: remote party requests renegotiation
* schannel: renegotiating SSL/TLS connection
* schannel: SSL/TLS connection renegotiated
< HTTP/1.1 200 OK
< Date: Mon, 26 May 2025 14:40:05 GMT
... (conteúdo HTML do Google) ...
* Connection #0 to host [www.google.com](https://www.google.com) left intact
```
**Resultado:** Conexão HTTPS e handshake SSL/TLS bem-sucedidos.

* **Teste 2: `curl -v -k https://storage.googleapis.com`**
```
* Host storage.googleapis.com:443 was resolved.
* IPv6: (none)
* IPv4: 172.217.172.59, ... (outros IPs) ...
* Trying 172.217.172.59:443...
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server accepted http/1.1
* Connected to storage.googleapis.com (172.217.172.59) port 443
* using HTTP/1.x
> GET / HTTP/1.1
> Host: storage.googleapis.com
> User-Agent: curl/8.12.1
> Accept: */*
>
* Request completely sent off
* schannel: remote party requests renegotiation
* schannel: SSL/TLS connection renegotiated
< HTTP/1.1 400 Bad Request
< Content-Type: application/xml; charset=UTF-8
< X-GUploader-UploadID: AAO2Vwq7OOAypffYH0lmAQIPisQPXBGFjsNIjUsT4V6VAn1twZ0WUXNknNS7-N0NZBYUwmZP
< Content-Length: 181
< Date: Mon, 26 May 2025 14:52:28 GMT
...
MissingSecurityHeaderYour request was missing a required header.Authorization* Connection #0 to host storage.googleapis.com left intact
```
**Resultado:** Conexão HTTPS e handshake SSL/TLS bem-sucedidos. O `400 Bad Request` com `MissingSecurityHeader` é o comportamento esperado para uma requisição não autenticada à raiz da API.

### **Observação**

Os testes com o `curl.exe` do sistema demonstram que a conectividade HTTPS básica com os domínios do Google funciona perfeitamente quando a verificação SSL é explicitamente ignorada. A falha persistente no `quickstart.exe` com `CURL error [60]` mesmo com `GOOGLE_CLOUD_CPP_REST_DISABLE_SSL_VERIFICATION=true` sugere que há um problema na forma como a biblioteca `google-cloud-cpp` ou sua versão interna do `curl` está lidando com as conexões SSL/TLS no meu ambiente Windows, ou que a flag de desativação SSL não está sendo aplicada conforme o esperado no código compilado.

Agradeço qualquer assistência na investigação deste problema.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.