使用ActiveMQ设置LDAP集成时遇到麻烦(在centos7上)管理页面

时间:2019-03-15 23:06:03

标签: ldap jetty activemq

我已经阅读了所有可以找到的相关页面,但我没有得到任何帮助。我只是一个简单的农夫(系统管理员),而且我用光了头发才能拔出。

我做了什么:在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>

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

1 个答案:

答案 0 :(得分: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