databricks / databricks-sql-go

Golang database/sql driver for Databricks SQL.
Apache License 2.0
34 stars 37 forks source link

Add connection option WithSkipTLSHostVerify for privatelink host #225

Closed jackyhu-db closed 1 month ago

jackyhu-db commented 1 month ago

Background

The driver cannot connect to the workspace whose hostname is an internal private link hostname, this is because its domain is not added into Databricks workspace certificate. See https://github.com/databricks/databricks-sql-go/issues/223

Description

This change adds connection option WithSkipTLSHostVerify which can disable verifying the hostname in the server certificate. In this mode, TLS is susceptible to machine-in-the-middle attacks. Please only use this option when the hostname is an internal private link hostname.

Here is the usage

connector, err := dbsql.NewConnector(
   dbsql.WithServerHostname("<hostname>"),
   dbsql.WithHTTPPath("<http_path>"),
   dbsql.WithAccessToken("<token>"),
   dbsql.WithSkipTLSHostVerify(),
)