针对 SharePoint Server 配置 SQL Server 安全性

适用于:yes-img-132013 yes-img-162016 yes-img-192019 yes-img-seSubscription Edition yes-img-sopSharePoint in Microsoft 365

当您安装 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 并将默认实例使用的端口重新分配到不同端口。

  • 在服务器场中的所有前端 Web 服务器和应用程序服务器上配置 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 配置管理器。

  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 配置管理器。

  11. 重新启动 SQL Server 服务并确认运行 SQL Server 的计算机侦听的是您所选的端口。

    可以在重新启动 SQL Server 服务之后查看事件查看器日志以确认此信息。 请查找类似于以下事件的信息事件:

    事件类型: 信息

    事件源: MSSQL$MSSQLSERVER

    事件类别: (2)

    事件 ID:26022

    日期: 3/6/2008

    时间: 1:46:11 PM

    用户: N/A

    计算机: computer_name

    说明:

    SQL Server 正在监听 [ '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 安装程序,并安装下列客户端组件:

    • Connectivity Components

    • Management Tools

  3. 打开 SQL Server 配置管理器。

  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 Management Studio(在安装 SQL Server 客户端组件时可用)测试 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 Security Blog

SQL 漏洞评估

Securing SharePoint: Harden SQL Server in SharePoint Environments

Configure a Windows Firewall for Database Engine Access

Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)