123.2. 配置 Web 控制台以允许使用智能卡通过 SSH 向远程主机进行身份验证的用户,而无需再次进行身份验证
在 RHEL web 控制台中登录到用户帐户后,您可以使用 SSH 协议连接到远程机器。您可以使用受限委托功能来使用 SSH,而无需再次进行身份验证。
在示例流程中,web 控制台会话在 myhost.idm.example.com 主机上运行,并将控制台配置为代表经过身份验证的用户使用 SSH 访问 remote.idm.example.com 主机。
先决条件
-
您已获得 IdM
admin票据授予票(TGT)。 -
您有访问
remote.idm.example.com的root权限。 -
cockpit服务在 IdM 中运行。 Web 控制台在用户会话中创建了一个
S4U2ProxyKerberos 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
流程
创建委派规则可访问的目标主机列表:
创建服务委托目标:
$ ipa servicedelegationtarget-add cockpit-target将目标主机添加到委派目标:
$ ipa servicedelegationtarget-add-member cockpit-target \ --principals=host/remote.idm.example.com@IDM.EXAMPLE.COM
通过创建服务委派规则并将 HTTP 服务 Kerberos 主体添加到其中,允许
cockpit会话访问目标主机列表:创建服务委派规则:
$ ipa servicedelegationrule-add cockpit-delegation将 Web 控制台客户端添加到委派规则中:
$ ipa servicedelegationrule-add-member cockpit-delegation \ --principals=HTTP/myhost.idm.example.com@IDM.EXAMPLE.COM将委派目标添加到委派规则中:
$ ipa servicedelegationrule-add-target cockpit-delegation \ --servicedelegationtargets=cockpit-target
在 remote.idm.example.com 主机上启用 Kerberos 身份验证:
-
以
root身份通过 SSH 连接到 remote.idm.example.com。 -
打开
/etc/ssh/sshd_config文件进行编辑。 -
通过取消注释
GSSAPIAuthentication no行,并使用GSSAPIAuthentication yes替换它来启用GSSAPIAuthentication。
-
以
在 remote.idm.example.com 上重启
sshd服务,以便更改生效:$ systemctl try-restart sshd.service