Skip to content

ssl_verify key in remote config does not accept custom CA bundle path and aws config is ignored #6012

@rgvanwesep

Description

@rgvanwesep

The ssl_verify key in the remote config gets passed through to the S3FileSystem client_kwargs:
https://github.com/iterative/dvc/blob/89b40afee740146af42efeb8563c08053f984a88/dvc/fs/s3.py#L105
https://github.com/iterative/dvc/blob/89b40afee740146af42efeb8563c08053f984a88/dvc/fs/fsspec_wrapper.py#L17
https://github.com/iterative/dvc/blob/89b40afee740146af42efeb8563c08053f984a88/dvc/fs/s3.py#L154

These are in turn passed to the aiobotocore.AioSession :
https://github.com/dask/s3fs/blob/a3d7a946f85b6dbef62ab75c61fe1319a482c8ba/s3fs/core.py#L366

In the AioSession it checks if the verify key is set and if it isn't then it looks in the aws config:
https://github.com/aio-libs/aiobotocore/blob/2a7c7f5a8c7a61daebe484bc5a6f2232607af82c/aiobotocore/session.py#L70-L71
verify can either be a boolean or a string, with the latter being a path to a custom CA bundle:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html (see the verify argument of the client method.)

However, the config schema for DVC only allows boolean for ssl_verify and defaults true:
https://github.com/iterative/dvc/blob/89b40afee740146af42efeb8563c08053f984a88/dvc/config_schema.py#L148

The result is that the aws config is never checked and a custom CA bundle cannot be used. If such a CA bundle is needed when trying to communicate to remote (e.g. using push or pull) the result is

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate

I ran into this problem because my company uses a self-hosted S3 clone with a bundle of internally signed certificates. Setting the AWS_CA_BUNDLE environment variable did not resolve the issue. But modifying the config schema to accept a string:

Optional("ssl_verify", default=True): Any(Bool, str),

and running

dvc remote modify object-store ssl_verify "$HOME/.aws/cabundle.pem"

resolved the issue for me.

I'm happy to open a pull request to make the change to the config schema if that solution is acceptable, but it would be my first contribution (for any OSS project!), so it'll take extra time for me to setup my environment, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDid we break something?fs: s3Related to the S3 filesystemp2-mediumMedium priority, should be done, but less important

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions