6.4. 将 Web 控制台配置为允许使用智能卡通过 SSH 验证到远程主机的用户,而无需再次进行身份验证
登录到 RHEL web 控制台中的用户帐户后,作为身份管理 (IdM) 系统管理员,您可能需要使用 SSH
协议连接到远程机器。您可以使用受限委托 功能来使用 SSH
,而无需再次进行身份验证。
按照以下流程,将 Web 控制台配置为使用受限委托。在以下示例中,web 控制台会话在 myhost.idm.example.com 主机上运行,它被配置为代表经过身份验证的用户使用 SSH
访问 remote.idm.example.com 主机。
先决条件
-
您已获得 IdM
admin
票据授予票(TGT)。 -
您有访问 remote.idm.example.com 的
root
权限。 - Web 控制台服务存在于 IdM 中。
- remote.idm.example.com 主机存在于 IdM 中。
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
流程
创建可以通过委派规则访问的目标主机列表:
创建服务委托目标:
$ 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 上重启
SSH
服务,以便上述更改会立即生效:$ systemctl try-restart sshd.service