设置与ActiveMQ的LDAP集成(在centos7上)管理页面时遇到问题

问题描述 投票:0回答:1

我已经阅读了我能找到的每一页,我只是没有得到一些东西。我只是一个简单的农民(系统管理员),我正在跑出头发。

我做了什么:在Centos7盒子上,我通过下载最新的tarball并扩展它来安装apache-activemq-5.15.8。我设置了一个服务文件和一些其他细节,服务将运行,我可以使用默认的信用卡登录管理页面。作为受虐狂,我通过为管理页面配置LDAP集成来为这个应用程序的用户“轻松”做好准备......那就是战斗开始的时候。

我在Apache页面上发现了一些相互矛盾的信息。即:http://activemq.apache.org/security.htmlhttp://activemq.apache.org/cached-ldap-authorization-module.html

但我发现一些看起来更有帮助的页面,例如:https://bacedifo.blogspot.com/2013/06/securing-activemq-580-web-console-using.htmlActiveMQ Web console using LDAP Active Directory authentication

我得到的错误与这个问题基本相同:Configuring Activemq web console to use LDAP for authorization and authentication,但答案并不足以让我继续...我可能需要一个和两个音节词。

管理页面显示此错误:enter image description here

activemq.log文件显示以下错误:

java.lang.AbstractMethodError: org.eclipse.jetty.jaas.JAASLoginService.login(Ljava/lang/String;Ljava/lang/Object;)Lorg/eclipse/jetty/server/UserIdentity;
        at org.eclipse.jetty.security.authentication.LoginAuthenticator.login(LoginAuthenticator.java:61)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.security.authentication.BasicAuthenticator.validateRequest(BasicAuthenticator.java:92)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:512)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.server.Server.handle(Server.java:499)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[jetty-all-9.2.25.v20180606.jar:9.2.25.v20180606]
        at java.lang.Thread.run(Thread.java:748)[:1.8.0_201]

我的conf更改是:下载jetty-jaas-9.4.15.v20190215.jar和ldaptive-1.2.4.jar并将它们复制到$ ACTIVEMQ_HOME / lib

更改了$ ACTIVEMQ_HOME / conf / login.config:

activemq-local {
    org.apache.activemq.jaas.PropertiesLoginModule required
        debug=true
        org.apache.activemq.jaas.properties.user="org/apache/activemq/security/users.properties"
        org.apache.activemq.jaas.properties.group="org/apache/activemq/security/groups.properties";
};

contosoRealm {
    org.ldaptive.jaas.LdapLoginModule required
        debug=true
        storePass="true"
        ldapUrl="ldap://dc01.contoso.com:389"
        bindDn="cn=SVC ActiveMQ,ou=Service Accounts,dc=contoso,dc=com"
        baseDn="OU=User Accounts,DC=contoso,DC=com"
        bindCredential="contos0_win5"
        useStartTLS="false"
        userFilter="(sAMAccountName={user})";
   org.ldaptive.jaas.LdapRoleAuthorizationModule required
        useFirstPass="true"
        ldapUrl="ldap://dc01.contoso.com:389"
        bindDn="cn=SVC ActiveMQ,ou=Service Accounts,dc=contoso,dc=com"
        baseDn="OU=Security Groups,OU=Groups,DC=contoso,DC=com"
        bindCredential="contos0_win5"
        roleFilter="(&(cn=activemq_admins)(member={user}))"
        useStartTLS="false"
        defaultRole="admins"
        roleAttribute="cn";
};

我配置了$ ACTIVEMQ_HOME / conf / jetty.xml

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">


    <bean id="securityLDAPLoginService" class="org.eclipse.jetty.jaas.JAASLoginService">
        <property name="name" value="contosoRealm" />
        <property name="LoginModuleName" value="contosoRealm" />
        <property name="roleClassNames" value="org.eclipse.jetty.jaas.JAASRole" />
        <property name="identityService" ref="identityService" />
    </bean>

    <bean id="identityService" class="org.eclipse.jetty.security.DefaultIdentityService"/>

    <bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
        <property name="name" value="BASIC" />
        <property name="roles" value="admins,ActiveMQ Admins" />
        <!-- set authenticate=false to disable login -->
        <property name="authenticate" value="true" />
    </bean>

    <bean id="adminSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint">
        <property name="name" value="BASIC" />
        <property name="roles" value="admin,ActiveMQ Admins" />
         <!-- set authenticate=false to disable login -->
        <property name="authenticate" value="true" />
    </bean>
....
....
    <bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
        <property name="loginService" ref="securityLDAPLoginService" />
        <property name="identityService" ref="identityService" />
        <property name="realmName" value="contosoRealm" />
        <property name="authenticator">
            <bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator" />
        </property>
        <property name="constraintMappings">
            <list>
                <ref bean="adminSecurityConstraintMapping" />
                <ref bean="securityConstraintMapping" />
            </list>
        </property>
        <property name="handler" ref="secHandlerCollection" />
    </bean>

如果你做到这一点,我非常感谢你!

ldap jetty activemq
1个回答
0
投票

好吧,我找到了!

所以我使用了一个在这里工作的java开发人员,他说很多人可能很明显:类路径中没有一些必要的类。在一些测试和挖掘中,我通过扩展此处的说明来纠正这个问题:ActiveMQ Web console using LDAP Active Directory authentication那里的答案是将2个文件复制到/ lib目录中,但不包括依赖项。我找到了一包所有依赖项,(检查了病毒总数)并将它们全部复制到/ lib。虽然这并没有解决所有问题,但这确实解决了这个错误。我找到的一罐罐子在这里: https://jar-download.com/artifacts/org.eclipse.jetty/jetty-jaas/9.2.25.v20180606/source-code

© www.soinside.com 2019 - 2024. All rights reserved.