Skip to content

gcs.py: fix up cert error on gcs fetch#52172

Open
linsword13 wants to merge 1 commit intospack:developfrom
linsword13:gcs-fix
Open

gcs.py: fix up cert error on gcs fetch#52172
linsword13 wants to merge 1 commit intospack:developfrom
linsword13:gcs-fix

Conversation

@linsword13
Copy link
Copy Markdown
Contributor

When running with newer google-auth lib (googleapis/google-auth-library-python#1856), the default behavior is to access the https endpoint of the metadata server. This is causing cert errors like the following:

// The spack installation comes with a build-cache hosted on a gcs bucket
spack install [email protected] +lustre ^[email protected] fabrics=ucx ^[email protected] +verbs +rdmacm +rc +ud +thread_multiple

==> Error: Failed to retrieve https://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true from the Google Compute Engine metadata service. Compute Engine Metadata server unavailable. Last exception: HTTPSConnectionPool(host='metadata.google.internal', port=443): Max retries exceeded with url: /computeMetadata/v1/instance/service-accounts/default/?recursive=true (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1004)')))

This PR adds the GCE_METADATA_MTLS_MODE env-var to avoid accessing the https endpoint.

When running with newer `google-auth` lib (googleapis/google-auth-library-python#1856), the default behavior is to access the https endpoint of the metadata server. This is causing cert errors like the following:

```
// The spack installation comes with a build-cache hosted on a gcs bucket
spack install [email protected] +lustre ^[email protected] fabrics=ucx ^[email protected] +verbs +rdmacm +rc +ud +thread_multiple

==> Error: Failed to retrieve https://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true from the Google Compute Engine metadata service. Compute Engine Metadata server unavailable. Last exception: HTTPSConnectionPool(host='metadata.google.internal', port=443): Max retries exceeded with url: /computeMetadata/v1/instance/service-accounts/default/?recursive=true (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1004)')))
 ```

This PR adds the `GCE_METADATA_MTLS_MODE` env-var to avoid accessing the https endpoint.

Signed-off-by: Lin Guo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant