From da124d085dcc1739762bb7e8702a9cb62c676a9c Mon Sep 17 00:00:00 2001 From: Vikentiy Fesunov Date: Wed, 8 Jan 2025 11:19:23 +0000 Subject: [PATCH] Expose ssl configuration Since jmx and the registry use the same port, they must have matching ssl configuration to avoid 'port already in use' errors. --- components/datadog/apps/jmxfetch/images/jmx-test-app/run.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/datadog/apps/jmxfetch/images/jmx-test-app/run.sh b/components/datadog/apps/jmxfetch/images/jmx-test-app/run.sh index 74f099a93..4ca8efca9 100755 --- a/components/datadog/apps/jmxfetch/images/jmx-test-app/run.sh +++ b/components/datadog/apps/jmxfetch/images/jmx-test-app/run.sh @@ -4,6 +4,7 @@ set -f [ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx128M -Xms128M" [ -n "$RMI_PORT" ] || RMI_PORT="9010" [ -n "$HOST_NAME" ] || HOST_NAME=`awk 'END{print $1}' /etc/hosts` +[ -n "$SSL_MODE"] || SSL_MODE="false" echo "Using `java --version`" echo "With JAVA_OPTS '${JAVA_OPTS}'" @@ -13,6 +14,7 @@ javac -d app SimpleApp.java echo "Starting app with hostname set to ${HOST_NAME}" echo "RMI port is set to ${RMI_PORT}" +echo "SSL: ${SSL_MODE}" java -cp ./app \ ${JAVA_OPTS} \ @@ -20,7 +22,8 @@ java -cp ./app \ -Dcom.sun.management.jmxremote.port=${RMI_PORT} \ -Dcom.sun.management.jmxremote.rmi.port=${RMI_PORT} \ -Dcom.sun.management.jmxremote.authenticate=false \ - -Dcom.sun.management.jmxremote.ssl=false \ + -Dcom.sun.management.jmxremote.ssl=${SSL_MODE} \ + -Dcom.sun.management.jmxremote.registry.ssl=${SSL_MODE} \ -Djava.rmi.server.hostname=${HOST_NAME} \ SimpleApp