在BEA WebLogic Server上解決LDAP連結問
上一篇 / 下一篇 2008-06-30 22:30:32 / 个人分类:Weblogic
- 文件版本: V1.0
- 开发商: 本站原创
- 文件来源: 本地
- 界面语言: 简体中文
- 授权方式: 免费
- 运行平台: Win9X/Win2000/WinXP
在WebLogic Server(WLS)上轻量级目录撷取协议(LDAP)连结存在一些困难。可能您的认证提供者不能连结到LDAP。可能使用者不能认证或者能认证但是没有需要的密码。可能是组成员关系失败或者是您在定义多个认证提供者时遇到麻烦。或许客户端的认证恰好缓慢。无论您碰到什么问题,当LDAP连结失败时,我们都有一些有用的故障分析技巧。51Testing软件测试网 h1^PwB:E
5O+{8W
Bdr0 认证是一个认证提供者证明和检查使用者或系统进程的身份的过程。WebLogic Server提供几种认证提供者,包括撷取外部LDAP内存的LDAP认证提供者。WebLogic Server 提供了能撷取Open LDAP、Netscape iPlanet、LDAP Microsoft Active Directory、Novell NDS stores 以及其它LDAP内存的LDAP认证提供者。
ic*c
q j
a~ r#t0 当您定义一个LDAP认证提供者时,可能会经历一次或多次普通的认证失败。让我们来做一些故障分析,看是否我们能解决一些这样的问题。
8S0p#S/f
K.y![E3G0 连结问题。如果WebLogic Server 不能连结到LDAP服务器上,您需要检查:
- LDAP服务器正在运行。如果是的话,您可以尝试用一个像www.iit.edu/~gawojar/ldap的LDAP流览器去连结它。
- 在运行WLS的机器上已正确地定义和识别LDAP服务器的主机名。
- 埠号是正确的(预设的是389,对于SSL是636)。
- 负责人是一个在LDAP中的使用者,不仅仅他的使用者ID,而且完整的DN要设定为负责人,负责人设定如下:
Mb5Nit'|G7i051Testing软件测试网{a itcX+y
Principal="uid=admin,51Testing软件测试网9n~fO1J~ sY9j+j
ou=Administrators,51Testing软件测试网nXU bC
ou=TopologyManagement,
"F)a"cH7j'{WN0 o=NetscapeRoot" - 密码是负责人的密码。51Testing软件测试网-U_
M`*`u/}
N6s,~K
您可能收到一些常见的连结错误,如下:
;B6WpS!gmZ8d0 LDAP error (49)—incorrect password (credentials)51Testing软件测试网a D H |5V8ktu]
LDAP error (32)—incorrect principal (user)
要获得LDAP结果原始码的完整列表,请撷取:
OgdjK:Td&Jk)t0 http://docs.sun.com/source/816-5608-10/log.htm#15324.
Debug标志。您可以通过用WebLogic.Admin命令行工具控制标志DebugSecurityAdjudicator、 DebugSecurityAtn、DebugSecurityAtz 和DebugSecurityRoleMap,以便动态打开或关闭调校选项。例如,在ServerDebug Mbean的所有管理事例中(比如管理服务器或者所有被管理的服务器),为了打开DebugSecurityAtz,用这样的原始码:
z/l(@0E+_:{0 java weblogic.Admin -url t3://host:port
YE5~oS7LbqC0 -username adminuser -password adminpwd SET
+R4V4r.k;d_3I7X0 -type ServerDebug -property DebugSecurityAtz
5_YwDo%D(UA0 true
/|2u4a{)\ e+@cmQ"Z(w`0 注意,虽然在ServerDebugMBean状态下改变调校属性的值将会被反射,但是直到管理服务器重新激活才会产生输出。
8[4?VU l$q'q t0 对于每个您想调校的服务器,您也可以编辑档config.xml 和<ServerDebug/>中Mbean元素,把它设置为“true”表示启用,设置为“false”表示禁用:51Testing软件测试网:H9[)i*[1l*U%I
<ServerDebug51Testing软件测试网1X2i? P+?2n
DebugSecurityAdjudicator="true"
gcUZ%s1E#rL
O0 // for security adjucator debug
sRTS-Q
z
Ac0 DebugSecurityAtn="true"51Testing软件测试网|mu w u6C!z
// for security authentication debug
s)PqX"r-uo7B/x0 DebugSecurityAtz="true"51Testing软件测试网hU'uV&mai@$^(t
// for security authorization debug
-Sx)D!x X^2q`\0 DebugSecurityRoleMap="true"
?\XNNV-P0 // for security role mapping debug51Testing软件测试网Nz:AB+zI
Name="MyServer"/>
然后,您必须重新激活管理服务器。
w
o4y%V-dG,e"AsM0确保StdoutDebugEnabled设置成“true”。您可以在config.xml中检查这一点。通过控制台或者使用命令行,可以启用 Debug to stdout。
Hx;b&O+]`O[2l0w0 -Dweblogic.StdoutDebugEnabled=true51Testing软件测试网:L3~$n1Hb{YK
调校信息将会被记录在服务器日志和标准输出中。服务器的日志文件在激活时通过讯息BEA-170019指定:51Testing软件测试网f#E8@G-i$kS@:Lu
BEA-170019 Notice: The server log file fileName51Testing软件测试网?%?Z:VKe_P
is opened. All server side log events will be
.QTOid[R0 written to this file.
使用者认证失败。WLS首先连结到LDAP,然后根据认证提供者定义的“User Base DN” 和 “User Filter”搜寻使用者,一旦发现了使用者,WLS试着使用提供的密码去认证。
yp3j^H'v'a0 如果认证失败,在启用调校标志后,在日志文件中搜寻getDNForUser模式,看为什么会失败。很可能要么使用者不在LDAP中(javax.security.auth.login.FailedLoginException),或者密码不正确(认证失败错误49)。
_[8fL#S`0 搜寻类似如下:51Testing软件测试网.\*Kk{-M*bn2St"o
<SecurityDebug><getDNForUser search
:jM4x@`%|C w*E-E0 ("ou=people,dc=beasys,dc=com",51Testing软件测试网[FJ6mZR
"(&(uid=fred)(objectclass=person))",
l2|p3B.nu*W0 base DN & below)
!g*J*F5P,L%p0 如果使用者不存在,我们会看到这样的信息:51Testing软件测试网P
r2g'p(cC^|s
<SecurityDebug><returnConnection51Testing软件测试网`"u |,N@ I!o
i d"kV
conn:netscape.ldap.LDAPConnection@e4bb3c>51Testing软件测试网"?
t
APf$V*Dp
javax.security.auth.login.FailedLoginException:51Testing软件测试网)|h/{5W&L6X
j
[Security:090302]Authentication Failed:51Testing软件测试网.[ e'Uz2ffI
User fred denied
如果使用者的密码不正确,我们会看到LDAP中整个DN被检索,但是认证失败:
<SecurityDebug> <DN for user fred:51Testing软件测试网[8f)S*y,C7}/nu
uid=fred,ou=People,dc=beasys,dc=com>
4p(J/HDp?&geT0 <SecurityDebug> <authenticate user:fred with51Testing软件测试网F+QE#f&K
Q
DN:uid=fred,ou=People,dc=beasys,dc=com>51Testing软件测试网I*[sJci#Oh
<Debug> <SecurityDebug>
Dw
J
V:`{,a0 <authentication failed 49>
LU4Y8wj(@6q}0 组成员关系失败。在使用者经过认证后,WLS搜寻得到使用者属于那些组的列表,这样能够在组和角色之间对应。这种搜寻是通过用认证提供者定义的“Static Group DNs from Member DN Filter”来完成的。例如,对于iPlanet,这种搜寻类似如下:
(~ru hM1mYM"h0 (&(uniquemember=%M)
gXu${)[
Y|0 (objectclass=groupofuniquenames))
co3O5iw)d1Q;O0K`IO0 %M可以用我们查找的组使用者的完整DN代替。搜寻可以根据您的LDAP层次而改变,如果使用者不属于任何组,或者查询判别式不成立,我们可以看到相似的调校信息:
^{_wt'~0 <SecurityDebug>51Testing软件测试网]Um"wO2w"Q0q"na.o
<getDNForUser search("ou=people,dc=51Testing软件测试网&B.S:A4b-b;o
Q
beasys,dc=com", "(&(uid=fred)51Testing软件测试网{VJMh1z#qm
(objectclass=person))", base DN & below)>51Testing软件测试网(Gy s2Qbp6}
<SecurityDebug>
/Kx frrZB0 <DN for user fred: uid=fred,ou=People,
RReJK8m6fz0 dc=beasys,dc=com>
XZ;fCtNNx.Q\0 <SecurityDebug>
er!d&]/f0 <search("ou=groups, dc=beasys,dc=com",
,Z-o2D%O+}2a6u0 "(&(uniquemember=uid=fred,ou=People,
8|v5tOW2x&Pg0 dc=beasys,dc=com) (objectclass=51Testing软件测试网0o:LY/TL-p
groupofuniquenames))", base DN & below)>51Testing软件测试网oE;\M]tp
<SecurityDebug>51Testing软件测试网
Z1}$us'YQw(j6ZM
<Result has more elements: false>
注意%M如何被使用者的完整DN代替的。
角色对应失败。在使用者经过认证后,WLS把一连串的组和使用者当作允许撷取资源的负责人。它要么授权撷取或者拒绝撷取。因此呼叫角色对应程序来决定使用者和组的角色。然后,WLS撷取授权者,决定授权或者拒绝撷取要求的资源。清单1给出了一个被拒绝撷取的使用者的例子,因为他的角色不允许做他正在尽力做的事情——重新激活服务器。
清单1. 一个使用者,weblogic,它是管理组的成员但是没有管理角色,所以没有激活服务器的权限。
D(e Ic;T0 <SecurityDebug>