首页 > 解决方案 > 如何在activemq中限制端口61614上的HTTP OPTIONS方法?

问题描述

我们在我们的应用程序中使用了 activemq 5.14,最近的内部漏洞评估显示在端口 61614 上启用了 http-options-method-enabled。

下面是来自 activemq.xml 的条目。

<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
curl "http://XX.xX.xxx.xxx:61614/" -X OPTIONS -v
* About to connect() to XX.xX.xxx.xxx port 61614 (#0)
*   Trying XX.xX.xxx.xxx... connected
* Connected to XX.xX.xxx.xxx (XX.xX.xxx.xxx) port 61614 (#0)
> OPTIONS / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: XX.xX.xxx.xxx:61614
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 11 Apr 2019 02:02:48 GMT
< Allow: GET, HEAD, TRACE, OPTIONS
< Content-Length: 0
< Server: Jetty(9.2.13.v20150730)
<
* Connection #0 to host XX.xX.xxx.xxx left intact
* Closing connection #0

我对此进行了研究,发现活动 mq 使用 emdedded jetty 并尝试在 jetty.xml 中添加安全约束,如下所示。

<bean id="httpMethodSecurityConstraint" class="org.eclipse.jetty.util.security.Constraint">
        <property name="name" value="Restricted" />
         <!--<property name="roles" value="admin" /> -->
         <!-- set authenticate=false to disable login -->
        <property name="authenticate" value="true" />
    </bean>


    <bean id="httpMethodSecurityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping">
        <property name="constraint" ref="httpMethodSecurityConstraint" />
    <property name="method" value="OPTIONS" />
        <property name="pathSpec" value="/*" />
    </bean>

 <bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
        <property name="loginService" ref="securityLoginService" />
        <property name="authenticator">
            <bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator" />
        </property>
        <property name="constraintMappings">
            <list>

        <ref bean="httpMethodSecurityConstraintMapping" />
            </list>
        </property>
        <property name="handler" ref="secHandlerCollection" />
    </bean>

但是,下面的结果仍然返回 http 状态 200。

curl " http://XX.xX.xxx.xxx:61614/ " -X 选项 -v

对这个问题的任何帮助都会有很大帮助。

谢谢你。

标签: securityjettyactivemqembedded-jettyhttp-method

解决方案


推荐阅读