From 811d941001135551326c7bf7516213e0bb95e364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Tue, 19 May 2026 17:21:14 +0200 Subject: [PATCH 1/2] Harden web console and Jolokia access by default jetty.xml: - Add Referrer-Policy and Permissions-Policy response headers; provide commented-out Strict-Transport-Security for HTTPS deployments. - Wrap the existing HandlerCollection in an InetAccessHandler and restrict access to loopback (127.0.0.1, ::1) by default. Provide commented-out templates for RFC1918 includes and exclude rules. - Tie Server.start() to the loopback include beans via depends-on so the allow-list is fully populated before the server starts. - Add a commented-out ForwardedRequestCustomizer for reverse-proxy setups, with a warning about header spoofing when the proxy does not strip inbound X-Forwarded-* headers. jolokia-access.xml: - Restrict Jolokia to HTTP POST to kill GET-based CSRF/SSRF vectors. - Deny destructive and privileged broker operations (terminateJVM, stop, restart, add/removeConnector, add/removeQueue/Topic, durable subscriber lifecycle, runtime limit setters, reloadLog4jProperties). - Deny destination message-data mutation (purge, remove/copy/move messages, sendTextMessage*, pause/resume); browse* remains allowed. - Deny durable subscriber destroy/setSelector and JobScheduler removeJob*. - Deny NetworkConnector Password/RemotePassword attributes and credential setters. - Deny known JMX RCE / introspection surfaces: javax.management.loading MLet, JMImplementation, java.util.logging, java.lang:type=Memory and ClassLoading, plus java.lang:type=Runtime SystemProperties and InputArguments. --- assembly/src/release/conf/jetty.xml | 130 +++++++++++++++-- assembly/src/release/conf/jolokia-access.xml | 141 ++++++++++++++++++- 2 files changed, 259 insertions(+), 12 deletions(-) diff --git a/assembly/src/release/conf/jetty.xml b/assembly/src/release/conf/jetty.xml index 18915cb23e2..9d714e40e2a 100644 --- a/assembly/src/release/conf/jetty.xml +++ b/assembly/src/release/conf/jetty.xml @@ -24,6 +24,31 @@ + + @@ -106,6 +131,14 @@ + + @@ -162,19 +195,94 @@ + + + + + + + + + + + + + + + + + + + + 127.0.0.1 + + + + + + + ::1 + + + + + + - - - - - - - - - - + @@ -225,7 +333,7 @@ + depends-on="broker, configureJetty, invokeConnectors, inetAccessIncludeLoopbackV6"> diff --git a/assembly/src/release/conf/jolokia-access.xml b/assembly/src/release/conf/jolokia-access.xml index 97b099a5b7f..6844c314608 100644 --- a/assembly/src/release/conf/jolokia-access.xml +++ b/assembly/src/release/conf/jolokia-access.xml @@ -17,7 +17,14 @@ --> - + + + post + + + @@ -46,11 +53,143 @@ + + + org.apache.activemq:type=Broker,brokerName=* + + terminateJVM + stop + stopGracefully + restart + gc + + addConnector + removeConnector + addNetworkConnector + removeNetworkConnector + addQueue + removeQueue + addTopic + removeTopic + createDurableSubscriber + destroyDurableSubscriber + + reloadLog4jProperties + setMemoryLimit + setStoreLimit + setTempLimit + setJobSchedulerStoreLimit + setMaxUncommittedCount + + + + + org.apache.activemq:type=Broker,brokerName=*,destinationType=*,destinationName=* + purge + removeMessage + removeMatchingMessages + copyMessageTo + copyMatchingMessagesTo + moveMessageTo + moveMatchingMessagesTo + retryMessage + retryMessages + removeMessageGroup + removeAllMessageGroups + sendTextMessage + sendTextMessageWithProperties + pause + resume + + + + + org.apache.activemq:type=Broker,brokerName=*,destinationType=*,destinationName=*,endpoint=Consumer,clientId=*,consumerId=* + destroy + removeMessage + setSelector + + + + + org.apache.activemq:type=Broker,brokerName=*,service=JobScheduler,name=* + removeJob + removeAllJobs + removeAllJobsAtScheduledTime + + + + + org.apache.activemq:type=Broker,brokerName=*,service=Log4JConfiguration + setRootLogLevel + setLogLevel + reloadLog4jProperties + + + + + org.apache.activemq:type=Broker,brokerName=*,connector=networkConnectors,networkConnectorName=* + Password + RemotePassword + setUserName + setPassword + setRemoteUserName + setRemotePassword + setBridgeTempDestinations + setConduitSubscriptions + setDispatchAsync + setDynamicOnly + setMessageTTL + setConsumerTTL + setPrefetchSize + setAdvisoryPrefetchSize + setDecreaseNetworkConsumerPriority + setSuppressDuplicateQueueSubscriptions + setSuppressDuplicateTopicSubscriptions + + + + + javax.management.loading:type=MLet + * + * + + + JMImplementation:* + * + * + org.apache.logging.log4j2:* * * + + java.util.logging:* + * + * + + + + java.lang:type=Memory + * + * + + + java.lang:type=ClassLoading + * + * + + + + java.lang:type=Runtime + SystemProperties + InputArguments + * + com.sun.management:type=DiagnosticCommand * From 195f891f98e159d67e287fc898b27ef42204b9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Wed, 20 May 2026 13:23:10 +0200 Subject: [PATCH 2/2] jetty.xml: restrict Jolokia endpoint to admins role Add a jolokiaSecurityConstraintMapping that binds adminSecurityConstraint (admins-only) to /api/jolokia/*, mirroring how *.action is gated on the web console. Wired into securityHandler before securityConstraintMapping so the admin role check applies to all Jolokia requests rather than the broader users/admins constraint. --- assembly/src/release/conf/jetty.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/assembly/src/release/conf/jetty.xml b/assembly/src/release/conf/jetty.xml index 9d714e40e2a..fd3fb72f527 100644 --- a/assembly/src/release/conf/jetty.xml +++ b/assembly/src/release/conf/jetty.xml @@ -76,6 +76,10 @@ + + + + @@ -180,6 +184,7 @@ +