Added SSL verification option (#5732)

* Added SSL verification option

* Changed param name to avoid conflicts

* verify_ssl now accepts strings

* Added simple unit tests

* Changed parameter name fron verify_ssl to ssl_verify so it's consistent with HTTP remotes

Forget to change 1 test

* add processing on ssl_verify param

typo

* revert back to bool param

* Update dvc/config_schema.py

Co-authored-by: Nigel <[email protected]>
Co-authored-by: Nigel <[email protected]>
Co-authored-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
NigelVanHattum
2021-03-31 23:31:38 +03:00
committed by GitHub
co-authored by Nigel Nigel Ruslan Kuprieiev
parent 7c7e73e3d2
commit c3a61ad9cf
3 changed files with 19 additions and 0 deletions
+1
View File
@@ -145,6 +145,7 @@ SCHEMA = {
"session_token": str,
Optional("listobjects", default=False): Bool, # obsoleted
Optional("use_ssl", default=True): Bool,
Optional("ssl_verify", default=True): Bool,
"sse": str,
"sse_kms_key_id": str,
"acl": str,
+2
View File
@@ -38,6 +38,7 @@ class S3FileSystem(BaseFileSystem):
self.endpoint_url = config.get("endpointurl")
self.use_ssl = config.get("use_ssl", True)
self.ssl_verify = config.get("ssl_verify", True)
self.extra_args = {}
@@ -136,6 +137,7 @@ class S3FileSystem(BaseFileSystem):
return session.resource(
"s3",
endpoint_url=self.endpoint_url,
verify=self.ssl_verify,
use_ssl=self.use_ssl,
config=boto3.session.Config(
signature_version="s3v4", s3=s3_config
+16
View File
@@ -29,6 +29,22 @@ def test_init(dvc):
assert fs.path_info == url
def test_verify_ssl_default_param(dvc):
config = {
"url": url,
}
fs = S3FileSystem(dvc, config)
assert fs.ssl_verify
def test_ssl_verify_bool_param(dvc):
config = {"url": url, "ssl_verify": False}
fs = S3FileSystem(dvc, config)
assert fs.ssl_verify == config["ssl_verify"]
def test_grants(dvc):
config = {
"url": url,