Red Hat Training

A Red Hat training course is available for RHEL 8

49.4. 为 IdM 服务强制执行身份验证指标

身份验证(IdM)支持的验证机制在身份验证强度方面存在差异。例如,使用一次性密码(OTP)与标准密码(OTP)的结合来获取初始 Kerberos 票据授予票(TGT)被视为比仅使用标准密码进行身份验证更加安全。

通过将身份验证指示符与特定的 IdM 服务相关联,作为 IdM 管理员,您可以配置服务,以便只有使用这些特定预身份验证机制的用户才能获得他们可以访问该服务的初始 Kerberos 票据授予票(TGT)。

这样,您可以配置不同的 IdM 服务以便:

  • 只有使用更强大的身份验证方法获取其初始 TGT(如一次性密码(OTP))的用户才能访问对安全性至关重要的服务,比如 VPN。
  • 使用更简单的身份验证方法获取其初始 TGT(如密码)的用户只能访问非关键服务,如本地登录。

图 49.2. 使用不同技术进行身份验证的示例

auth 指示符

这个流程描述了创建 IdM 服务,并将其配置为需要传入的服务票据请求中的特定 Kerberos 身份验证指标。

49.4.1. 创建 IdM 服务条目及其 Kerberos keytab

为运行在 IdM 主机上的服务添加 IdM 服务 条目会创建相应的 Kerberos 主体,并允许服务请求 SSL 证书、Kerberos keytab 或两者。

以下流程描述了创建 IdM 服务条目,并为加密与该服务的通信生成关联的 Kerberos keytab。

先决条件

  • 您的服务可以存储 Kerberos 主体、SSL 证书,或两者。

流程

  1. 使用 ipa service-add 命令添加 IdM 服务,来创建与其关联的 Kerberos 主体。例如,要为运行在主机 client.example.com 上的 testservice 应用程序创建 IdM 服务条目:

    [root@client ~]# ipa service-add testservice/client.example.com
    -------------------------------------------------------------
    Modified service "testservice/client.example.com@EXAMPLE.COM"
    -------------------------------------------------------------
      Principal name: testservice/client.example.com@EXAMPLE.COM
      Principal alias: testservice/client.example.com@EXAMPLE.COM
      Managed by: client.example.com
  2. 为客户端上的服务生成并存储 Kerberos keytab。

    [root@client ~]# ipa-getkeytab -k /etc/testservice.keytab -p testservice/client.example.com
    Keytab successfully retrieved and stored in: /etc/testservice.keytab

验证步骤

  1. 使用 ipa service-show 命令显示 IdM 服务的信息。

    [root@server ~]# ipa service-show testservice/client.example.com
      Principal name: testservice/client.example.com@EXAMPLE.COM
      Principal alias: testservice/client.example.com@EXAMPLE.COM
      Keytab: True
      Managed by: client.example.com
  2. 使用 klist 命令显示服务的 Kerberos keytab 的内容。

    [root@server etc]# klist -ekt /etc/testservice.keytab
    Keytab name: FILE:/etc/testservice.keytab
    KVNO Timestamp           Principal
    ---- ------------------- ------------------------------------------------------
       2 04/01/2020 17:52:55 testservice/client.example.com@EXAMPLE.COM (aes256-cts-hmac-sha1-96)
       2 04/01/2020 17:52:55 testservice/client.example.com@EXAMPLE.COM (aes128-cts-hmac-sha1-96)
       2 04/01/2020 17:52:55 testservice/client.example.com@EXAMPLE.COM (camellia128-cts-cmac)
       2 04/01/2020 17:52:55 testservice/client.example.com@EXAMPLE.COM (camellia256-cts-cmac)

49.4.2. 使用 IdM CLI 将身份验证指示符与 IdM 服务相关联

作为身份管理(IdM)管理员,您可以配置主机或服务,来要求客户端应用程序提供的服务票据包含特定的验证指标。例如,您可以确保在获取 Kerberos 票据授予票据(TGT)时,只有使用有效的带有密码的 IdM 双因素身份验证令牌的用户才能访问该主机或服务。

按照以下流程配置服务,以要求来自传入服务票据请求的特定 Kerberos 身份验证指标。

先决条件

警告

不要 将身份验证指标分配给内部 IdM 服务。以下 IdM 服务无法执行 PKINIT 和多因素身份验证方法所需的交互式身份验证步骤:

host/server.example.com@EXAMPLE.COM
HTTP/server.example.com@EXAMPLE.COM
ldap/server.example.com@EXAMPLE.COM
DNS/server.example.com@EXAMPLE.COM
cifs/server.example.com@EXAMPLE.COM

流程

  • 使用 ipa service-mod 命令为服务指定一个或多个所需的身份验证指标,用 --auth-ind 参数标识。

    身份验证方法--auth-ind

    双因素身份验证

    otp

    RADIUS 身份验证

    radius

    PKINIT、智能卡或证书验证

    pkinit

    强化的密码(SPAKE 或 FAST)

    hardened

    例如,要求用户通过智能卡或 OTP 身份验证来检索主机 client.example.comtestservice 主体的服务票据:

    [root@server ~]# ipa service-mod testservice/client.example.com@EXAMPLE.COM --auth-ind otp --auth-ind pkinit
    -------------------------------------------------------------
    Modified service "testservice/client.example.com@EXAMPLE.COM"
    -------------------------------------------------------------
      Principal name: testservice/client.example.com@EXAMPLE.COM
      Principal alias: testservice/client.example.com@EXAMPLE.COM
      Authentication Indicators: otp, pkinit
      Managed by: client.example.com
注意

要从服务中删除所有验证指标,请提供一个空的指标列表:

[root@server ~]# ipa service-mod testservice/client.example.com@EXAMPLE.COM --auth-ind ''
------------------------------------------------------
Modified service "testservice/client.example.com@EXAMPLE.COM"
------------------------------------------------------
  Principal name: testservice/client.example.com@EXAMPLE.COM
  Principal alias: testservice/client.example.com@EXAMPLE.COM
  Managed by: client.example.com

验证步骤

  • 使用 ipa service-show 命令显示关于 IdM 服务的信息,包括其所需的身份验证指标。

    [root@server ~]# ipa service-show testservice/client.example.com
      Principal name: testservice/client.example.com@EXAMPLE.COM
      Principal alias: testservice/client.example.com@EXAMPLE.COM
      Authentication Indicators: otp, pkinit
      Keytab: True
      Managed by: client.example.com

49.4.3. 使用 IdM Web UI 将验证指标与 IdM 服务关联

作为身份管理(IdM)管理员,您可以配置主机或服务,以便客户端应用程序所提供的服务票据包含特定的身份验证指标。例如,您可以确保在获取 Kerberos 票据授予票据(TGT)时,只有使用带有密码的有效的 IdM 双因素身份验证令牌的用户才能访问该主机或服务。

按照以下流程,使用 IdM Web UI 配置主机或服务,以要求来自传入票据请求的特定的 Kerberos 身份验证指标。

先决条件

  • 您以管理用户的身份已登录到 IdM Web UI。

流程

  1. 选择 IdentityHostsIdentityServices
  2. 单击所需的主机或服务的名称。
  3. Authentication indicators 下,选择所需的验证方法。

    • 例如,选择 OTP 来确保在获取 Kerberos TGT 时,只有使用带有密码的有效的 IdM 双因素身份验证令牌的用户才能访问主机或服务。
    • 如果您选择 OTPRADIUS,那么在获取 Kerberos TGT 时使用带有密码的有效的 IdM 双因素身份验证令牌的用户,以及 使用 RADIUS 服务器获取 Kerberos TGT 的用户,都将被允许访问。
  4. 点击页面顶部的 Save

49.4.4. 为 IdM 服务检索 Kerberos 服务票据

以下流程描述了为 IdM 服务检索 Kerberos 服务票据。您可以使用此流程来测试 Kerberos 票据策略,比如强制票据授予票据(TGT)中存在某些 Kerberos 验证指标。

先决条件

流程

  • 使用带-S 选项的 kvno 命令来检索服务票据,并指定 IdM 服务的名称和管理它的主机的完全限定域名。

    [root@server ~]# kvno -S testservice client.example.com
    testservice/client.example.com@EXAMPLE.COM: kvno = 1
注意

如果您需要访问 IdM 服务以及当前的票据授予票据(TGT)没有所需的与之关联的 Kerberos 身份验证指标,请使用 kdestroy 命令清除当前的 Kerberos 凭证缓存,并检索新的 TGT:

[root@server ~]# kdestroy

例如,如果您最初通过使用密码的身份验证来获取了 TGT,并且您需要访问具有与之相关联的 pkinit身份验证指标的 IdM 服务,请销毁当前的凭证缓存,并使用智能卡重新进行身份验证。请参阅 Kerberos 身份验证指标

验证步骤

  • 使用 klist 命令来验证服务票据是否在默认的 Kerberos 凭据缓存中。

    [root@server etc]# klist_
    Ticket cache: KCM:1000
    Default principal: admin@EXAMPLE.COM
    
    Valid starting       Expires              Service principal
    04/01/2020 12:52:42  04/02/2020 12:52:39  krbtgt/EXAMPLE.COM@EXAMPLE.COM
    04/01/2020 12:54:07 04/02/2020 12:52:39 testservice/client.example.com@EXAMPLE.COM

49.4.5. 其它资源