-
Notifications
You must be signed in to change notification settings - Fork 426
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
Adding a new connection property "useDefaultJaasConfig" to coexist with solutions that overwrite the system JAAS #2147
Conversation
@microsoft-github-policy-service agree |
HI @edanidzerda, Thank you for the PR, we'll take a look into it. |
Thanks for agreeing to look into it! I've been researching the issue further, and I feel very confident now that this would be an great addition for anyone combining SQL Server Kerberos authentication alongside Spring Kafka with Kerberos, as well as any other libraries that attempt to auto-configure the JAAS configuration. For a little more background, the conflict we see in testing is that when Spring Kafka's beans are instantiated BEFORE a data source using mssql-jdbc, Spring Kafka creates a Kafka security configuration and overwrites the JVM's JAAS Configuration
When mssql-jdbc starts up after this, the clever
Unfortunately, if mssql-jdbc starts first, then Spring Kafka overwrites the Configuration object when it starts. While initial SQL connections succeed, connections shortly after startup fail because of In the old days, we could configure a Thanks again! 😃 |
Thanks for the clarification. This sounds like a useful addition. I was trying to understand the use case so we can appropriately document the setting. My initial thought is to reverse the setting logic (i.e. instead of |
Awesome!!! I think naming things is one of the harder problems in computer science, and perhaps outside of it 😄 I tried not to overthink the name and just get it working! I like I also added a warning message if I didn't see an obvious way to fail the connection, but I didn't spend a lot of time looking at the code for parsing the URL and I wasn't convinced that it was so serious as a configuration problem. I thought a warning level message that "hey! we're not using your config" was about right. However, I am open to any suggestion here.
I think it looks pretty good as |
@edanidzerda Everything looks good on our end. We'd like to include this in a preview release before a stable release so this change won't be slated in for our upcoming stable release, but rather the one after. Thanks for the contribution and your patience. |
That's great! I completely understand your need to move slowly with this project. I see you added it to 12.5.0 milestone; are you open to backport to 10.2.x or 11 at some point? Let me know if there's anything else I can do to help! Thanks again! 😄 |
* New option to allow the JDBC driver to perform Kerberos authentication using its builtin JaasConfiguration(), to easily coexist with an external JAAS configuration that does not provide a SQLJDBCDriver Login module configuration. * Warning is printed if the jaasConfigurationName is non-default at the same time as useDefaultJaasConfig, as the jaasConfigurationName will not be used.
1fc380a
to
017b0f1
Compare
I'll check with the team again and let you know if it's possible to do a backport. |
Thanks for your consideration! I squashed my patch into a single commit to make backporting a more palatable task 😅 |
@edanidzerda Sorry, after checking with the team, it looks like we've decided not to do a backport as this is a new feature eg. connection string property so it wouldn't make sense to do a backport. |
Thanks @tkyc for discussing and getting back to me! You all have been great to work with. |
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.
add tests that exercise the code added, currently this only has a test to add setting the property
2c57748
to
39ec87b
Compare
src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/MultiUserAKVTest.java
Show resolved
Hide resolved
src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/ParameterMetaDataCacheTest.java
Show resolved
Hide resolved
src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/PrecisionScaleTest.java
Show resolved
Hide resolved
src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/RegressionAlwaysEncryptedTest.java
Show resolved
Hide resolved
…ql-jdbc into ignoreSystemJaas
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Hello All, great job done! Just for my knowledge, when do you target the delivery of 12.5 version? |
@dartoons Hello, 12.5 will likely release as a preview sometime in November and a stable release will release in the new year in January. |
The existing feature of the JDBC driver to automatically authenticate using Kerberos without any external configuration is fantastic! The complexity of JAAS can be intimidating.
This feature I am proposing is the simplest way I saw to allow the JDBC driver to perform Kerberos authentication without any additional external configuration, when the JDBC driver coexists in the same application with libraries that configure JAAS at the system level.
This may not be a very common use case, but it is very useful in a corporate environment that provides, for instance, a Kafka Kerberos configuration, to let the JDBC Driver authenticate via Kerberos itself, without having to resort to configuring a common jaas.conf for all applications. In the case where the user has not specified a jaasConfigurationName, it seems reasonable to assume they are hoping to directly connect to a SQLServer using the authentication schema that they specified in their connection properties.
I did think that the existing
jaasConfigurationName
feature could be useful if it did allow a separate jaas.conf filename, instead of a configuration name. The documentation is a little confusing when it refers to this option as a filename and not a configuration name, so this patch also tweaks the Javadoc for those settings.I recognize that adding a new connection property is not something the project will want to accept lightly, and I am open to alternative proposals that could solve the same problem! Thanks for taking the time to consider it.