2016-10-19 2 views
0

activemq 대기열을 설정하고 연결하는 데 사용되는 암호를 암호화하려고합니다. HERE 단계를 수행 중이며 새 activemq-security.xml 파일로 activemq를 시작할 수 있습니다. 큐를 만들고 연결하려고하는 스크립트가 있지만 사용자 이름이나 암호가 유효하지 않은 오류가 계속 발생합니다. 암호화 된 암호가 activemq에서 작동하지 않습니다.

나는 소비자 사용자의 암호를 암호화와 같은 credentials-enc.properties 파일에 암호화 된 암호를 저장 :

consumer.password=ENC(awknernfjewnwk) 

나는 다른 일을 시도하고 나는 credentials-enc.properties이 아니라고 확신 어떤 이유로 집어지고, 여기에 그 정의하는 방법입니다 enter image description here

: 아래
 <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 
      http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> 

     <bean id="environmentVariablesConfiguration" class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig"> 
      <property name="algorithm" value="PBEWithMD5AndDES" /> 
      <property name="passwordEnvName" value="ACTIVEMQ_ENCRYPTION_PASSWORD" /> 
     </bean> 

     <bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> 
      <property name="config" ref="environmentVariablesConfiguration" /> 
     </bean> 

     <bean id="propertyConfigurer" class="org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer"> 
      <constructor-arg ref="configurationEncryptor" /> 
      <property name="location" value="file:${activemq.base}/conf/credentials-enc.properties"/> 
     </bean> 

    <!-- Allows accessing the server log --> 
    <bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery" 
      lazy-init="false" scope="singleton" 
      init-method="start" destroy-method="stop"> 
    </bean> 

    <!-- 
     The <broker> element is used to configure the ActiveMQ broker. 
    --> 
    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" advisorySupport="false" dataDirectory="${activemq.data}"> 
     <plugins> 
      <simpleAuthenticationPlugin> 
        <users> 
         <authenticationUser username="admin" password="admin" 
          groups="admins"/> 
         <authenticationUser username="consumer" password="$(consumer.password)" 
          groups="readers"/> 
         <authenticationUser username="producer" password="$(producer.password)" 
          groups="writers"/> 
        </users> 
       </simpleAuthenticationPlugin> 
       <authorizationPlugin> 
       <map> 
       <authorizationMap> 
        <authorizationEntries> 
        <authorizationEntry queue=">" read="readers" write="admins" admin="admins" /> 
        <authorizationEntry queue="CLIMATE" read="readers" write="writers" admin="admins" /> 
        <authorizationEntry topic=">" read="admins,readers" write="admins,writers" admin="admins" /> 
        </authorizationEntries> 
        <tempDestinationAuthorizationEntry> 
        <tempDestinationAuthorizationEntry read="admins" write="admins" admin="admins"/> 
        </tempDestinationAuthorizationEntry> 
       </authorizationMap> 
       </map> 
      </authorizationPlugin> 
      </plugins> 
     <destinationPolicy> 
      <policyMap> 
       <policyEntries> 
       <policyEntry topic=">" > 
        <!-- The constantPendingMessageLimitStrategy is used to prevent 
         slow topic consumers to block producers and affect other consumers 
         by limiting the number of messages that are retained 
         For more information, see: 

         http://activemq.apache.org/slow-consumer-handling.html 

        --> 
        <pendingMessageLimitStrategy> 
        <constantPendingMessageLimitStrategy limit="1000"/> 
        </pendingMessageLimitStrategy> 
       </policyEntry> 
       </policyEntries> 
      </policyMap> 
     </destinationPolicy> 

내가지고있어 오류 로그의 이미지입니다 전송 커넥터

<transportConnectors> 
    <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> 
    <transportConnector name="openwire" uri="tcp://0.0.0.0:61617?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
</transportConnectors> 

이유가 무엇인지 어떤 아이디어에 대한

설정?

미리 감사드립니다.

답변

1

문제는 당신이 변수 $ (producer.password)를 사용하지만 잘못, 당신은 $ {producer.password} 필요, 사실 매우 간단합니다!

그게 전부입니다.

"consumer"사용자가 admins 그룹에 없으므로 "CLIMATE"대기열을 만들어야합니다.

+0

답장을 보내 주셔서 감사합니다. 네,'ACTIVEMQ_ENCRYPTION_PASSWORD = activemq'를 사용했습니다. 또한 설정 파일에서 'activemq'를 속성으로 제공하려고 시도했습니다. 필자가 제공 한 소비자 암호화는 암호화 한 후에 얻은 실제 결과가 아닌 샘플입니다. 암호화없이 사용하려고 시도했을 때 credentials-enc.properties를 지정하는 위치 속성이 선택되지 않았으며 다시 실패했습니다. 'SecurityException으로 실패하여 tcp : // XXXX 중지 : 사용자 이름 [사용자] 또는 암호가 유효하지 않습니다. | org.apache.activemq.broker.TransportConnection | ActiveMQ BrokerServic' – tkyass

+0

credentials-enc.properties의 이름을 변경하여 브로커 시작시 FileNotFoundException이 발생하는지 테스트 할 수 있습니다. –

+0

내 anwser를 업데이트했습니다. –

관련 문제