From 064d17f5e478e0e47dda2a9cf749a747ba55fbed Mon Sep 17 00:00:00 2001 From: Harshal Sheth <hsheth2@gmail.com> Date: Tue, 11 Oct 2022 15:41:24 -0700 Subject: [PATCH 1/2] feat(ingest): support self-signed certs in Tableau --- .../src/datahub/ingestion/source/tableau.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/metadata-ingestion/src/datahub/ingestion/source/tableau.py b/metadata-ingestion/src/datahub/ingestion/source/tableau.py index 70993fa196ddd9..96b445ef4293cd 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/tableau.py +++ b/metadata-ingestion/src/datahub/ingestion/source/tableau.py @@ -120,6 +120,11 @@ class TableauConnectionConfig(ConfigModel): description="Tableau Site. Always required for Tableau Online. Use emptystring to connect with Default site on Tableau Server.", ) + ssl_verify: bool = Field( + default=True, + description="Whether to verify SSL certificates. Set to False if using self-signed certificates.", + ) + @validator("connect_uri") def remove_trailing_slash(cls, v): return config_clean.remove_trailing_slashes(v) @@ -145,6 +150,11 @@ def make_tableau_client(self) -> Server: try: server = Server(self.connect_uri, use_server_version=True) server.auth.sign_in(authentication) + + # From https://stackoverflow.com/a/50159273/5004662. + server._session.verify = self.ssl_verify + server._session.trust_env = False + return server except ServerResponseError as e: raise ValueError( From f7f652ef94e18c3438fee3a91b9d761911b78422 Mon Sep 17 00:00:00 2001 From: Harshal Sheth <hsheth2@gmail.com> Date: Tue, 11 Oct 2022 15:46:00 -0700 Subject: [PATCH 2/2] allow path --- metadata-ingestion/src/datahub/ingestion/source/tableau.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/tableau.py b/metadata-ingestion/src/datahub/ingestion/source/tableau.py index 96b445ef4293cd..6501f7d3b86137 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/tableau.py +++ b/metadata-ingestion/src/datahub/ingestion/source/tableau.py @@ -120,9 +120,9 @@ class TableauConnectionConfig(ConfigModel): description="Tableau Site. Always required for Tableau Online. Use emptystring to connect with Default site on Tableau Server.", ) - ssl_verify: bool = Field( + ssl_verify: Union[bool, str] = Field( default=True, - description="Whether to verify SSL certificates. Set to False if using self-signed certificates.", + description="Whether to verify SSL certificates. If using self-signed certificates, set to false or provide the path to the .pem certificate bundle.", ) @validator("connect_uri") @@ -149,12 +149,12 @@ def make_tableau_client(self) -> Server: try: server = Server(self.connect_uri, use_server_version=True) - server.auth.sign_in(authentication) # From https://stackoverflow.com/a/50159273/5004662. server._session.verify = self.ssl_verify server._session.trust_env = False + server.auth.sign_in(authentication) return server except ServerResponseError as e: raise ValueError(