ホスト tpno の kerberizing で問題が発生しました。私はhttp://grolmsnet.de/kerbtutをフォローしています。これは、Windows ドメインに追加されていないホストを kerberizing する他の人のために働いています。
問題は、何らかの理由でクライアントの NTLM トークンにあるようです。
サーバーのセットアップと状態、そしてテストクライアントについて説明します。
サーバ
環境:
OSはCentOS5.9、
yum でインストールされた Kerberos、Apache、および mod_auth_kerb:
httpd.x86_64 2.2.3-76.el5.centos installed
httpd-devel.i386 2.2.3-76.el5.centos installed
httpd-devel.x86_64 2.2.3-76.el5.centos installed
mod_auth_kerb.x86_64 5.1-5.el5 installed
krb5-devel.x86_64 1.6.1-70.el5 installed
krb5-libs.i386 1.6.1-70.el5 installed
krb5-libs.x86_64 1.6.1-70.el5 installed
krb5-workstation.x86_64 1.6.1-70.el5 installed
pam_krb5.i386 2.2.14-22.el5 installed
pam_krb5.x86_64 2.2.14-22.el5 installed
KDC/DC は Windows Server 2003 SP2 です
ケルベロス:
ドメイン管理者に AD アカウントを作成してもらい、ktpass を実行して SPN をこのアカウントにマップします。
ktpass.exe /princ HTTP/t.p.no@TESTSONE2.P.LOCAL /mapuser testsone2\user
/crypto DES-CBC-MD5 +DesOnly /Pass *** /ptype KRB5_NT_PRINCIPAL /out t.keytab
kerberize しようとしているサーバー/ホストで、kerberos が適切に構成されていることを確認するためにこれを実行しました。
# kinit -V jhs@TESTSONE2.P.LOCAL
Password for jhs@TESTSONE2.P.LOCAL:
Authenticated to Kerberos v5
# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: jhs@TESTSONE2.P.LOCAL
Valid starting Expires Service principal
05/13/13 15:32:13 05/14/13 01:32:17 krbtgt/TESTSONE2.P.LOCAL@TESTSONE2.P.LOCAL
renew until 05/14/13 15:32:13
Kerberos 4 ticket cache: /tmp/tkt0
klist: You have no tickets cached
そして、KDC がプリンシパルのチケットを送信してくれることを確認しました。
# kvno HTTP/t.p.no@TESTSONE2.P.LOCAL
HTTP/t.p.no@TESTSONE2.P.LOCAL: kvno = 9
# klist -e
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: jhs@TESTSONE2.P.LOCAL
Valid starting Expires Service principal
05/13/13 15:32:13 05/14/13 01:32:17 krbtgt/TESTSONE2.P.LOCAL@TESTSONE2.P.LOCAL
renew until 05/14/13 15:32:13, Etype (skey, tkt): ArcFour with HMAC/md5, ArcFour with HMAC/md5
05/13/13 15:34:27 05/14/13 01:32:17 HTTP/t.p.no@TESTSONE2.P.LOCAL
renew until 05/14/13 15:32:13, Etype (skey, tkt): DES cbc mode with CRC-32, DES cbc mode with RSA-MD5
Kerberos 4 ticket cache: /tmp/tkt0
klist: You have no tickets cached
kvno は keytab のものと一致します。
# ktutil
ktutil: rkt t.keytab
ktutil: l
slot KVNO Principal
---- ---- ---------------------------------------------------------------------
1 9 HTTP/t.p.no@TESTSONE2.P.LOCAL
tpno は、逆に tpno に解決される IP アドレスに解決される A レコードです。
これは私の仮想ホスト構成です。これは単純なパッセンジャー サービスの Rails アプリです。認証関連のディレクティブを使用して Location セクションを追加する前に動作をテストしました:
<VirtualHost *:80>
DocumentRoot /home/p/testapp/public
ServerName t.p.no
RackEnv staging
RailsEnv staging
<Directory /home/p/testapp/public>
Options -MultiViews
</Directory>
<Location />
AuthType Kerberos
AuthName "Logg inn"
KrbMethodNegotiate On
KrbMethodK5Passwd Off
KrbAuthRealms TESTSONE2.P.LOCAL
KrbServiceName HTTP # No difference if using full SPN here
Krb5KeyTab /etc/httpd/keys/t.keytab
require valid-user
</Location>
LogLevel debug
CustomLog logs/t.p.no-access_log combined_forwarded
ErrorLog logs/t.p.no-error_log
</VirtualHost>
クライアントが Internet Explorer で tpno を入力すると、Apache は次のログを記録します。
[debug] src/mod_auth_kerb.c(1496): [client 139.x.x.201] kerb_authenticate_user entered with user (NULL) and auth_type Kerberos
[debug] src/mod_auth_kerb.c(1496): [client 139.x.x.201] kerb_authenticate_user entered with user (NULL) and auth_type Kerberos
[debug] src/mod_auth_kerb.c(1151): [client 139.x.x.201] Acquiring creds for HTTP/t.p.no@TESTSONE2.P.LOCAL
[debug] src/mod_auth_kerb.c(1270): [client 139.x.x.201] Verifying client data using KRB5 GSS-API
[debug] src/mod_auth_kerb.c(1286): [client 139.x.x.201] Verification returned code 589824
[debug] src/mod_auth_kerb.c(1313): [client 139.x.x.201] Warning: received token seems to be NTLM, which isn't supported by the Kerberos module. Check your IE configuration.
[error] [client 139.116.152.201] gss_accept_sec_context() failed: Invalid token was supplied (No error)
クライアント
OS: Windows Server 2008 SP1
IE では IWA が有効になっており、http://tpnoがイントラネット ホストのリストに追加されています。
クライアントで tpno にアクセスしようとすると、Fiddler で 2 つの要求が表示されます。最初の要求では、クライアントは認証ヘッダーを送信せず、サーバーはステータス 401 とヘッダー WWW-Authenticate: Negotiate で応答します。
2 番目の要求で、クライアントはヘッダーを送信します。 Authorization: Negotiate [token data] フィドラーの [Auth-tab] に、トークン データが表示されます。
-[NTLM Type1: Negotiation]------------------------------
Provider: NTLMSSP
Type: 1
OS Version: 6.1:7601
Flags: 0xe2088297
Unicode supported in security buffer.
OEM strings supported in security buffer.
Request server's authentication realm included in Type2 reply.
Sign (integrity)
NTLM authentication.
Negotiate Always Sign.
Negotiate NTLM2 Key.
Supports 56-bit encryption.
Supports 128-bit encryption.
Client will provide master key in Type 3 Session Key field.
Domain_Offset: 0; Domain_Length: 0; Domain_Length2: 0
Host_Offset: 0; Host_Length: 0; Host_Length2: 0
Host:
Domain:
------------------------------------
NTLM トークンが送信された原因を突き止めるためのすべての助けをいただければ幸いです。