-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31337][SQL]Support MS SQL Kerberos login in JDBC connector #28635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Apart from manual testing I've tried to add docker integration test (failed) and tried out the following:
If there will be a working docker image with an Active Directory instance we can try it again. In the meantime if somebody has an idea how to overcome this feel free to add. |
|
Test build #123081 has finished for PR 28635 at commit
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| class MsSqlServerIntegrationSuite extends DockerJDBCIntegrationSuite { | ||
| override val db = new DatabaseOnDocker { | ||
| override val imageName = "mcr.microsoft.com/mssql/server:2017-GA-ubuntu" | ||
| override val imageName = "mcr.microsoft.com/mssql/server:2019-GA-ubuntu-16.04" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not absolutely necessary, if we think we can extract it into a new PR. Thought it would be overkill.
| val configName = "jaasConfigurationName" | ||
| val appEntryDefault = "SQLJDBCDriver" | ||
|
|
||
| val parseURL = try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are basically 2 approaches to parse the URL to get jaasConfigurationName:
- Try to call private parseAndMergeProperties => tried it first
- Parse the URL manually => used as fallback
Both way has been tested in MSSQLConnectionProviderSuite.
|
|
||
| import org.apache.spark.sql.execution.datasources.jdbc.JDBCOptions | ||
|
|
||
| private[sql] class MSSQLConnectionProvider( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation is based on this.
| result.put("integratedSecurity", "true") | ||
| result.put("authenticationScheme", "JavaKerberos") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These props needed to reach kerberos authentication case:
https://github.com/microsoft/mssql-jdbc/blob/0d4e97f401dc0e55779460d9709dd7ee399246be/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java#L3771-L3772
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to add the background information on comment, either the code side or the class doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an inline comment.
| } | ||
|
|
||
| test("setAuthenticationConfigIfNeeded custom parser must set authentication if not set") { | ||
| val parserMethod = "IntentionallyNotExistingMethod" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This simulates a driver where the private parser method doesn't exist. Such case manual parsing takes place and the code goes forward without issue.
|
cc @HeartSaVioR |
|
Test build #123082 has finished for PR 28635 at commit
|
...rg/apache/spark/sql/execution/datasources/jdbc/connection/MSSQLConnectionProviderSuite.scala
Outdated
Show resolved
Hide resolved
|
Test build #123090 has finished for PR 28635 at commit
|
|
Test build #123177 has finished for PR 28635 at commit
|
|
retest this, please |
|
Test build #123184 has finished for PR 28635 at commit
|
HeartSaVioR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've gone through the general review but I'm afraid I'm not qualified to review in details.
...ala/org/apache/spark/sql/execution/datasources/jdbc/connection/MSSQLConnectionProvider.scala
Show resolved
Hide resolved
| result.put("integratedSecurity", "true") | ||
| result.put("authenticationScheme", "JavaKerberos") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to add the background information on comment, either the code side or the class doc.
|
cc @vanzin |
|
Test build #123530 has finished for PR 28635 at commit
|
|
retest this please |
|
Test build #124083 has finished for PR 28635 at commit
|
|
Merging to master. |
|
I could be wrong, but it doesn't look like this fixes this issue completely. |
|
@thereverand just seen your comment. It has never stated that username/password is working. As a resolution we're planning to add JDBC connection provider API in SPARK-32001 where any custom provider can be added. |
What changes were proposed in this pull request?
When loading DataFrames from JDBC datasource with Kerberos authentication, remote executors (yarn-client/cluster etc. modes) fail to establish a connection due to lack of Kerberos ticket or ability to generate it.
This is a real issue when trying to ingest data from kerberized data sources (SQL Server, Oracle) in enterprise environment where exposing simple authentication access is not an option due to IT policy issues.
In this PR I've added MS SQL support.
What this PR contains:
MSSQLConnectionProviderMSSQLConnectionProviderSuiteMsSqlServerIntegrationSuitedocker image to use the latestMariaDBConnectionProviderto increase trackabilityWhy are the changes needed?
Missing JDBC kerberos support.
Does this PR introduce any user-facing change?
Yes, now user is able to connect to MS SQL using kerberos.
How was this patch tested?