56.3. 使用 RBCD 委托对服务的访问
要使用 RBCD 委托对服务的访问,必须在运行服务的主机上添加一个规则。这个示例流程描述了如何将用户凭据委托给带有 Kerberos 服务 HTTP/client.example.test
的 web 应用程序的文件服务器 nfs/client.example.test
。您可以在 client.example.test
主机上执行此操作,因为主机始终管理在其上运行的服务。
先决条件
-
您可以访问
client.example.test
主机的/etc/krb5.keytab
文件。 -
nfs/client.example.test
服务 keytab 存在。 -
HTTP/client.example.test
的 keytab/path/to/web-service.keytab
存在。
流程
在
client.example.test
主机上,获取一个 Kerberos 票据:# kinit -k
定义 RBCD ACL:
# ipa service-add-delegation nfs/client.example.test HTTP/client.example.test ------------------------------------------------------- Added new resource delegation to the service principal "nfs/client.example.test@EXAMPLE.TEST" ------------------------------------------------------- Principal name: nfs/client.example.test@EXAMPLE.TEST Delegation principal: HTTP/client.example.test@EXAMPLE.TEST
验证
要验证委托是否被正确设置,您可以通过 HTTP
服务模拟 testuser
用户登录,并执行一个到 NFS
服务的协议转换。
查看 NFS 服务,以验证委托规则是否存在:
# ipa service-show nfs/client.example.test Principal name: nfs/client.example.test@EXAMPLE.TEST Principal alias: nfs/client.example.test@EXAMPLE.TEST Delegation principal: HTTP/client.example.test@EXAMPLE.TEST Keytab: True Managed by: client.example.test
为 HTTP 服务主体获取一个 Kerberos 票据:
# kinit -kt http.keytab HTTP/client.example.test
验证票据授予票据是否存在:
# klist -f Ticket cache: KCM:0:99799 Default principal: HTTP/client.example.test@EXAMPLE.TEST Valid starting Expires Service principal 10/13/2023 14:39:23 10/14/2023 14:05:07 krbtgt/EXAMPLE.TEST@EXAMPLE.TEST Flags: FIA
代表
testuser
执行协议转换:# kvno -U testuser -P nfs/client.example.test nfs/client.example.test@EXAMPLE.TEST: kvno = 1
验证在协议转换过程中代表
testuser
获得的票据是否存在:# klist -f Ticket cache: KCM:0:99799 Default principal: HTTP/client.example.test@EXAMPLE.TEST Valid starting Expires Service principal 10/13/2023 14:39:38 10/14/2023 14:05:07 HTTP/client.example.test@EXAMPLE.TEST for client testuser@EXAMPLE.TEST, Flags: FAT 10/13/2023 14:39:23 10/14/2023 14:05:07 krbtgt/EXAMPLE.TEST@EXAMPLE.TEST Flags: FIA 10/13/2023 14:39:38 10/14/2023 14:05:07 nfs/client.example.test@EXAMPLE.TEST for client testuser@EXAMPLE.TEST, Flags: FAT