复合身份验证和 AD FS 中的 AD DS 声明

Windows Server 2012 通过引入复合身份验证增强了 Kerberos 身份验证。 复合身份验证使 Kerberos 票证授予服务 (TGS) 请求能够包含两个标识:

  • 用户的标识
  • 用户设备的标识。

Windows 通过扩展 Kerberos 灵活身份验证安全隧道 (FAST)(也称为 Kerberos Armoring)来实现复合身份验证。

AD FS 2012 和更高版本允许使用驻留在 Kerberos 身份验证票证中的由 AD DS 颁发的用户或设备声明。 在以前的 AD FS 版本中,声明引擎只能从 Kerberos 读取用户和组安全 ID (SID),但无法读取 Kerberos 票证中包含的任何声明信息。

通过将 Active Directory 域服务 (AD DS) 颁发的用户和设备声明与 Active Directory 联合身份验证服务 (AD FS) 一起使用,可为联合应用程序启用更丰富的访问控制。

要求

  1. 访问联合应用程序的计算机必须使用 Windows 集成身份验证向 AD FS 进行身份验证。

    • 只有在连接到后端 AD FS 服务器时,才可以使用 Windows 集成身份验证。
    • 计算机必须能够访问联合身份验证服务名称的后端 AD FS 服务器
    • AD FS 服务器必须在其 Intranet 设置中提供 Windows 集成身份验证作为主要身份验证方法。
  2. 对于访问受复合身份验证保护的联合应用程序的所有计算机,必须应用“Kerberos 客户端支持声明、复合身份验证和 Kerberos Armoring”策略。 这适用于单林或跨林方案。

  3. 包含 AD FS 服务器的域必须将“KDC 支持声明、复合身份验证和 Kerberos Armoring”策略设置应用于域控制器。

在 Windows Server 2012 R2 中配置 AD FS 的步骤

使用以下步骤配置复合身份验证和声明

步骤 1:在默认域控制器策略上启用声明、复合身份验证和 Kerberos Armoring 的 KDC 支持

  1. 在服务器管理器中,选择“工具”>“组策略管理”。
  2. 导航到“默认域控制器策略”,右键单击并选择“编辑”。 Screenshot showing the Default Domain Policy page in the Group Policy Management dialog box.
  3. 在“组策略管理编辑器”中的“计算机配置”下,依次展开“策略”、“管理模板”、“系统”,然后选择“KDC”。
  4. 在右侧窗格中,双击“KDC 支持声明、复合身份验证和 Kerberos Armoring”。 Screenshot of the Group Policy Management Editor showing the KDC support for claims, compound authentication, and Kerberos armoring setting highlighted.
  5. 在新对话框窗口中,将声明的 KDC 支持设置为“已启用”。
  6. 在“选项”下,从下拉菜单中选择“支持”,然后依次单击“应用”和“确定”。 Screenshot of the KDC support for claims, compound authentication and Kerberos armoring dialog box showing the Supported option selected.

步骤 2:在访问联合应用程序的计算机上启用声明、复合身份验证和 Kerberos Armoring 的 Kerberos 客户端支持

  1. 对于应用于访问联合应用程序的计算机的组策略,请在“组策略管理编辑器”中的“计算机配置”下,依次展开“策略”、“管理模板”、“系统”,然后选择“Kerberos”。
  2. 在“组策略管理编辑器”窗口的右侧窗格中,双击“Kerberos 客户端支持声明、复合身份验证和 Kerberos Armoring”。
  3. 在新对话窗口中,将“Kerberos 客户端支持”设置为“已启用”,然后依次单击“应用”和“确定”。 Screenshot of the KDC support for claims, compound authentication and Kerberos armoring dialog box showing the Enabled option selected.
  4. 关闭“组策略管理编辑器”。

步骤 3:确保 AD FS 服务器已更新。

需要确保 AD FS 服务器上安装了以下更新。

更新 说明
KB2919355 累积安全更新(包括 KB2919355、KB2932046、KB2934018、KB2937592、KB2938439)
KB2959977 Server 2012 R2 更新
修补程序 3052122 此更新添加了对 Active Directory 联合身份验证服务中复合 ID 声明的支持。

步骤 4:配置主要身份验证提供程序

  1. 对于 AD FS Intranet 设置,请将“主要身份验证提供程序”设置为“Windows 身份验证”。

  2. 在“AD FS 管理”中的“身份验证策略”下,选择“主要身份验证”,然后在“全局设置”下单击“编辑”。

  3. 在“编辑全局身份验证策略”中的“Intranet”下,选择“Windows 身份验证”。

  4. 依次单击“应用”和“确定”。

    Screenshot of the Edit Global Authentication Policy dialog box showing the Windows Authentication option selected.

  5. 使用 PowerShell 时,可以使用 Set-AdfsGlobalAuthenticationPolicy cmdlet。

Set-AdfsGlobalAuthenticationPolicy -PrimaryIntranetAuthenticationProvider 'WindowsAuthentication'

注意

在基于 WID 的场中,必须在主 AD FS 服务器上执行 PowerShell 命令。 在基于 SQL 的场中,可以在作为场成员的任何 AD FS 服务器上执行 PowerShell 命令。

步骤 5:将声明说明添加到 AD FS

  1. 将以下声明说明添加到场。 此声明说明在 AD FS 2012 R2 中默认不存在,需要手动添加。

  2. 在“AD FS 管理”中的“服务”下,右键单击“声明说明”并选择“添加声明说明”

  3. 在声明说明中输入以下信息

    • 显示名称:“Windows 设备组”
    • 声明说明:'<https://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdevicegroup>' `
  4. 勾选两个框。

  5. 单击“确定”。

    Screenshot of the Add a Claim Description dialog box.

  6. 使用 PowerShell 时,可以使用 Add-AdfsClaimDescription cmdlet。

    Add-AdfsClaimDescription -Name 'Windows device group' -ClaimType 'https://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdevicegroup' `
    -ShortName 'windowsdevicegroup' -IsAccepted $true -IsOffered $true -IsRequired $false -Notes 'The windows group SID of the device'
    

注意

在基于 WID 的场中,必须在主 AD FS 服务器上执行 PowerShell 命令。 在基于 SQL 的场中,可以在作为场成员的任何 AD FS 服务器上执行 PowerShell 命令。

步骤 6:在 msDS-SupportedEncryptionTypes 属性中启用复合身份验证位

  1. 使用 Set-ADServiceAccount PowerShell cmdlet,在指定的帐户的 msDS-SupportedEncryptionTypes 属性中启用复合身份验证位,以运行 AD FS 服务。

注意

如果更改了服务帐户,则必须通过运行 Set-ADUser -compoundIdentitySupported:$true Windows PowerShell cmdlet 手动启用复合身份验证。

Set-ADServiceAccount -Identity “ADFS Service Account” -CompoundIdentitySupported:$true
  1. 重启 AD FS 服务。

注意

将“CompoundIdentitySupported”设置为 true 后,在新服务器 (2012R2/2016) 上安装同一 gMSA 将会失败并出现以下错误 – Install-ADServiceAccount: 无法安装服务帐户。错误消息:“提供的上下文与目标不匹配。”

解决方法:暂时将 CompoundIdentitySupported 设置为 $false。 此步骤会导致 AD FS 停止发出 WindowsDeviceGroup 声明。 Set-ADServiceAccount -Identity 'ADFS Service Account' -CompoundIdentitySupported:$false。在新服务器上安装 gMSA,然后将启用 CompoundIdentitySupported 的项重新设置为 $True。 禁用再重新启用 CompoundIdentitySupported 后不需要重启 AD FS 服务。

步骤 7:更新 Active Directory 的 AD FS 声明提供程序信任

  1. 更新 Active Directory 的 AD FS 声明提供程序信任,以包含“WindowsDeviceGroup”声明的以下“直通”声明规则。
  2. 在“AD FS 管理”中单击“声明提供程序信任”,然后在右侧窗格中右键单击“Active Directory”并选择“编辑声明规则”。
  3. 在“编辑 Active Director 的声明规则”中,单击“添加规则”。
  4. 在“添加转换声明规则向导”中,选择“直通或筛选传入声明”,然后单击“下一步”。
  5. 添加显示名称,然后从“传入声明类型”下拉列表中选择“Windows 设备组”。
  6. 单击“完成”。 依次单击“应用”和“确定”。 Screenshot of the AD FS, Edit Claim Rules for Active Directory, and Edit Rule - Windows Device Group dialog boxes with arrows and call outs showing the workflow described above.

步骤 8:在需要“WindowsDeviceGroup”声明的信赖方中,添加类似的“直通”或“转换”声明规则。

  1. 在“AD FS 管理”中单击“信赖方信任”,然后在右侧窗格中,右键单击你的 RP 并选择“编辑声明规则”。
  2. 在“颁发转换规则”中单击“添加规则”。
  3. 在“添加转换声明规则向导”中,选择“直通或筛选传入声明”,然后单击“下一步”。
  4. 添加显示名称,然后从“传入声明类型”下拉列表中选择“Windows 设备组”。
  5. 单击“完成”。 依次单击“应用”和“确定”。 Screenshot of the AD FS, Edit Claim Rules for myclaims.fedhome.in, and Edit Rule - Windows Device Grp dialog boxes with arrows and call outs showing the workflow described above.

在 Windows Server 2016 中配置 AD FS 的步骤

下面详细介绍在 Windows Server 2016 的 AD FS 中配置复合身份验证的步骤。

步骤 1:在默认域控制器策略上启用声明、复合身份验证和 Kerberos Armoring 的 KDC 支持

  1. 在服务器管理器中,选择“工具”>“组策略管理”。
  2. 导航到“默认域控制器策略”,右键单击并选择“编辑”。
  3. 在“组策略管理编辑器”中的“计算机配置”下,依次展开“策略”、“管理模板”、“系统”,然后选择“KDC”。
  4. 在右侧窗格中,双击“KDC 支持声明、复合身份验证和 Kerberos Armoring”。
  5. 在新对话框窗口中,将声明的 KDC 支持设置为“已启用”。
  6. 在“选项”下,从下拉菜单中选择“支持”,然后依次单击“应用”和“确定”。

步骤 2:在访问联合应用程序的计算机上启用声明、复合身份验证和 Kerberos Armoring 的 Kerberos 客户端支持

  1. 对于应用于访问联合应用程序的计算机的组策略,请在“组策略管理编辑器”中的“计算机配置”下,依次展开“策略”、“管理模板”、“系统”,然后选择“Kerberos”。
  2. 在“组策略管理编辑器”窗口的右侧窗格中,双击“Kerberos 客户端支持声明、复合身份验证和 Kerberos Armoring”。
  3. 在新对话窗口中,将“Kerberos 客户端支持”设置为“已启用”,然后依次单击“应用”和“确定”。
  4. 关闭“组策略管理编辑器”。

步骤 3:配置主要身份验证提供程序

  1. 对于 AD FS Intranet 设置,请将“主要身份验证提供程序”设置为“Windows 身份验证”。
  2. 在“AD FS 管理”中的“身份验证策略”下,选择“主要身份验证”,然后在“全局设置”下单击“编辑”。
  3. 在“编辑全局身份验证策略”中的“Intranet”下,选择“Windows 身份验证”。
  4. 依次单击“应用”和“确定”。
  5. 使用 PowerShell 时,可以使用 Set-AdfsGlobalAuthenticationPolicy cmdlet。
Set-AdfsGlobalAuthenticationPolicy -PrimaryIntranetAuthenticationProvider 'WindowsAuthentication'

注意

在基于 WID 的场中,必须在主 AD FS 服务器上执行 PowerShell 命令。 在基于 SQL 的场中,可以在作为场成员的任何 AD FS 服务器上执行 PowerShell 命令。

步骤 4:在 msDS-SupportedEncryptionTypes 属性中启用复合身份验证位

  1. 使用 Set-ADServiceAccount PowerShell cmdlet,在指定的帐户的 msDS-SupportedEncryptionTypes 属性中启用复合身份验证位,以运行 AD FS 服务。

注意

如果更改了服务帐户,则必须通过运行 Set-ADUser -compoundIdentitySupported:$true Windows PowerShell cmdlet 手动启用复合身份验证。

Set-ADServiceAccount -Identity “ADFS Service Account” -CompoundIdentitySupported:$true
  1. 重启 AD FS 服务。

注意

将“CompoundIdentitySupported”设置为 true 后,在新服务器 (2012R2/2016) 上安装同一 gMSA 将会失败并出现以下错误 – Install-ADServiceAccount: 无法安装服务帐户。错误消息:“提供的上下文与目标不匹配。”

解决方法:暂时将 CompoundIdentitySupported 设置为 $false。 此步骤会导致 AD FS 停止发出 WindowsDeviceGroup 声明。 Set-ADServiceAccount -Identity 'ADFS Service Account' -CompoundIdentitySupported:$false。在新服务器上安装 gMSA,然后将启用 CompoundIdentitySupported 的项重新设置为 $True。 禁用再重新启用 CompoundIdentitySupported 后不需要重启 AD FS 服务。

步骤 5:更新 Active Directory 的 AD FS 声明提供程序信任

  1. 更新 Active Directory 的 AD FS 声明提供程序信任,以包含“WindowsDeviceGroup”声明的以下“直通”声明规则。
  2. 在“AD FS 管理”中单击“声明提供程序信任”,然后在右侧窗格中右键单击“Active Directory”并选择“编辑声明规则”。
  3. 在“编辑 Active Director 的声明规则”中,单击“添加规则”。
  4. 在“添加转换声明规则向导”中,选择“直通或筛选传入声明”,然后单击“下一步”。
  5. 添加显示名称,然后从“传入声明类型”下拉列表中选择“Windows 设备组”。
  6. 单击“完成”。 依次单击“应用”和“确定”。

步骤 6:在需要“WindowsDeviceGroup”声明的信赖方中,添加类似的“直通”或“转换”声明规则。

  1. 在“AD FS 管理”中单击“信赖方信任”,然后在右侧窗格中,右键单击你的 RP 并选择“编辑声明规则”。
  2. 在“颁发转换规则”中单击“添加规则”。
  3. 在“添加转换声明规则向导”中,选择“直通或筛选传入声明”,然后单击“下一步”。
  4. 添加显示名称,然后从“传入声明类型”下拉列表中选择“Windows 设备组”。
  5. 单击“完成”。 依次单击“应用”和“确定”。

验证

若要验证“WindowsDeviceGroup”声明的发布,请使用 .Net 4.6 创建一个测试声明感知应用程序。 使用 WIF SDK 4.0。 将应用程序配置为 AD FS 中的信赖方,并按照上述步骤使用声明规则对其进行更新。 使用 AD FS 的 Windows 集成身份验证提供程序对应用程序进行身份验证时,将创建以下声明。 Validation

现在可以使用计算机/设备的声明来实现更丰富的访问控制。

例如 – 以下 AdditionalAuthenticationRules 告知 AD FS 在以下情况下调用 MFA – 身份验证用户不是安全组“-1-5-21-2134745077-1211275016-3050530490-1117”的成员,并且计算机(用户进行身份验证的位置)不是安全组“S-1-5-21-2134745077-1211275016-3050530490-1115 (WindowsDeviceGroup)”的成员

但是,如果满足上述任一条件,则不调用 MFA。

'NOT EXISTS([Type == "https://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdevicegroup", Value =~ "S-1-5-21-2134745077-1211275016-3050530490-1115"])
&& NOT EXISTS([Type == "https://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid", Value =~ "S-1-5-21-2134745077-1211275016-3050530490-1117"])
=> issue(Type = "https://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod", Value = "https://schemas.microsoft.com/claims/multipleauthn");'