MsSQL使用加密連接SSL/TLS
說明
應用程式通過未加密的通道與資料庫服務器通信, 這可能會造成重大的安全風險,在這種情況下, 攻擊者可以修改用戶輸入的資料, 甚至對資料庫服務器執行任意 SQL 命令,
例如,當您使用以下連接字串時,就可能存在這種風險:
<connectionStrings> <add name="Test" connectionString="Data Source=210.10.20.10,1433; Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;" providerName="System.Data.SqlClient" /> </connectionStrings>
啟用SSL/TLS加密連接
大部分資料庫服務器都提供支持使用SSL/TLS來加密傳輸所有資料,您應當盡可能的使用它,在您的連接字串上加上Encrypt=True即可,如果您的開發環境沒有可信證書,加上TrustServerCertificate=True來取消驗證證書是否受信,
<connectionStrings> <add name="Test" connectionString="Data Source=210.10.20.10,1433; Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;Encrypt=True;" providerName="System.Data.SqlClient" /> </connectionStrings>
相關鏈接:https://docs.microsoft.com/en-us/sql/connect/jdbc/connecting-with-ssl-encryption
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/21770.html
標籤:SQL Server
