Support trust_server_certificate option in dbconsole#1383
Open
justindell wants to merge 1 commit intorails-sqlserver:8-1-stablefrom
Open
Support trust_server_certificate option in dbconsole#1383justindell wants to merge 1 commit intorails-sqlserver:8-1-stablefrom
justindell wants to merge 1 commit intorails-sqlserver:8-1-stablefrom
Conversation
ODBC Driver 18+ encrypts connections by default and validates SSL certificates, causing `rails dbconsole` to fail against SQL Server instances using self-signed certificates (e.g. Docker). Pass the -C flag to sqlcmd when trust_server_certificate is set in database.yml.
32fe8cf to
6731fb6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-C(TrustServerCertificate) flag tosqlcmdwhentrust_server_certificate: trueis set indatabase.ymlrails dbconsolefailing with ODBC Driver 18+ against SQL Server instances using self-signed certificates (e.g. Docker)Problem
Starting with ODBC Driver 18, Microsoft encrypts connections by default and validates SSL certificates. Local SQL Server instances (e.g. Docker) use self-signed certificates, which causes
rails dbconsoleto fail with:The Rails app itself connects fine because TinyTds/FreeTDS handles TLS differently, but
dbconsoleshells out tosqlcmddirectly and had no mechanism to pass the-Cflag.Usage
Changes
sqlserver_adapter.rb: One new line to pass-Cwhentrust_server_certificateis settest/cases/dbconsole.rb: Updated test to cover the new flag (also fixed pre-existingOracleEnhancedAdapterreference andsqlplusdescription)