Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Cryostat 2.2's new JMX credentials keyring

December 7, 2022
Andrew Azores
Related topics:
JavaSecurity
Related products:
Red Hat build of Cryostat

Share:

    An important security enhancement for Java applications is now available through Java Management Extensions (JMX), using open source JDK Flight Recorder (JFR) management with Cryostat. (Cryostat is a container-native JVM application that provides a secure API for profiling and monitoring containers with JFR.) This article explains how the new JMX credentials keyring offers an alternative credential management system.

    How the JMX credentials keyring works

    If applications are configured to require JMX authentication for incoming connections, Cryostat must know what those credentials are for any application it needs to connect to. Cryostat connects to the target application in order to start, list, or stop flight recordings, copy JFR data to a local file, get information about JFR event types and templates, etc.

    Before Cryostat 2.2, connections to an application through JMX would include an X-JMX-Authorization header. This header's value would be the JMX credentials required by the target application, so that Cryostat could pass the authentication challenge and connect to the target. The credentials passed in this way weren't stored by Cryostat persistently; they were held in memory just long enough to establish the JMX connection. If you set up your Cryostat installation to use HTTPS and configured your target application to use JMX over SSL/TLS, these credentials were always encrypted while being transmitted.

    Cryostat 2.2 adds a keyring to store JMX credentials for your applications. Credentials stored in this way are encrypted at rest using a user-provided passphrase supplied to Cryostat via the CRYOSTAT_JMX_CREDENTIALS_DB_PASSWORD environment variable.

    When attempting to open a JMX connection to a target, Cryostat first checks for the X-JMX-Authorization header. If there is none, Cryostat checks the keyring database for credentials matching the target, decrypts them using the passphrase, and establishes the JMX connection. Again, if your Cryostat installation is set up with HTTPS and your target uses JMX over SSL/TLS, these JMX credentials are always encrypted in flight, and now they're encrypted at rest within the keyring.

    Advantages of the keyring for microservices

    You might be wondering what I meant by "credentials matching this target" in the previous paragraph. Older versions of Cryostat required the user to define credentials on a per-target basis. Each JMX credential username/password pair was tied to one specific target connection URL. This works fine if your applications are deployed as long-lived "pets" with stable IP addresses, but is not very useful if your applications are deployed as microservice "cattle," where the URL to one specific replica or instance is not particularly meaningful.

    For this reason, credentials stored in Cryostat 2.2's JMX keyring are no longer tied to specific target connection URLs. Instead, they reuse the same match expression concept that was previously introduced for Cryostat automated rules. To recap, match expressions are small snippets of Java-like code, where a representation of a target application is passed and available as a target object reference. The expression evaluates various properties of the target object to determine whether the automated rule or the JMX credentials should apply to that target.

    The most reliable way to make sure JMX credentials work using this system is to copy and paste the match expressions from your automated rules definitions and apply them to the JMX credentials, so that the rules and credentials apply to the same set of target applications.

    Additional considerations for using JMX credentials with Cryostat

    Because the connection asking for the JMX credentials challenges the target applications to which it connects, and not Cryostat itself, Cryostat is required to store the whole credential and not just a salted hash of it. Storage operates much like the login keyring you might be familiar with on your personal computer, or a password manager you use for storing your logins for online accounts.

    An additional enhancement in Cryostat 2.2 lets you define your JMX credentials after creating an automated rule. Previously, if an automated rule failed to activate for a target application—due to JMX authentication failure, for example—the rule's actions wouldn't trigger for that target application at all. To make the connection work, after you added the credentials, you had to either delete and recreate the rule or restart the application. Now, if you add JMX credentials to the keyring after the fact, your automated rules will re-trigger and attempt to perform their actions against the relevant target applications.

    Last updated: February 11, 2024

    Related Posts

    • How to build automated JFR rules with Cryostat 2.1's new UI

    Recent Posts

    • AI meets containers: My first step into Podman AI Lab

    • Live migrating VMs with OpenShift Virtualization

    • Storage considerations for OpenShift Virtualization

    • Upgrade from OpenShift Service Mesh 2.6 to 3.0 with Kiali

    • EE Builder with Ansible Automation Platform on OpenShift

    What’s up next?

    book cover

    The microservice architectural approach is more than just about technology: It reaches into the foundation of your organization to allow you to build truly scalable, adaptive, complex systems that help a business adapt to rapidly changing competitive markets. In Microservices for Java Developers, you'll get a hands-on introduction to frameworks and containers through a handful of familiar patterns.

    Get the free e-book
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue