Closed
Description
Feature Request
Is your feature request related to a problem? Please describe
In mssql-jdbc library such option is simply available to developer but in r2dbc it needs some struggle (mostly finding out how to enable it) to use SSL with self signed cert.
Describe the solution you'd like
Add new configuration flag which would control trustServerCertificate
parameter in underlying mssql-jdbc library.
Best to create new parameter in MssqlConnectionConfiguration
which would allow using self signed cert.
Describe alternatives you've considered
Using generic ConnectionFactoryOptions with adding custom Option but that in fact calls Mssql factory which omits it.
After abnalyzing mssql-jdbc driver I found out that in case of using this flag it register dummy trust manager so I mimic that:
configBuilder.sslContextBuilderCustomizer(b -> b.trustManager(TrustAllTrustManager.INSTANCE));
Teachability, Documentation, Adoption, Migration Strategy
MssqlConnectionConfiguration.builder().trustServerCertificate();
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
mp911de commentedon Jan 26, 2021
Makes sense. Do you want to submit a PR that introduces the config option to
MssqlConnectionFactoryProvider
,MssqlConnectionConfiguration
, and the actual functionality beforesslContextBuilderCustomizer
gets called?thankusWR commentedon Jan 26, 2021
Hey, not sure if I would have time tio fully implement it but here is some simple implementation which might be sufficient:
EDIT
diff
main...thankusWR:trustServerCertificate
mp911de commentedon Jan 26, 2021
Looks a decent start. However, having diffs in comments makes it hard to review things properly. No worries regarding completion, moving that code into a pull request and adding a test including the connection factory provider change is fine.
thankusWR commentedon Jan 28, 2021
Wanted to push changes to branch but have no access.
As for test do you have any proposition of how this could be tested?
I started some initial implementation, and try to extract trust manager from created
MssqlConnectionConfiguration
object but didn't find any way to verify proper behaviour.mp911de commentedon Jan 28, 2021
Pull requests work in the way that you fork a repository into your own namespace, apply and push the changes there and then you open a pull request so that we pull in your changes.
thankusWR commentedon Jan 28, 2021
Ok, still do you have any idea how to test this change?
mp911de commentedon Jan 28, 2021
I think we don't have tests where we have set SSL enabled because the certificate of the containerized SQL Server instance is self-signed. So enabling SSL and setting
trustServerCertificate=true
should be fine.Add support server self signed cert
Add support server self signed cert
Add support server self signed cert
thankusWR commentedon Jan 28, 2021
I submitted my PR (https://github.com/r2dbc/r2dbc-mssql/pull/186/files) with broken test to be sure its failing properly as locally test are not building for me but integration test are skipped.
Thats done on purpose?
mp911de commentedon Jan 28, 2021
mvn clean verify
should run integration tests which require a local Docker installation. On CI/GitHub Actions we've disabled integration tests as they cause tests to hang and are next to impossible to debug why this is.9 remaining items