本文介紹了錯(cuò)誤:在Kerberos數(shù)據(jù)庫(kù)中找不到帶有SPNEGO:服務(wù)器的Java GSS-API(7)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
我正在嘗試使用本教程:https://docs.oracle.com/javase/8/docs/technotes/guides/security/jgss/lab/part5.html
我在一臺(tái)VM上運(yùn)行Kerberos KDC,并使用本指南進(jìn)行設(shè)置:http://techpubs.spinlocksolutions.com/dklar/kerberos.html
我已經(jīng)設(shè)置了兩個(gè)打印參數(shù):jessica@REALM.COM和host/jessica-ThinkPad-X220@REALM.COM,第二個(gè)的密鑰保存在我從VM復(fù)制到我的測(cè)試機(jī)的密鑰表中。
我可以通過(guò)kinit
ping KDC并獲得門(mén)票。
我編譯了所有代碼示例(Jaas.java
GssSpNegoServer.java
和GssSpNegoClient.java
),而沒(méi)有對(duì)教程進(jìn)行任何更改。
這是我的jaas-krb5.conf
:
client {
com.sun.security.auth.module.Krb5LoginModule required
principal="jessica";
};
server {
com.sun.security.auth.module.Krb5LoginModule required
useKeyTab=true
storeKey=true
keyTab=krb5.keytab
principal="host/jessica-ThinkPad-X220";
};
我正在使用java -Djava.security.auth.login.config=jaas-krb5.conf GssSpNegoServer
啟動(dòng)服務(wù)器
然后,在另一個(gè)窗口中,我使用以下命令啟動(dòng)客戶(hù)端
java -Djava.security.auth.login.config=jaas-krb5.conf GssSpNegoClient host hostname
這給出了以下錯(cuò)誤:
$ java -Djava.security.auth.login.config=jaas-krb5.conf GssSpNegoClient host jessica-ThinkPad-X220
Kerberos-Password for jessica:
Authenticated principal: [jessica@REALM.COM]
Connected to address jessica-ThinkPad-X220/192.168.178.78
Exception in thread "main" java.security.PrivilegedActionException: GSSException: No valid credentials provided (Mechanism level: No valid credentials provided (Mechanism level: Server not found in Kerberos database (7) - LOOKING_UP_SERVER))
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at Jaas.loginAndAction(Jaas.java:53)
at GssSpNegoClient.main(GssSpNegoClient.java:56)
Caused by: GSSException: No valid credentials provided (Mechanism level: No valid credentials provided (Mechanism level: Server not found in Kerberos database (7) - LOOKING_UP_SERVER))
at sun.security.jgss.spnego.SpNegoContext.initSecContext(SpNegoContext.java:454)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:248)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:179)
at GssSpNegoClient$GssClientAction.run(GssSpNegoClient.java:129)
... 4 more
Caused by: GSSException: No valid credentials provided (Mechanism level: Server not found in Kerberos database (7) - LOOKING_UP_SERVER)
at sun.security.jgss.krb5.Krb5Context.initSecContext(Krb5Context.java:770)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:248)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:179)
at sun.security.jgss.spnego.SpNegoContext.GSS_initSecContext(SpNegoContext.java:882)
at sun.security.jgss.spnego.SpNegoContext.initSecContext(SpNegoContext.java:317)
... 7 more
Caused by: KrbException: Server not found in Kerberos database (7) - LOOKING_UP_SERVER
at sun.security.krb5.KrbTgsRep.<init>(KrbTgsRep.java:73)
at sun.security.krb5.KrbTgsReq.getReply(KrbTgsReq.java:259)
at sun.security.krb5.KrbTgsReq.sendAndGetCreds(KrbTgsReq.java:270)
at sun.security.krb5.internal.CredentialsUtil.serviceCreds(CredentialsUtil.java:302)
at sun.security.krb5.internal.CredentialsUtil.acquireServiceCreds(CredentialsUtil.java:120)
at sun.security.krb5.Credentials.acquireServiceCreds(Credentials.java:458)
at sun.security.jgss.krb5.Krb5Context.initSecContext(Krb5Context.java:693)
... 11 more
Caused by: KrbException: Identifier doesn't match expected value (906)
at sun.security.krb5.internal.KDCRep.init(KDCRep.java:140)
at sun.security.krb5.internal.TGSRep.init(TGSRep.java:65)
at sun.security.krb5.internal.TGSRep.<init>(TGSRep.java:60)
at sun.security.krb5.KrbTgsRep.<init>(KrbTgsRep.java:55)
... 17 more
我不知道我做錯(cuò)了什么,有人能幫忙嗎?
Kerberos
首先檢查推薦答案日志(對(duì)于我,位于/var/log/auth.log
)中正在查找的服務(wù)器。您將在那里看到相應(yīng)的日志:
krb5kdc[5157]: TGS_REQ (3 etypes {18 17 16}) x.x.x.x: LOOKING_UP_SERVER: authtime 0, ex/admin@EXAMPLE for ex2/y.y.y.y@EXAMPLE, Server not found in Kerberos database
確保將y.y.y.y
更改為相應(yīng)系統(tǒng)的主機(jī)名,并將該主機(jī)名添加到主機(jī)中(即/etc/hosts
)
這篇關(guān)于錯(cuò)誤:在Kerberos數(shù)據(jù)庫(kù)中找不到帶有SPNEGO:服務(wù)器的Java GSS-API(7)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,