3

Windows 停用 TLS 1.0 之配套作業整理

 1 year ago
source link: https://blog.darkthread.net/blog/disable-tls-1-0-issues/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Windows 停用 TLS 1.0 之配套作業整理

2017-03-12 11:28 AM 24 108,228

開始之前,說說 TLS。

大家朗朗上口的 SSL(Security Socket Layer),最早源於 1995 年發表的 SSL 2.0(1.0 很雷,所以從沒公開過),隨後在 1996 推出 3.0 版,IETF 於 1999 年將 SSL 標準化,因版權考量改稱為 TLS(Transport Layer Security)。就技術而言, TLS 1.0 與 SSL 3.0 很相近,而 TLS 1.0 也支援降級改用 SSL 3.0。之後 IETF 分別在 2006、2008 年再推出安全強度更高的 TLS 1.1 與 TLS 1.2。

2014 年,Google 發現 SSL 3.0 存在致命安全漏洞,而攻擊者可藉由向 TLS 發送假的錯誤提示降級至 SSL 3.0,再利用 SSL 3.0 的漏洞竊取資訊,各家瀏覽器紛紛決定禁用 SSL 3.0。因此大家常說的 SSL,其實早已經被 TLS 取代。參考來源

TLS 1.0 因 CBC 加密模式設計不良,可能遭受 BEAST 攻擊導致加密內容被解密,便落入與 SHA1 相同的命運-被業界宣判限期下架,於是,「停用 SSL 3.0 與 TLS 1.0」成為資安檢核項目之一,建議系統管理人員早日關閉。

要在 Windows 停用 TLS 1.0、啟用 TLS 1.1、TLS 1.2,只需修改 Registry 即可完成。且慢,先別急著動手,刺激的在後面… 以下是這陣子雞飛狗跳摸石頭過河後的心得整理,短短幾行卻血淚交織,價值不斐:

  1. 停用 TLS 1.0 後遠端桌面連不上
    「用遠端桌面登入主機,設好 Registry 重開機後就再也連不進去了」這種劇情很驚險刺激吧?
    Windows 7 及 Windows 2008 R2 需先安裝更新,遠端桌面程式需更新到新版才支援 TLS 1.1/1.2 連線。
  2. 停用 TLS 1.0 後 SQL Server 起不來
    「 資料庫主機停用 TLS 1.0 並重開機,SQL Server 就起不來了」這種橋段也扣人心弦吧?
    在事件檢視器可看到類似錯誤: 
    A fatal error occurred while creating an SSL client credential. The internal error state is 10013.
    MVP Aaron Bertrand 有篇 Blog 詳細整理各版本 SQL Server 要支援 TLS 1.2 需要的最小版號,至於 SQL 詳細版本資訊的查詢方式,可參考前幾天的文章
  3. SQL Server 停用 TLS 1.0 後,.NET 程式無法連上資料庫
    SQL 更新並停用 TLS 1.0 後,原本使用 SqlConnection 連線 SQL 的 .NET 程式可能出現以下錯誤訊息:
    使用 Integrated Security=SSPI 以 AD 登入 - A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
    使用 SQL 帳號登入 - A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
    是的,ADO.NET 也得更新,請參考微軟這篇 KB,依據使用的 .NET 版本安裝對應的更新。除了 .NET 4.6,.NET 2.0/3.5/4.0 到 4.5.2 都需更新才能以 TLS 1.2 連上 SQL。
  4. 連線 TLS 1.2 HTTPS
    .NET 客戶端使用 WebClient、WCF 以 HTTPS 連線遠端主機,也會涉及 TLS 1.0/1.1/1.2 版本議題,不同版本 .NET 的處理方式不同:
    .NET 4.6 內建支援且預設使用 TLS 1.2
    .NET 4.5 內建支援,但需透過 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 設為預設協定
    .NET 4 本身不支援,但安裝 .NET 4.5 後即可使用 TLS 1.2,指定 TLS 1.2 的寫法為 ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
    (註:若不想修改 .NET 4/4.5 程式,也可透過 Registry 修改預設安全協定)
    .NET 3.5 需安裝 Hotfix 才能支援
        KB3154518 – Reliability Rollup HR-1605 – NDP 2.0 SP2 – Win7 SP1/Win 2008 R2 SP1
        KB3154519 – Reliability Rollup HR-1605 – NDP 2.0 SP2 – Win8 RTM/Win 2012 RTM
        KB3154520 – Reliability Rollup HR-1605 – NDP 2.0 SP2 – Win8.1RTM/Win 2012 R2 RTM
        KB3156421 -1605 HotFix Rollup through Windows Update for Windows 10.

事後來看遇上這些狀況合情合理,當初處理過程可不是這麼一回事:

遠端登入改完 Registry 重開機,之後遠端桌面連不進去、連進去發現 SQL Server 起不來、把 SQL 救起來後發現連 SQL 的 .NET 程式壞光光… 不知所以然胡搞瞎試搞完一回合,學新知還兼練心臟,好激刺呀~

以上是目前我蒐集到停用 TLS 1.0 所需的配套更新,未來如有發現再陸續補充更新。

2019-08-30 更新 ODBC 與 OLEDB 之 SQL Server TLS 1.2 支援問題


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK