-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support JMX SSL configuration via exporter YAML configuration #834
Comments
Please provide your full exporter YAML file content. |
Looking more closely at the information you provided above, this is working as expected. HTTPS support only requires a keystore. The keystore for HTTPS support can be configured in two ways:
... or ...
JMX SSL scraping support for the standalone Webserver currently requires JVM system properties:
This functionality/configuration was not changed 0.19.0 and is unrelated to the HTTPS support that was added. In most scenarios, the use of the Java agent version is recommended. If your desire is to add the ability for the standalone Webserver to use an alternate method of injecting the keystore/keystore password and truststore/truststore password (for example via environment variables), we should track that separately as a new issue (which I can target as an enhancement request.) |
|
Please provide the command line used to start your application. |
This is with the JVM arguments:
|
This is the exporter application information. Please provide the command line/configuration of the application being monitored. |
Hi, that is a proprietary application therefore I can't provide Intellectual Property info. But the startup would be something like this: nohup $JAVA_HOME/bin/java -Dpython.import.site=false -Dpython.cachedir=$MYDIR/logs/jython -Dprocess.id=$PROCESS_ID -DJMX_IMPL=$JMXIMPL -Xmx256m -Duser.region=US -Dhttps.protocols=TLSv1.2 -Duser.language=en -Dlog4j.configurationFile=$MYDIR/config/EventConfig.xml -Denable.managementservice=false -Dconfig.filename=$MYDIR/config/config.properties com.test.app.mgmt.myJmxServer file://$MYDIR/config/myjmx.mlet > $MYDIR/logs/$PROCESS_ID.stdout 2>> $MYDIR/logs/$PROCESS_ID.stderr & |
Understood. If you disable the HTTP server support (remove the configuration completely), does it work? Have you tested with |
With jmx_exporter/collector/src/main/java/io/prometheus/jmx/JmxCollector.java Lines 184 to 186 in a765bdf
This scenario has been tested successfully as part of the integration test suite. Test: Configuration: Without a shareable working example reproducing the issue that I can debug, no more investigation is possible. |
Hello Doug, With the SSL JVM arguments it works. I'm able to scrape the metrics from the JMX application. And the Http server port is listening with SSL/TLS (HTTPS). The only issue I have is that passing the passwords as JVM arguments isn't safe and I would like to able to do this via the yaml config. Looking at the new feature introduced in 0.19.0, it is now possible to provide a key store and a password via the config, which is great but this doesn't work for me. Probably because the trust store that should contain the CA/root certificates is missing? |
I'll try to run the exporter with SSL debug enabled, and chekc the handshake |
Shouldn't the config accept both a key store (which contains the key) and a trust store (which contains the CA certs)? Looking at the new code, it seems that the same jks file is used as both keystore and truststore but it also removes, from the loaded keystore, all the certificates with aliases that don't match the input alias. jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ssl/SSLContextFactory.java |
Ok, Just run a test without the JVM SSL args and with debug enabled and I see the following, which means that the keyStore I pass in the YAML config isn't picked up, while the trustStore is defaulting to the Java default one (cacerts):
While when passing the JVM args:
|
Based on your comments and tests, this is working as expected. The configuration section ...
... is only used for HTTPS support to expose metrics to Prometheus - it does not control the JMX SSL scraping configuration. Your security concern is valid, but is unrelated to HTTPS support that was added in I'll change the issue description and mark it as an enhancement request. |
Hello Doug, The only problem I have is that it seems that the keystore passed via the new Param isn't used. And there is no support for Trust Store. |
@VinceGall I could be totally wrong.
Should only happen if JMX is trying to use SSL to scrape metrics. Attached is a test package zip derived from the integration test (HTTPS support enabled and JMX SSL disabled) that you can run on your machine. Instructions:
|
Thanks for the support so far. I think you are right. It seems my HttpServer exporter tries to establish an SSL connection with the JMX Application via RMI. |
@VinceGall any update on your testing? |
i am trying to use 0.19.0 trying to setup SSL connection between prometheus server and JMX server , i tried to setup the configuration currently , but it seems that the below configuration doesnt setup SSL between prometheus server and JMX Server , please correct me in this case httpServer: |
@Janardhan78 please open a new issue since it seems unrelated. |
In Version 0.19.0, HTTPS support has been introduced. However, it is only possible to configure a keystore and not a truststore.
Without a truststore I get this error:
I'm able to workaround the problem by configuring the HttpServer with:
And providing the system properties like this:
-Djavax.net.ssl.keyStore= -Djavax.net.ssl.keyStorePassword= -Djavax.net.ssl.trustStore= -Djavax.net.ssl.trustStorePassword=
However this is not ideal because the passwords can be scraped via a simple "ps -ef" command
The text was updated successfully, but these errors were encountered: