【问题标题】:Setup Tomcat to use LDAP user from a specific group设置 Tomcat 以使用来自特定组的 LDAP 用户
【发布时间】:2023-03-27 20:36:01
【问题描述】:

我正在设置一个 Tomcat 8.5 服务器以对 Tomcat 的管理器部分使用 LDAP 身份验证。到目前为止,我已经使用正确的领域设置更改了 server.xml。

<Realm className="org.apache.catalina.realm.JNDIRealm" 
                 debug="99"
                 connectionURL="ldap://ldap.server.com:389"
                 authentication="simple"
                 referrals="follow"
                 connectionName="CN=user,OU=Service,OU=Users,DC=server,DC=group,DC=mainserver,DC=com"
                 connectionPassword="password of the user"
                 userSearch="(sAMAccountName={0})"
                 userBase="DC=group,DC=mainserver,DC=com" 
                 userSubtree="true"
                 roleSearch="(member={0})" 
                 roleName="name of the ldap role" 
                 roleSubtree="true"
                 roleBase="OU=Groups,DC=group,DC=mainserver,DC=com"/>

现在我想使用 LDAP 组来授予用户访问 tomcat 管理器/状态页面的权限。我怎样才能做到这一点?我试图将管理器的 web.xml 更改为

 <security-role>
    <description>
      The role that is required to access the HTML Manager pages
    </description>
    <role-name>LDAP group</role-name>
  </security-role>
  <security-role>
    <description>
      The role that is required to access the text Manager pages
    </description>
    <role-name>LDAP group</role-name>
  </security-role>
  <security-role>
    <description>
      The role that is required to access the HTML JMX Proxy
    </description>
    <role-name>LDAP group</role-name>
  </security-role>
  <security-role>
    <description>
      The role that is required to access to the Manager Status pages
    </description>
    <role-name>LDAP group</role-name>
  </security-role>

但是没有用。现在可以使用用户登录,但是当我浏览管理器页面时出现“403 Access Denied”错误。同样在Tomcat的日志文件中也没有任何错误。

【问题讨论】:

    标签: tomcat authentication ldap


    【解决方案1】:

    在 LDAP 中将 roleName 更改为正确的角色名称值,并且在重新启动 tomcat 服务后它工作正常。

    【讨论】:

      【解决方案2】:

      不是 Tomcat 8,但思路还是一样的。

      这可能会有所帮助: https://ldapwiki.com/wiki/Tomcat%20And%20LDAP

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-07-14
        • 2018-04-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-16
        相关资源
        最近更新 更多