Share via


設定 SharePoint Server 的 SQL Server 安全性

適用于:是-img-13 2013是-img-16 2016是-img-19 2019是-img-se訂閱版本 是-img-sopMicrosoft 365 中的 SharePoint

安裝 SQL Server 時,預設設定即可提供安全的資料庫。 此外,您可以使用 SQL Server 工具和 Windows 防火牆,為 SharePoint Server 環境的 SQL Server 增加額外的安全性。

重要事項

[!重要事項] 本主題中的安全性步驟已由 SharePoint 小組全面測試。 還有其他方式可協助保護 SharePoint Server 伺服器陣列中的 SQL Server。 如需詳細資訊,請參閱保護SQL Server

開始之前

開始這項作業之前,請檢閱下列有關如何保護伺服器陣列安全的工作:

  • 封鎖 UDP 連接埠 1434。

  • 將 SQL Server 的具名執行個體設定為在非標準的連接埠上接聽 (TCP 連接埠 1433 或 UDP 連接埠 1434 以外的連接埠)。

  • 若要再提高其安全性,請封鎖 TCP 連接埠 1433,並將預設執行個體使用的連接埠重新指定為不同的連接埠。

  • 在伺服器陣列中的所有前端網頁伺服器和應用程式伺服器上,設定 SQL Server 用戶端別名。 在您封鎖 TCP 連接埠 1433 或 UDP 連接埠 1434 之後,要與執行 SQL Server 的電腦通訊的所有電腦都必須使用 SQL Server 用戶端別名。

設定 SQL Server 執行個體接聽非預設連接埠

SQL Server 能夠重新指派預設執行個體和任何具名執行個體所使用的連接埠。 在SQL Server中,您會使用 SQL Server 組態管理員 重新指派 TCP 埠。 當您變更預設連接埠時,可防止知道預設指派的駭客利用這點來攻擊 SharePoint 環境,因此可讓環境更安全。

設定 SQL Server 執行個體接聽非預設連接埠

  1. 確認執行此程序的使用者帳戶是 sysadmin 或 serveradmin 固定伺服器角色的成員。

  2. 在執行 SQL Server 的電腦上,開啟 SQL Server Configuration Manager。

  3. In the navigation pane, expand SQL Server Network Configuration.

  4. 按一下所設定之執行個體的對應項目。

    The default instance is listed as Protocols for MSSQLSERVER. Named instances will appear as Protocols for named_instance.

  5. In the main window in the Protocol Name column, right-click TCP/IP, and then click Properties.

  6. Click the IP Addresses tab.

    每個指派給執行 SQL Server 之電腦的 IP 位址,在此索引標籤上都有對應的項目。SQL Server 預設會接聽指派給電腦的所有 IP 位址。

  7. 若要全域變更預設執行個體所接聽的連接埠,請執行下列步驟:

    • For each IP address except IPAll, clear all values for both TCP dynamic ports and TCP Port.

    • For IPAll, clear the value for TCP dynamic ports. In the TCP Port field, enter the port that you want the instance of SQL Server to listen on. For example, enter 40000.

  8. 若要全域變更具名執行個體所接聽的連接埠,請執行下列步驟:

    • For each IP address including IPAll, clear all values for TCP dynamic ports. A value of 0 for this field indicates that SQL Server uses a dynamic TCP port for the IP address. A blank entry for this value means that SQL Server will not use a dynamic TCP port for the IP address.

    • For each IP address except IPAll, clear all values for TCP Port.

    • For IPAll, clear the value for TCP dynamic ports. In the TCP Port field, enter the port that you want the instance of SQL Server to listen on. For example, enter 40000.

  9. Click OK.

    A message indicates that the change will not take effect until the SQL Server service is restarted. Click OK.

  10. 關閉 SQL Server Configuration Manager。

  11. 重新啟動 SQL Server 服務,並確認執行 SQL Server 的電腦正在接聽您選取的連接埠。

    您可以在重新啟動 SQL Server 服務之後查看事件檢視器記錄來進行確認。 請尋找與下列事件類似的資訊事件:

    事件類型:資訊

    事件來源:MSSQL$MSSQLSERVER

    事件類別:(2)

    事件識別碼:26022

    日期:3/6/2008

    時間:下午 1:46:11

    使用者:無

    電腦: 電腦名稱

    描述:

    伺服器正在 [ 'any' <ipv4>50000] 上接聽

  12. 驗證: 選擇性地包含使用者驗證作業是否成功應執行的步驟。

封鎖預設 SQL Server 接聽連接埠

具有進階安全性的 Windows 防火牆使用輸入規則和輸出規則,來協助保護連入及連出網路流量的安全。 因為 Windows 防火牆預設會封鎖所有來路不明的連入網路流量,所以您不需要明確封鎖預設 SQL Server 接聽連接埠。 如需詳細資訊,請參閱具有進階安全性的 Windows 防火牆設定 Windows 防火牆以允許 SQL Server 存取

將 Windows 防火牆設定為開啟手動指派的連接埠

若要透過防火牆存取SQL Server實例,您必須在執行 SQL Server 的電腦上設定防火牆以允許存取。 您手動指派的任何埠都必須在 Windows 防火牆中開啟。

將 Windows 防火牆設定為開啟手動指派的連接埠

  1. 確認執行此程序的使用者帳戶是 sysadmin 或 serveradmin 固定伺服器角色的成員。

  2. In Control Panel, open System and Security.

  3. 按一下 [Windows 防火牆],然後按一下 [ 進階設定 ] 以開啟 [ 具有進階安全性的 Windows 防火牆 ] 對話方塊。

  4. In the navigation pane, click Inbound Rules to display the available options in the Actions pane.

  5. Click New Rule to open the New Inbound Rule Wizard.

  6. 使用此精靈,完成允許存取<設定 SQL Server 執行個體接聽非預設連接埠>中所定義連接埠的必要步驟。

    注意事項

    You can configure the Internet Protocol security (IPsec) to help secure communication to and from your computer that is running SQL Server by configuring the Windows firewall. 若要這麼做,請在 [具有進階安全性的 Windows 防火牆] 對話方塊的流覽窗格中選取 [連線安全性 規則 ]。

設定 SQL Server 用戶端別名

若在執行 SQL Server 的電腦上封鎖 UDP 連接埠 1434 或 TCP 連接埠 1433,則必須在伺服器陣列中的所有其他電腦上建立 SQL Server 用戶端別名。 您可以使用 SQL Server 用戶端元件,為連線至 SQL Server 的電腦建立 SQL Server 用戶端別名。

設定 SQL Server 用戶端別名

  1. 確認執行此程序的使用者帳戶是 sysadmin 或 serveradmin 固定伺服器角色的成員。

  2. 在目標電腦上執行 SQL Server 的安裝程式,並安裝下列用戶端元件:

    • 連接元件

    • 管理工具

  3. 開啟 SQL Server Configuration Manager。

  4. In the navigation pane, click SQL Native Client Configuration.

  5. In the main window under Items, right-click Aliases, and select New Alias.

  6. 在 [ 別名 - 新增 ] 對話方塊的 [ 別名名稱 ] 欄位中,輸入別名的名稱。 例如,輸入 SharePoint _alias

  7. In the Port No field, enter the port number for the database instance. For example, enter 40000. Make sure that the protocol is set to TCP/IP.

  8. In the Server field, enter the name of the computer that is running SQL Server.

  9. Click Apply, and then click OK.

  10. 驗證: 您可以使用安裝 SQL Server 用戶端元件隨附的 SQL Server Management Studio 測試 SQL Server 用戶端別名。

  11. 啟動 SQL Server Management Studio。

  12. When you are prompted to enter a server name, enter the name of the alias that you created, and then click Connect. If the connection is successful, SQL ServerManagement Studio is populated with objects that correspond to the remote database.

  13. To check connectivity to additional database instances from SQL ServerManagement Studio, click Connect, and then click Database Engine.

另請參閱

其他資源

SQL Server 安全性部落格

SQL 弱點評量

保護 SharePoint 的安全:強化 SharePoint 環境中的 SQL Server

設定用於 Database Engine 存取的 Windows 防火牆

設定伺服器接聽特定 TCP 通訊埠 (SQL Server 組態管理員)