在BEA WebLogic Server上解決LDAP連結問

上一篇 / 下一篇  2008-06-30 22:30:32 / 个人分类:Weblogic

  • 文件版本: V1.0
  • 开发商: 本站原创
  • 文件来源: 本地
  • 界面语言: 简体中文
  • 授权方式: 免费
  • 运行平台: Win9X/Win2000/WinXP

  在WebLogic ServerWLS)上轻量级目录撷取协议(LDAP)连结存在一些困难。可能您的认证提供者不能连结到LDAP。可能使用者不能认证或者能认证但是没有需要的密码。可能是组成员关系失败或者是您在定义多个认证提供者时遇到麻烦。或许客户端的认证恰好缓慢。无论您碰到什么问题,当LDAP连结失败时,我们都有一些有用的故障分析技巧。

M%@4t'zFz051Testing软件测试网+y CuOG}0vq

  认证是一个认证提供者证明和检查使用者或系统进程的身份的过程。WebLogic Server提供几种认证提供者,包括撷取外部LDAP内存的LDAP认证提供者。WebLogic Server 提供了能撷取Open LDAP、Netscape iPlanet、LDAP Microsoft Active Directory、Novell NDS stores 以及其它LDAP内存的LDAP认证提供者。

I7]nn7Hv] P_ V0

"G3jZE {w5z0  当您定义一个LDAP认证提供者时,可能会经历一次或多次普通的认证失败。让我们来做一些故障分析,看是否我们能解决一些这样的问题。51Testing软件测试网 uxdCX g4Wpn*R

A9EU:\Q6\8Q0  连结问题。如果WebLogic Server 不能连结到LDAP服务器上,您需要检查:

3M ^D2XQ9D2C[ @@0
  • LDAP服务器正在运行。如果是的话,您可以尝试用一个像www.iit.edu/~gawojar/ldapLDAP流览器去连结它。
  • 在运行WLS的机器上已正确地定义和识别LDAP服务器的主机名。
  • 埠号是正确的(预设的是389,对于SSL636)。
  • 负责人是一个在LDAP中的使用者,不仅仅他的使用者ID,而且完整的DN要设定为负责人,负责人设定如下:
    @*sQe\7Et,I1J@5Tm/K0
    Fq*Ply)c$h0Principal="uid=admin,51Testing软件测试网:J+s,q:_(\-KMt$Dj
        ou=Administrators,
    B&s#{_^0
        
    ou=TopologyManagement,
    +WXU(x hH1d0
        o=NetscapeRoot"
  • 密码是负责人的密码。
    1EC*V3aWJ&pKj0
      您可能收到一些常见的连结错误,如下:51Testing软件测试网1t P-]*R#HzK v#P+q
      LDAP error (49)—incorrect password (credentials)51Testing软件测试网8l.i5a@/k
      LDAP error (32)—incorrect principal (user)

8g9AE/K1A$q.wb#v0  要获得LDAP结果原始码的完整列表,请撷取:51Testing软件测试网6R5|)b'q/k3A%c h/E
  
http://docs.sun.com/source/816-5608-10/log.htm#15324.
51Testing软件测试网^9n.CW M;k$Rk*b

c2Enrt+]:m0  Debug标志。您可以通过用WebLogic.Admin命令行工具控制标志DebugSecurityAdjudicator、 DebugSecurityAtn、DebugSecurityAtz 和DebugSecurityRoleMap,以便动态打开或关闭调校选项。例如,在ServerDebug Mbean的所有管理事例中(比如管理服务器或者所有被管理的服务器),为了打开DebugSecurityAtz,用这样的原始码:
C.n {F H6aJ)oH*qr0  java weblogic.Admin -url t3://host:port51Testing软件测试网)t;_4K#AP*IjQm2d
       -username adminuser -password adminpwd SET51Testing软件测试网{!Ju}8LOIe
       -type ServerDebug -property DebugSecurityAtz
;AIDW B7^2E0       true

1a/]bF E1Bv0

G)e(V6NB{0  注意,虽然在ServerDebugMBean状态下改变调校属性的值将会被反射,但是直到管理服务器重新激活才会产生输出。51Testing软件测试网Wi.I2u:L)N c

3n_ g6mMo:E0  对于每个您想调校的服务器,您也可以编辑档config.xml 和<ServerDebug/>中Mbean元素,把它设置为“true”表示启用,设置为“false”表示禁用:
N9n$Wo(i0  <ServerDebug51Testing软件测试网7q+wsp,|ae4}!~C9~
  DebugSecurityAdjudicator="true"51Testing软件测试网0C-n7r}k M5U$S%K
      // for security adjucator debug
7Q)h:X U7w {:c:vT0  DebugSecurityAtn="true"
,zt,X.bi8N0      // for security authentication debug51Testing软件测试网 l"[)]L*~+d
  DebugSecurityAtz="true"
t[W{#u0      // for security authorization debug51Testing软件测试网8WNVY*VC
  DebugSecurityRoleMap="true"
?pM:FSc5e0      // for security role mapping debug51Testing软件测试网4pzR?y6lp
  Name="MyServer"/>
51Testing软件测试网5kF!l4F{j/p m

"[;uQn#Rc5s0  然后,您必须重新激活管理服务器。
6QIv:_EC6\0确保StdoutDebugEnabled设置成“true”。您可以在config.xml中检查这一点。通过控制台或者使用命令行,可以启用 Debug to stdout。51Testing软件测试网$B&v(b)A9T#@nv8?
  -Dweblogic.StdoutDebugEnabled=true
t0S7EMd8^/|0调校信息将会被记录在服务器日志和标准输出中。服务器的日志文件在激活时通过讯息BEA-170019指定:51Testing软件测试网@V)d4Q:U2P
  BEA-170019 Notice: The server log file fileName51Testing软件测试网0AS&pQ/WfQ&b9D H%p
      is opened. All server side log events will be51Testing软件测试网,y7S.d!|_
      written to this file.
51Testing软件测试网)up*q5\#CT/`

r eJ`-g1e8|)q3N0  使用者认证失败。WLS首先连结到LDAP,然后根据认证提供者定义的“User Base DN” 和 “User Filter”搜寻使用者,一旦发现了使用者,WLS试着使用提供的密码去认证。

Q&N XE/^051Testing软件测试网0lo*I;P@nU5N

  如果认证失败,在启用调校标志后,在日志文件中搜寻getDNForUser模式,看为什么会失败。很可能要么使用者不在LDAP中(javax.security.auth.login.FailedLoginException),或者密码不正确(认证失败错误49)。51Testing软件测试网%sp [C9Wd)l

51Testing软件测试网U$H zdS[b F

  搜寻类似如下:51Testing软件测试网j-v#K:z'Q
  <SecurityDebug><getDNForUser search51Testing软件测试网.u[;\KuY0s9~;p
      ("ou=people,dc=beasys,dc=com",51Testing软件测试网^8X.vxy g/u"PS
      "(&(uid=fred)(objectclass=person))",51Testing软件测试网-d#VqlD/s{ Yk@
      base DN & below)

#p'NN;r.]xC0

#@i'HQ F)`0  如果使用者不存在,我们会看到这样的信息:51Testing软件测试网)duP&\O FiK-Z
  <SecurityDebug><returnConnection
W5T\d)T.So0      conn:netscape.ldap.LDAPConnection@e4bb3c>
H-?$G/z i2o R0{,E:l}0  javax.security.auth.login.FailedLoginException:
GZ m#m @:M0      [Security:090302]Authentication Failed:51Testing软件测试网,y-WW1IO%C)\d
      User fred denied
51Testing软件测试网?|(l1m.e G

51Testing软件测试网Hn.rW7lup

  如果使用者的密码不正确,我们会看到LDAP中整个DN被检索,但是认证失败:51Testing软件测试网`t KSW {z"p3~

pO lX;Xo7s0  <SecurityDebug> <DN for user fred:
}7J2A*u0Htf J;]0      uid=fred,ou=People,dc=beasys,dc=com>
!Wah|k3}0  <SecurityDebug> <authenticate user:fred with
6W7Ow8Iw o@7]0      DN:uid=fred,ou=People,dc=beasys,dc=com>
(s:T-EkS9F:M!U0  <Debug> <SecurityDebug>51Testing软件测试网'zV$KV8L
  <authentication failed 49>
51Testing软件测试网:I9D~"yVt{7g

B,t+`a mM3@0  组成员关系失败。在使用者经过认证后,WLS搜寻得到使用者属于那些组的列表,这样能够在组和角色之间对应。这种搜寻是通过用认证提供者定义的“Static Group DNs from Member DN Filter”来完成的。例如,对于iPlanet,这种搜寻类似如下:51Testing软件测试网*x#Yj.C&T7R(E
  (&(uniquemember=%M)
Y Y#D}*N0  (objectclass=groupofuniquenames))

z:k+R8L-Cg7@X-D$n051Testing软件测试网$O k0P$@t?

  %M可以用我们查找的组使用者的完整DN代替。搜寻可以根据您的LDAP层次而改变,如果使用者不属于任何组,或者查询判别式不成立,我们可以看到相似的调校信息:51Testing软件测试网1^$_9[M2LF'G

51Testing软件测试网3qE1FFZt9[

  <SecurityDebug>51Testing软件测试网,D CswFa*i6H*V+e
  <getDNForUser search("ou=people,dc=51Testing软件测试网:u yj.WRX
      beasys,dc=com", "(&(uid=fred)51Testing软件测试网wd+P {Gl_
      (objectclass=person))", base DN & below)>51Testing软件测试网L0O7|['M_
  <SecurityDebug>51Testing软件测试网gK9X$k7W\hE)f
  <DN for user fred: uid=fred,ou=People,51Testing软件测试网0k v9rxU[Oc
      dc=beasys,dc=com>
vgm#D"|aXMs0  <SecurityDebug>
8B.?]0i:Y0  <search("ou=groups, dc=beasys,dc=com",51Testing软件测试网 S)ZZ_0x-oY Z
      "(&(uniquemember=uid=fred,ou=People,
sQ [2Gi;^0SS@0      dc=beasys,dc=com) (objectclass=51Testing软件测试网id.]*OM
      groupofuniquenames))", base DN & below)>
C.W_ {)P,{1N/c*LP0  <SecurityDebug>
#L(iw,m6v4SkQ0  <Result has more elements: false>
51Testing软件测试网0HKI3L!NvUSj3E-F b

51Testing软件测试网U-} e;| bz

  注意%M如何被使用者的完整DN代替的。51Testing软件测试网8WV`/Yf.j@

51Testing软件测试网[W vd}"pk

  角色对应失败。在使用者经过认证后,WLS把一连串的组和使用者当作允许撷取资源的负责人。它要么授权撷取或者拒绝撷取。因此呼叫角色对应程序来决定使用者和组的角色。然后,WLS撷取授权者,决定授权或者拒绝撷取要求的资源。清单1给出了一个被拒绝撷取的使用者的例子,因为他的角色不允许做他正在尽力做的事情——重新激活服务器。

!r[#^f,F0

9v o`q({+i+B,K H,tX C0  清单1. 一个使用者,weblogic,它是管理组的成员但是没有管理角色,所以没有激活服务器的权限。51Testing软件测试网H'A8U vX3m%b?

51Testing软件测试网4Z@#}@-d8bqN5?N4G

  <SecurityDebug>51Testing软件测试网 kQ$SuI5bL
  <Default RoleMapper getRoles(): input arguments:
rE/h2I'Q c0      Subject: 2
4a ak'C;Y*g[9I^FR0      Principal = class weblogic.security.principal.51Testing软件测试网.QNwC!Wb Q#{
      WLSUserImpl("weblogic")
3y.B?2OYd6O0      Principal = class weblogic.security.principal.
-} Y&x#]f*K&B8~ V0      WLSGroupImpl("Admin")
7u~D:a$B%C0      Resource: type=<svr>, application=,
8uJVst)D!u tS0      server=cgServer, action=boot>
Wdc8\$c2X|'hy0  <SecurityDebug>
/bJX1v7F Rn0  <Default RoleMapper getRoles(): returning roles:
G)r[/gD*r1FyC0      Anonymous>51Testing软件测试网"E9_v RT;G7YzT
  <SecurityDebug>51Testing软件测试网I V.dw2ESFBYNs
  <RoleManager.getRoles Subject: Subject: 2
Y e$O&? AS ?0W*W0      Principal = class weblogic.security.principal.51Testing软件测试网:UKR"\e/R
      WLSUserImpl("weblogic")
PW;q}#?5_2kTD0Q0      Principal = class weblogic.security.principal.
MSA"H4]&~8x0      WLSGroupImpl("Admin")51Testing软件测试网_&rqUE&P'z){
      Resource: <svr> type=<svr>, application=,51Testing软件测试网ax!d:hX[
      server=cgServer, action=boot Anonymous roles.>
9g be1CG4I#pt5u0  <SecurityDebug>
p-w8M\%} Wg'u7M9aZ0  <Default Authorization isAccessAllowed():
~4s-qC^ef?0      input arguments:>51Testing软件测试网1zY"JE MOa@_
  <SecurityDebug>51Testing软件测试网6R%It E Q{,B [!R
  <Subject: 251Testing软件测试网1}|.af1U
      Principal = class weblogic.security.principal.51Testing软件测试网$?A E] C$u/fM9X
      WLSUserImpl("weblogic")
$B2D?lLwH0      Principal = class weblogic.security.principal.
5F3c?I^M0      WLSGroupImpl("Admin")51Testing软件测试网b x1Gy7}$~ Qx"Im
  <SecurityDebug> <Roles:Anonymous>
5skdo7L0  <SecurityDebug> <Resource: type=<svr>,51Testing软件测试网+[EkCR!C%Eg
      application=, server=cgServer, action=boot>
B Z @_A.AK0  <SecurityDebug> <Direction: ONCE>
X$tD+|f3[x0  <SecurityDebug> <Context Handler: >
M$ir)_0D+@2r2P*uT0  <SecurityDebug> <null>
a*A,[V9l uc0  <SecurityDebug> <Default Authorization
"N&K)b^j6u0      isAccessAllowed(): returning DENY>

V+wcd.I {$l@}051Testing软件测试网 |'h c\5v0_

  如果存在多重认证提供者,就由协调者根据授权撷取规则去决定是授权还是拒绝撷取所请求的资源。51Testing软件测试网%dd e,I7F k} W
性能问题。把使用者属于的那些组编成一个列表。然后对于其中每一个组,WLS寻找所有它属于的组。递归地执行这个过程直到一个组不属于其它的所有组。
51Testing软件测试网%s,l2Y6g&q:ag

51Testing软件测试网#Yh0pF&V GK E8RT m

  因此,例如,如果使用者U1属于组G1和G2,组G1属于组G3,于是使用者U1属于G1、G2、G3。组成员关系取决于U1(汇出G1和G2),然后是G1(汇出G3),再是G2(没有汇出),再是G3(没有汇出)。这个递归搜寻可能导致性能问题,特别是如果LDAP中有许多组。为了避免这样的性能问题和限制递归呼叫的次数,我们可以设定两个参数:GroupMembershipSearching 和MaxGroupMembershipSearchLevel。51Testing软件测试网;W z [w+Q

51Testing软件测试网.mWo B-IeLa)V

  GroupMembershipSearching属性控制是否组搜寻限制深度,缺省的是无限搜寻。如果设定一个限制搜寻,  MaxGroupMembershipSearchLevel属性具体指定限度。如果设定一个无限制搜寻,则忽略axGroupMembershipSearchLevel属性。

wHa Dt~:T0

` lx aJWrVm0  如果GroupMembershipSearching属性设置为限定的,则MaxGroupMembershipSearchLevel属性控制组成员关系的搜寻深度,否则,它被忽略,缺省值为0。51Testing软件测试网9CthMa*hfBD BVM&i

9@T6l5f%A/\;jf@0  注意这些参数在WLS 8.1 SP3中是可以获得的。已经为 WLS 8.1 SP1 和 WLS 8.1 SP2 提供了一个补丁。51Testing软件测试网O0bp_9{of e
多重认证提供者。我们可以设定多重认证提供者。我们应该设置JAAS Control Flag attribute on the Authenticator-->General tab来控制认证提供者如何在登入序列中使用。控制标记可以是下面这些值中的一个:
51Testing软件测试网8{l&s c-mp#f#Rb

  • REQUIRED——认证提供者总是被呼叫,使用者必须总是通过它的认证测试
  • SUFFICIENT——如果使用者通过认证提供者的测试,就不执行其它的认证提供者(除非JASS控制标记设置为REQUIRENCED的认证提供者),因为使用者已经经过充分认证了。
  • REQUISITE——如果使用者通过了这个认证提供者的测试。则执行其它的认证提供者,但是可能失败(除了JASS控制标记设置为REQUIRENCED的认证提供者)
  • OPTIONAL——使用者允许通过认证提供者的认证测试,然而,如果所有在安全域设定的认证提供者的JASS控制标记设置为OPTIONAL,则使用者必须通过一个提供者的认证考察。
51Testing软件测试网 LX}qhtf|}

  当一个安全提供者建立时,WebLogic Server 管理控制台设置JASS控制标记为OPTIONAL。安全提供者的Mbeans缺省为REQUIRED。51Testing软件测试网q}!H7vyHyUo*P

51Testing软件测试网fBa8Fo)FO

  这些故障分析和调校技巧将会帮助您解决LDAP连结问题。如果这些提示都不能解决问题,为了进一步诊断故障,请联系BEA客户支持。您可以登入到http://support.bea.com/login.jsp,利用有效的支持合同建立一个事例。51Testing软件测试网qZ t8\*i;wN(j

TAG: Weblogic

 

评分:0

我来说两句

Open Toolbar