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

Elytron: A New Security Framework in WildFly/JBoss EAP

April 20, 2018
Siddhartha De
Related topics:
Security
Related products:
Red Hat JBoss Enterprise Application Platform

Share:

    Elytron is a new security framework that ships with WildFly version 10 and Red Hat JBoss Enterprise Application Platform (EAP) 7.1. This project is a complete replacement of PicketBox and JAAS. Elytron is a single security framework that will be usable for securing management access to the server and for securing applications deployed in WildFly. You can still use the legacy security framework, which is PicketBox, but it is a deprecated module; hence, there is no guarantee that PicketBox will be included in future releases of WildFly. In this article, we will explore the components of Elytron and how to configure them in Wildfly.

    The Elytron project covers the following: 

    • SSL/TLS
    • Secure credential storage
    • Authentication
    • Authorization

    In this article, we are going to explore using SSL/TLS in WildFly with Elytron.

    The key attribute here is SSLContext, which also has the reference the following component:

    • Key-Manager:  key-manager keeps the reference of key-store to be used and load the keys.
    • Trust-Manager: This also keeps the reference of key-store, basically used for trustCertificates. If all the certificates are present in the keystore referenced by key-manager, configuring trust-manager is not required. However, for outbound connections, a trust-manager can be used.
    • Security-Domain: This is an optional parameter,  However, if SSLContext is configured with a reference to a security-domain, then the verification of a client's certificate can be performed as an authentication, thus ensuring the appropriate permissions for a login are assigned before even allowing the connection to be fully opened.

    SSLContext also defines the type of SSL communication (one-way/two-way) along with allowed protocol and cipher-suite details.

    Configure the SSLContext to Be Used by the Management Interface and the Undertow Subsystem 

    Before, we start configuring SSL/TLS in Elytron, we should have a certificate. In this tutorial, we will create a self-signed certificate to understand how SSL/TLS works in Elytron.

    To manage the certificate/keystore, I have used here keytool CLI-based utility that ships with Java. However, one can manage the certificate/keystore using another utility, such as  Portecle, which allows to manage the keystore/certificate graphically and does not require to remember long command lines.

    First, use keytool to generate the keystore and a self-signed certificate, executing a command similar to the following in the OS terminal command line:

    keytool -genkeypair -alias wildfly -keyalg RSA -sigalg SHA256withRSA -validity 365 -keysize 2048 -keypass jboss@123 -storepass jboss@123 -dname "CN=developer.jboss.org, C=IN" -ext san=dns:developers.redhat.org,dns:developers.wildfly.org -keystore wildfly.jks

    Note: This is just an example, you need to change the common name (CN) and other attribute as per your organization requirement and set the password accordingly.

    Once we are ready with the certificate/keystore, need to perform the following steps to configure the Elytron subsystem for enabling SSL/TLS. Here, I am demonstrating the configuration using the JBoss CLI.

    • First, we need to connect to the JBoss CLI by executing the jboss-cli command available in the directory $WildFly_Home/bin.
    • Next, configure a key-store component in the Elytron subsystem with the newly created keystore (here wildfly.jks is placed at $WildFly_Home/ssl).
    /subsystem=elytron/key-store=wildflyKS:add(type=JKS,path="${jboss.home.dir}/ssl/wildfly.jks",credential-reference={clear-text=jboss@123})
    • Then, create a new key-manager component in the Elytron subsystem referencing the key-store component created above. To do this, need to execute the command like below:

    /subsystem=elytron/key-manager=wildflyKM:add(algorithm=SunX509,key-store=wildflyKS,credential-reference={clear-text=jboss@123})

    Note: We are required to give the password (e.g. jboss@123) of keystore here while creating key-manager.

    • Finally, configure a new server-ssl-context referencing the key-manager component created in the previous step:
    /subsystem=elytron/server-ssl-context=wildlfySSC:add(key-manager=wildflyKM,protocols=[TLSv1.2])

    To enable SSL/TLS through Elytron, we are required to execute the following two commands to configure the Undertow https-listener and map the ssl-context with Elytron. By default, the https-listener is configured with the ApplicationRealm security realm, and by default, ApplicationRealm generates a self-signed certificate during the first startup of WildFly. You need to do batch execution, because both of the commands have to execute simultaneously, else you can remove the https-listener and add the https-listener again with ssl-context .

    batch
    /subsystem=undertow/server=default-server/https-listener=https:undefine-attribute(name=security-realm)
    /subsystem=undertow/server=default-server/https-listener=https:write-attribute(name=ssl-context,value=wildlfySSC)
    run-batch

    Now for the management interface to use the same ssl-context, we need to execute the following commands in the JBoss CLI, which will also enable SSL for the management interface:

    • Before, configuring ssl-context for the management-interface, we need to configure secure-port for the management-http interface for communicating over SSL/TLS
    /core-service=management/management-interface=http-interface:write-attribute(name=secure-socket-binding,value=management-https)
    • Map the same ssl-context with management-http interface for enabling SSL/TLS
    /core-service=management/management-interface=http-interface:write-attribute(name=ssl-context,value=wildflySSC)

    Now, to test your configuration and the SSL/TLS handshake, make a request over the HTTPS protocol using your browser. To do this, you can also use the openssl command-line utility, for example:

    openssl s_client -connect developers.redhat.com:8443

    You can also use the  SSL testing tool to check the certificate and the allowed protocol and ciphers. Once you have completed the setup, you can make your system live for the production usage.

    There are couple of features in Elytron that were not there in earlier JBoss versions:

    • Elytron prints a warning message in the log upon expiration of the certificate used in the Elytron subsystem.
    • It is possible to load the certificate keystore without restarting/reloading the instance, although there are still some challenges.
    • Elytron also provides the facility to check the certificate details.
    Last updated: June 22, 2023

    Recent Posts

    • Container starting and termination order in a pod

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    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

    Red Hat legal and privacy links

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

    Report a website issue