我用的是 ShinyProxy 来实现Shiny应用的Kerberos认证,并为底层数据库提供票据授权。
所以基本上。
User -> ShinyProxy/Shiny Apps -> Database
使用Kerberos登录到Shiny,但是ShinyProxy无法获得冒充票。错误是
S4U2self ticket must be FORWARDABLE
我的krb5. conf设置了:
[libdefaults]
forwardable = true
ShinyProxy的SPN是 http/shinyproxy
其服务账户为 shinyproxy
.
服务账户的标志是 TRUSTED_TO_AUTH_FOR_DELEGATION
集。
数据库的SPN db/mydatabase
其服务账户为 database
服务账户 shinyproxy
在AD的 "授权 "选项卡中,我启用了 "任何认证协议 "的约束性授权,并添加了两个SPN。http/shinyproxy
和 db/mydatabase
.
日志输出。
Found KeyTab /etc/security/keytabs/shinyproxy-http.keytab for http/shinyproxy@MYREALM
Found KeyTab /etc/security/keytabs/shinyproxy-http.keytab for http/shinyproxy@MYREALM
Entered Krb5Context.acceptSecContext with state=STATE_NEW
Looking for keys for: http/shinyproxy@MYREALM
Added key: 1version: 2
Added key: 3version: 2
Added key: 23version: 2
Added key: 17version: 2
Added key: 18version: 2
>>> EType: sun.security.krb5.internal.crypto.ArcFourHmacEType
default etypes for permitted_enctypes: 18 17 23 3 1.
>>> EType: sun.security.krb5.internal.crypto.ArcFourHmacEType
MemoryCache: add 1587479092/069942/CDC00FC467F9DD904A13D2193831B707/myuser@MYREALM to myuser@MYREALM|HTTP/shinyproxy@MYREALM
>>> KrbApReq: authenticate succeed.
Krb5Context setting peerSeqNumber to: 1981624799
>>> EType: sun.security.krb5.internal.crypto.ArcFourHmacEType
Krb5Context setting mySeqNumber to: 505758374
>>> Constrained deleg from GSSCaller{UNKNOWN}
DEBUG: Config isForwardable = true
DEBUG: KDCOptions isForwardable = true
DEBUG: TGT (KerberosTicket) isForwardable = true
DEBUG: TGT (Credentials) isForwardable = true
DEBUG: Requesting impersonation ticket (S4U2self) for user myuser@MYREALM
>>> CksumType: sun.security.krb5.internal.crypto.HmacMd5ArcFourCksumType
>>> Credentials serviceCredsSingle: same realm
default etypes for default_tgs_enctypes: 18 17 23 3 1.
>>> EType: sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType
>>> CksumType: sun.security.krb5.internal.crypto.HmacSha1Aes256CksumType
>>> EType: sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType
>>> KrbKdcReq send: kdc=myad.MYREALM TCP:88, timeout=30000, number of retries =3, #bytes=1527
>>> KDCCommunication: kdc=myad.MYREALM TCP:88, timeout=30000,Attempt =1, #bytes=1527
2020-04-21 14:24:53.137 INFO 1 --- [ XNIO-2 task-1] e.o.containerproxy.service.UserService : User logged in [user: myuser@MYREALM]
>>>DEBUG: TCPClient reading 1756 bytes
>>> KrbKdcReq send: #bytes read=1756
>>> KdcAccessibility: remove myad.MYREALM:88
>>> EType: sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType
>>> TGS credentials serviceCredsSingle:
>>> DEBUG: ----Credentials----
client: myuser@MYREALM
server: myservice@MYREALM
ticket: sname: myservice@MYREALM
startTime: 1587479093000
endTime: 1587515088000
----Credentials end----
2020-04-21 14:24:53.159 ERROR 1 --- [pool-3-thread-1] e.o.c.a.i.k.KRBTicketRenewalManager : Error while renewing service tickets for myuser@MYREALM
sun.security.krb5.KrbException: S4U2self ticket must be FORWARDABLE
at sun.security.krb5.internal.CredentialsUtil.acquireS4U2selfCreds(CredentialsUtil.java:105) ~[na:1.8.0_252]
at sun.security.krb5.Credentials.acquireS4U2selfCreds(Credentials.java:495) ~[na:1.8.0_252]
at eu.openanalytics.containerproxy.auth.impl.kerberos.KRBUtils.obtainImpersonationTicket(KRBUtils.java:144) ~[containerproxy-0.8.3.jar!/:0.8.3]
at eu.openanalytics.containerproxy.auth.impl.kerberos.KRBTicketRenewalManager$RenewalJob.run(KRBTicketRenewalManager.java:102) ~[containerproxy-0.8.3.jar!/:0.8.3]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_252]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_252]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_252]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_252]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_252]
可以看到,kerberos ticket和凭证都是可以转发的 但是,KDC的响应并不包含一个可转发的 ticket。
有什么办法可以解决这个问题吗?
结果发现,在我测试的用户账号上。Account is sensitive and cannot be delegated
已定。