Red Hat Training

A Red Hat training course is available for RHEL 8

117.2. 配置 Web 控制台以允许通过智能卡通过 SSH 向远程主机进行身份验证的用户,而无需再次进行身份验证

在 RHEL web 控制台中登录到用户帐户后,作为 Identity Management (IdM)系统管理员,您可能需要使用 SSH 协议连接到远程机器。您可以使用 受限委派 功能来使用 SSH,而无需再次进行身份验证。

按照以下流程,将 Web 控制台配置为使用受限的委托。在以下示例中,web 控制台会话在 myhost.idm.example.com 主机上运行,它被配置为通过代表经过身份验证的用户使用 SSH 访问 remote.idm.example.com 主机。

先决条件

  • 已获得 IdM admin ticket-granting ticket (TGT)。
  • 有到 remote.idm.example.comroot 访问权限。
  • web 控制台服务存在于 IdM 中。
  • IdM 中存在 remote.idm.example.com 主机。
  • web 控制台在用户会话中创建了一个 S4U2Proxy Kerberos ticket。要验证这种情况,以 IdM 用户身份登录 web 控制台,打开 Terminal 页面,输入:

    $ klist
    Ticket cache: FILE:/run/user/1894000001/cockpit-session-3692.ccache
    Default principal: user@IDM.EXAMPLE.COM
    
    Valid starting     Expires            Service principal
    07/30/21 09:19:06 07/31/21 09:19:06 HTTP/myhost.idm.example.com@IDM.EXAMPLE.COM
    07/30/21 09:19:06  07/31/21 09:19:06  krbtgt/IDM.EXAMPLE.COM@IDM.EXAMPLE.COM
            for client HTTP/myhost.idm.example.com@IDM.EXAMPLE.COM

流程

  1. 创建可由委派规则访问的目标主机列表:

    1. 创建服务委托目标:

      $ ipa servicedelegationtarget-add cockpit-target
    2. 将目标主机添加到委托目标:

      $ ipa servicedelegationtarget-add-member cockpit-target \ --principals=host/remote.idm.example.com@IDM.EXAMPLE.COM
  2. 允许 cockpit 会话通过创建服务委托规则并将 HTTP 服务主体添加到目标主机列表来访问目标主机列表:

    1. 创建服务委托规则:

      $ ipa servicedelegationrule-add cockpit-delegation
    2. 将 Web 控制台客户端添加到 delegation 规则中:

      $ ipa servicedelegationrule-add-member cockpit-delegation \ --principals=HTTP/myhost.idm.example.com@IDM.EXAMPLE.COM
    3. 在委托规则中添加委托目标:

      $ ipa servicedelegationrule-add-target cockpit-delegation \ --servicedelegationtargets=cockpit-target
  3. remote.idm.example.com 主机上启用 Kerberos 身份验证:

    1. root 用户身份通过 SSH 连接到 remote.idm.example.com
    2. 打开 /etc/ssh/sshd_config 文件进行编辑。
    3. 通过取消注释 GSSAPIAuthentication no 行,并使用 GSSAPIAuthentication yes 替换它来启用 GSSAPIAuthentication
  4. remote.idm.example.com 上重启 SSH 服务,以便上述更改立即生效:

    $ systemctl try-restart sshd.service