DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Protecting Critical Infrastructure From Ransomware
  • USA PATRIOT Act vs SecNumCloud: Which Model for the Future?
  • Strengthening Cloud Security: Privacy-Preserving Techniques for Compliance With Regulations and the NIST Framework
  • Compliance Automated Standard Solution (COMPASS), Part 7: Compliance-to-Policy for IT Operation Policies Using Auditree

Trending

  • Reducing Hallucinations Using Prompt Engineering and RAG
  • Advancing DSLs in the Age of GenAI
  • MCP and The Spin-Off CoT Pattern: How AI Agents Really Use Tools
  • The Battle of the Frameworks: Choosing the Right Tech Stack
  1. DZone
  2. Coding
  3. Frameworks
  4. Elytron: A New Security Framework in WildFly/JBoss EAP

Elytron: A New Security Framework in WildFly/JBoss EAP

In this tutorial, we will create a self-signed certificate to understand how SSL/TLS works in Elytron. Read on to learn how to secure your JBoss EAP!

By 
Siddhartha De user avatar
Siddhartha De
·
May. 04, 18 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
7.6K Views

Join the DZone community and get the full member experience.

Join For Free

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.

This is the basic architecture of SSL/TLS in Elytron:

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

  • Key-Manager: key-manager keeps the reference to key-store to be used and loads the keys.
  • Trust-Manager: This also keeps the reference to key-store and basically used for trustCertificates. If all the certificates are present in the keystore referenced by the key-manager, configuring the 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 protocols 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 you to manage the keystore/certificate graphically and does not require you 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 attributes as per your organization's requirements 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, you 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 the keystore here while creating the 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 perform batch execution because both of the commands have to execute simultaneously, otherwise 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 use in production.

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

  • Elytron prints a warning message in the log upon the 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.
security Enterprise architecture planning Framework

Published at DZone with permission of Siddhartha De, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Protecting Critical Infrastructure From Ransomware
  • USA PATRIOT Act vs SecNumCloud: Which Model for the Future?
  • Strengthening Cloud Security: Privacy-Preserving Techniques for Compliance With Regulations and the NIST Framework
  • Compliance Automated Standard Solution (COMPASS), Part 7: Compliance-to-Policy for IT Operation Policies Using Auditree

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: