Red Hat JBoss Enterprise Application Platform-7.1-How To Configure Server Security-en-US
Red Hat JBoss Enterprise Application Platform-7.1-How To Configure Server Security-en-US
Platform 7.1
For Use with Red Hat JBoss Enterprise Application Platform 7.1
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is
available at
http://creativecommons.org/licenses/by-sa/3.0/
. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must
provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity
logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other
countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and
other countries.
Node.js ® is an official trademark of Joyent. Red Hat Software Collections is not formally related to
or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks
or trademarks/service marks of the OpenStack Foundation, in the United States and other countries
and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or
sponsored by the OpenStack Foundation, or the OpenStack community.
Abstract
The purpose of this document is to provide a practical guide to securing Red Hat JBoss Enterprise
Application Platform. More specifically, this guide details how to secure all of the management
interfaces on JBoss EAP. Before reading this guide, users should read through the Security
Architecture document for Red Hat JBoss Enterprise Application Platform 7.1 and have a solid
understanding of how JBoss EAP handles security. This document also makes use of the JBoss
EAP CLI interface for performing configuration changes. When completing this document, readers
should have a solid, working understanding of how to secure JBoss EAP.
Table of Contents
Table of Contents
. . . . . . . . . .1.. .OVERVIEW
CHAPTER . . . . . . . . . .OF
. . .SECURITY
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7. . . . . . . . . .
.CHAPTER
. . . . . . . . .2.. .SECURING
. . . . . . . . . .THE
. . . .SERVER
. . . . . . . .AND
. . . . ITS
. . . .INTERFACES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8. . . . . . . . . .
2.1. BUILDING BLOCKS 8
2.1.1. Interfaces and Socket Bindings 8
2.1.2. Elytron Subsystem 8
2.1.2.1. Enable Elytron Security Across the Server 8
2.1.2.2. Create an Elytron Security Domain 9
Add a Security Domain Using the Management CLI 9
Add a Security Domain Using the Management Console 9
2.1.2.3. Create an Elytron Security Realm 9
Add a Security Realm Using the Management CLI 9
Add a Security Realm Using the Management Console 9
2.1.2.4. Create an Elytron Role Decoder 10
Add a Role Decoder Using the Management CLI 10
Add a Role Decoder Using the Management Console 10
2.1.2.5. Create an Elytron Role Mapper 10
Adding a Role Mapper Takes the General Form 10
Adding a Role Mapper Using the Management Console 10
2.1.2.6. Create an Elytron Permission Mapper 10
Add a Permission Mapper Using the Management CLI 10
Add a Permission Mapper Using the Management Console 10
2.1.2.7. Creating an Authentication Configuration 11
Add an Authentication Configuration Using the Management CLI 11
Add an Authentication Configuration Using the Management Console 11
2.1.2.8. Creating an Authentication Context 11
Add an Authentication Context Using the Management CLI 11
Add an Authentication Context Using the Management Console 12
2.1.2.9. Create an Elytron Authentication Factory 12
Add an Authentication Factory Using the Management CLI 12
Add an Authentication Factory Using the Management Console 12
2.1.2.10. Create an Elytron Keystore 12
Add a Keystore Using the Management CLI 12
Add a Keystore Using the Management Console 13
2.1.2.11. Create an Elytron Key Manager 13
Add a Key Manager Using the Management CLI 13
Add a Key Manager Using the Management Console 13
2.1.2.12. Create an Elytron Truststore 13
2.1.2.13. Create an Elytron Trust Manager 14
2.1.2.14. Using the Out of the Box Elytron Components 14
2.1.2.14.1. Securing Management Interfaces 14
2.1.2.14.2. Securing Applications 14
2.1.2.14.3. Using SSL/TLS 14
2.1.2.14.4. Using Elytron with Other Subsystems 15
2.1.2.15. Elytron Audit Logging 16
File Audit Logging 16
Periodic Rotating File Audit Logging 17
Size Rotating File Audit Logging 17
Syslog Audit Logging 18
2.1.2.16. Enable and Disable the Elytron Subsystem 18
2.1.3. Legacy Security Subsystem 19
1
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
2
Table of Contents
.CHAPTER
. . . . . . . . .3.. .SECURING
. . . . . . . . . .USERS
. . . . . . OF
. . . THE
. . . . .SERVER
. . . . . . . .AND
. . . .ITS
. . . MANAGEMENT
. . . . . . . . . . . . . .INTERFACES
. . . . . . . . . . . . . . . . . . . . . . . . . . .87
...........
3.1. USER AUTHENTICATION WITH ELYTRON 87
3.1.1. Default Configuration 87
3.1.1.1. Default Elytron HTTP Authentication Configuration 88
3.1.1.2. Default Elytron Management CLI Authentication 89
3.1.2. Secure the Management Interfaces with a New Identity Store 91
3.1.3. Adding Silent Authentication 93
3.1.4. Mapping Identity for Authenticated Management Users 94
3.1.5. Using Elytron Client with the Management CLI 96
3.2. IDENTITY PROPAGATION AND FORWARDING WITH ELYTRON 97
3.2.1. Propagating Security Identities for Remote Calls 97
Configure the Server for Security Propagation 97
Review the Example Application Code That Propagates a Security Identity 99
3.2.2. Utilizing Authorization Forwarding Mode 102
Configure the Authentication Client on the Forwarding Server 102
Configure the Authorization Forwarding on the Receiving Server 103
3.2.3. Retrieving Security Identity Credentials 104
3
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
. . . . . . . . . .4.. .SECURELY
CHAPTER . . . . . . . . . . STORING
. . . . . . . . .CREDENTIALS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127
............
4.1. CREDENTIAL STORE 127
4
Table of Contents
. . . . . . . . . .5.. .JAVA
CHAPTER . . . . .SECURITY
. . . . . . . . . .MANAGER
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155
............
5.1. ABOUT THE JAVA SECURITY MANAGER 155
5.2. DEFINE A JAVA SECURITY POLICY 155
5.2.1. Defining Policies in the Security Manager Subsystem 155
5.2.2. Defining Policies in the Deployment 156
5.2.3. Defining Policies in Modules 156
5.3. RUN JBOSS EAP WITH THE JAVA SECURITY MANAGER 157
5.4. CONSIDERATIONS MOVING FROM PREVIOUS VERSIONS 158
5.4.1. Defining Policies 158
5.4.2. JBoss EAP Configuration Changes 158
5.4.3. Custom Security Managers 158
. . . . . . . . . . A.
APPENDIX . . .REFERENCE
. . . . . . . . . . . MATERIAL
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .159
............
A.1. ELYTRON SUBSYSTEM COMPONENTS REFERENCE 159
A.2. SASL AUTHENTICATION MECHANISMS REFERENCE 193
A.2.1. Support Level for SASL Authentication Mechanisms 193
A.2.2. SASL Authentication Mechanism Properties 194
A.3. ELYTRON CLIENT SIDE ONE WAY EXAMPLE 197
A.4. ELYTRON CLIENT SIDE TWO WAY EXAMPLE 198
5
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
6
CHAPTER 1. OVERVIEW OF SECURITY
7
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
For more information on how to define and configure interfaces and socket-binding-groups, see
the Socket Bindings section of the JBoss EAP Configuration Guide.
Example: Interfaces
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
There is a simple way to enable Elytron across the server. JBoss EAP 7.1 introduces an example
configuration script that enables Elytron as the security provider. This script resides in the
EAP_HOME/docs/examples directory in the server installation.
Execute the following command to enable Elytron security across the server.
8
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
$ EAP_HOME/bin/jboss-cli.sh --file=EAP_HOME/docs/examples/enable-
elytron.cli
Security domains in the elytron subsystem, when used in conjunction with security realms, are used
for both core management authentication as well as for authentication with applications.
IMPORTANT
Deployments are limited to using one Elytron security domain per deployment. Scenarios
that may have required multiple legacy security domains can now be accomplished using
a single Elytron security domain.
/subsystem=elytron/security-domain=domainName:add(realms=
[{realm=realmName,role-decoder=roleDecoderName}],default-
realm=realmName,permission-mapper=permissionMapperName,role-
mapper=roleMapperName,...)
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
3. Click on View. Select Security Domain from the list on the SSL tab. All security domain related
configurations can be done here.
Security realms in the elytron subsystem, when used in conjunction with security domains, are used
for both core management authentication as well as for authentication with applications. Security realms
are also specifically typed based on their identity store, for example jdbc-realm, filesystem-
realm, properties-realm, etc.
/subsystem=elytron/type-of-realm=realmName:add(....)
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
9
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
3. Click on View. The Security Realm, Security Realm Mapper and Authentication tabs let you
configure all the security realm and authentication related attributes.
A role decoder converts attributes from the identity provided by the security realm into roles. Role
decoders are also specifically typed based on their functionality, for example empty-role-decoder,
simple-role-decoder, and custom-role-decoder.
/subsystem=elytron/ROLE-DECODER-TYPE=roleDeoderName:add(....)
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
3. Click on View. The Decoder tab lets you do all the role decoder related configurations.
A role mapper maps roles after they have been decoded to other roles. Examples include normalizing
role names or adding and removing specific roles from principals after they have been decoded. Role
mappers are also specifically typed based on their functionality, for example add-prefix-role-
mapper, add-suffix-role-mapper, and constant-role-mapper.
/subsystem=elytron/ROLE-MAPPER-TYPE=roleMapperName:add(...)
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
3. Click on View. The Role Mapper tab lets you do all the role mapper related configurations.
In addition to roles being assigned to a identity, permissions may also be assigned. A permission mapper
assigns permissions to an identity. Permission mappers are also specifically typed based on their
functionality, for example logical-permission-mapper, simple-permission-mapper, and
custom-permission-mapper.
/subsystem=elytron/simple-permission-mapper=PermissionMapperName:add(...)
10
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
3. Click on View. The Permission Mapper tab lets you do all the permission mapper related
configurations.
An authentication configuration contains the credentials to use when making a connection. For more
information on authentication configurations, see Configure Client Authentication with Elytron Client in
How to Configure Identity Management for JBoss EAP.
NOTE
Instead of a credential store, you can configure an Elytron security domain to use the
credentials of the accessing user. For instance, a security domain can be used in
conjunction with Kerberos for authenticating incoming users. Follow the instructions in
Configure the Elytron Subsystem in How to Set Up SSO with Kerberos for JBoss EAP,
and set obtain-kerberos-ticket=true in the Kerberos security factory.
/subsystem=elytron/authentication-
configuration=AUTHENTICATION_CONFIGURATION_NAME:add(authentication-
name=AUTHENTICATION_NAME, credential-reference={clear-text=PASSWORD})
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
3. Click on View. Select Authentication Configuration from the list on the Authentication tab. All
authentication configuration related configurations can be done here.
For the full list of authentication-configuration attributes, see Elytron Subsystem Components
Reference.
An authentication context contains a set of rules and either authentication configurations or SSL contexts
to use for establishing a connection. For more information on authentication contexts, see Configure
Client Authentication with Elytron Client in How to Configure Identity Management for JBoss EAP.
/subsystem=elytron/authentication-
context=AUTHENTICATION_CONTEXT_NAME:add()
11
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Typically, an authentication context will contain a set of rules and either an authentication configuration or
a SSL context. The following CLI command provides demonstrates defining an authentication context
that only functions when the hostname is localhost.
/subsystem=elytron/authentication-
context=AUTHENTICATION_CONTEXT_NAME:add(match-rules=[{authentication-
configuration=AUTHENTICATION_CONFIGURATION_NAME, match-host=localhost}])
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
3. Click on View. Select Authentication Context from the list on the Authentication tab. All
authentication context related configurations can be done here.
For the full list of authentication-context attributes, see Elytron Subsystem Components
Reference.
/subsystem=elytron/AUTH-FACTORY-TYPE=authFactoryName:add(....)
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
3. Click on View. All Elytron settings for factories can be configured here.
A key-store is the definition of a keystore or truststore including the type of keystore, its location, and
the credential for accessing it.
To generate an example keystore for use with the elytron subsystem, use the following command in
Red Hat Enterprise Linux 7.
12
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
To define a key-store in Elytron that references the newly made keystore, execute the following
management CLI command. This command species the path to the keystore, relative to the file system
path provided, the credential reference used for accessing the keystore, and the type of keystore.
/subsystem=elytron/key-store=newKeyStore:add(path=keystore.jks,relative-
to=jboss.server.config.dir,credential-reference={clear-
text=secret},type=JKS)
NOTE
The above command uses relative-to to reference the location of the keystore file.
Alternatively, you can specify the full path to the keystore in path and omit relative-
to.
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
3. Click on View. The Key Store tab lets you do all the keystore related configurations.
/subsystem=elytron/key-manager=newKeyManager:add(key-
store=KEY_STORE,algorithm="PKIX",credential-reference={clear-text=secret})
IMPORTANT
The available key manager algorithms are provided by the JDK in use. For example, a
JDK that uses SunJSSE provides the PKIX and SunX509 algorithms.
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
3. Click on View. The Key Manager tab lets you do all the key manager related configurations.
13
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/subsystem=elytron/key-store=default-trust-store:add(type=JKS, relative-
to=jboss.server.config.dir, path=application.truststore, credential-
reference={clear-text=password})
In order to successfully execute the command above you must have an application.truststore
file inside your EAP_HOME/standalone/configuration directory. The truststore must contain the
certificates associated with the endpoint or a certificate chain in case the end point’s certificate is signed
by a CA.
Red Hat recommends you to avoid using self-signed certificates. Ideally, certificates should be signed by
a CA and your truststore should contain a certificate chain representing your ROOT and intermediary CAs.
/subsystem=elytron/trust-manager=default-trust-manager:add(key-
store=TRUST-STORE-NAME)
This sets the defined truststore as the source of the certificates that the application server trusts.
JBoss EAP provides a default set of Elytron components configured in the elytron subsystem. You
can find more details on these pre-configured components in the Out of the Box section of the Security
Architecture guide.
You can find more details on the enabling JBoss EAP to use the out of the box Elytron components for
securing the management interfaces in the User Authentication with Elytron section.
JBoss EAP does provide a default one-way SSL/TLS configuration using the legacy core management
authentication, but it does not provide one in the elytron subsystem. You can find more details on
configuring SSL/TLS using the elytron subsystem for both the management interfaces as well as for
applications in the following sections:
14
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
Enable One-way SSL/TLS for the Management Interfaces Using the Elytron Subsystem
Enable Two-Way SSL/TLS for the Management Interfaces using the Elytron Subsystem
In addition to securing applications and management interfaces, Elytron also integrates with other
subsystems in JBoss EAP.
batch-jberet
You can configure the batch-jberet subsystem to run batch jobs using an Elytron security
domain. For more information, see Configure Security for Batch Jobs in the Configuration Guide.
datasources
You can use a credential store or an Elytron security domain to provide authentication information in
a datasource definition. For more information, see Datasource Security in the Configuration Guide.
ejb3
You can create mappings for Elytron security domains in the ejb3 subsystem to be referenced by
deployments. For more information, see Elytron Integration with the EJB Subsystem in Developing
EJB Applications.
iiop-openjdk
You can use the elytron subsystem to configure SSL/TLS between clients and servers using the
iiop-openjdk subsystem. For more information, see Configure IIOP to use SSL/TLS with the
Elytron Subsystem in the Configuration Guide.
jca
You can use the elytron-enabled attribute to enable Elytron security for a work manager. For
more information, see Configuring the JCA Subsystem in the Configuration Guide.
jgroups
You can configure the SYM_ENCRYPT and ASYM_ENCRYPT protocols to reference keystores or
credential references defined in the elytron subsystem. For more information, see Securing a
Cluster in the Configuration Guide.
mail
You can use a credential store to provide authentication information in a server definition in the mail
subsystem. For more information, see Use a Credential Store for Passwords in the Configuration
Guide.
messaging-activemq
You can secure remote connections to the remote connections used by the messaging-activemq
subsystem. For more information, see the Using the Elytron Subsystem section of Configuring
Messaging.
modcluster
You can use an Elytron client ssl-context to communicate with a load balancer using SSL/TLS.
For more information, see Elytron Integration with the ModCluster Subsystem.
remoting
You can configure inbound and outbound connections in the remoting subsystem to reference
authentication contexts, SASL authentication factories, and SSL contexts defined in the elytron
15
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
subsystem. For full details on configuring each type of connection, see Elytron Integration with the
Remoting Subsystem.
resource-adapters
You can secure connections to the resource adapter using Elytron. You can enable security inflow to
establish security credentials when submitting work to be executed by the work manager. For more
information, see Configure Resource Adapters to Use the Elytron Subsystem in the Configuration
Guide.
undertow
You can use the elytron subsystem to configure both SSL/TLS and application authentication. For
more information on configuring application authentication, see Using SSL/TLS and Configure Web
Applications to Use Elytron or Legacy Security for Authentication in How to Configure Identity
Management.
Audit logging for the elytron subsystem enables logging of Elytron authentication and authorization
events within the application server. Audit log entries are stored in either JSON or SIMPLE, human
readable format. By default, audit logging is disabled in Elytron.
You can enable audit logging by configuring any of the following log handlers for Elytron, and then
adding them to the desired security domain:
IMPORTANT
Elytron audit logging is distinct from other audit logging, such as audit logging for the
JBoss EAP management interfaces. For more information on management interface audit
logging options, see the Management Audit Logging section in the JBoss EAP
Configuration Guide.
An Elytron file audit logger, named local-audit, is defined by default. Once enabled, it will write
Elytron audit logs to EAP_HOME/standalone/log/audit.log on a standalone server, or
EAP_HOME/domain/log/audit.log for a managed domain host.
format: Use SIMPLE for human readable text format, or JSON for storing individual events in
JSON.
1. You can use a command similar to the following to create a file audit log.
16
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
1. You can use a command similar to the following to create a file audit log.
/subsystem=elytron/file-audit-
log=my_audit_log:add(path="my_audit.log",relative-
to="jboss.server.log.dir",format=SIMPLE,synchronized=true)
/subsystem=elytron/security-domain=domain-with-file-logger:write-
attribute(name=security-event-listener, value=my_audit_log)
1. You can use a command similar to the following to create a periodic rotating file audit log.
/subsystem=elytron/periodic-rotating-file-audit-
log=my_periodic_audit_log:add(path="my_periodic_audit.log",relati
ve-
to="jboss.server.log.dir",format=SIMPLE,synchronized=false,suffix
=".yyyy-MM-dd-HH")
2. Enable the defined periodic rotating file audit logger by adding it to a security domain.
/subsystem=elytron/security-domain=domain-with-periodic-file-
logger:write-attribute(name=security-event-listener,
value=my_periodic_audit_log)
rotate-size: The maximum size that the log file can reach before being rotated. The default
is 2m for 2 megabytes.
rotate-on-boot: By default, a new log file is not created on server restart. You can set this to
true to rotate the log on server restart.
suffix: This optionally adds a date suffix to a rotated log. This must be in the
java.text.SimpleDateFormat format, for example .yyyy-MM-dd-HH.
When the log file size exceeds the limit defined by the rotate-size attribute, the suffix .1 is appended
to the end of the current file and a new log file is created. If there are any existing log files, their suffixed
number is incremented by one, for example audit_log.1 is renamed to audit_log.2. This happens
until the maximum number of log files defined by max-backup-index is reached. When the max-
backup-index is exceeded, the file that is over limit, for example audit_log.99, is removed.
17
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
1. You can use a command similar to the following to create a size rotating file audit log.
/subsystem=elytron/size-rotating-file-audit-
log=my_size_log:add(path="my_size_audit.log",relative-
to="jboss.server.log.dir",format=SIMPLE,synchronized=false,rotate-
size="2m",max-backup-index=10)
2. Enable the defined size rotating audit logger by adding it to a security domain.
/subsystem=elytron/security-domain=domain-with-size-logger:write-
attribute(name=security-event-listener, value=my_size_log)
/subsystem=elytron/syslog-audit-log=syslog-logger:add(host-
name=HOST_NAME, port=PORT, server-address=SERVER_ADDRESS,
format=JSON, transport=UDP)
/subsystem=elytron/security-domain=domain-with-syslog-logger:write-
attribute(name=security-event-listener, value=syslog-logger)
IMPORTANT
To send logs to syslog server over TLS, you can add the following configuration:
/subsystem=elytron/syslog-audit-log=remote-
audit:add(transport=SSL_TCP,server-
address=127.0.0.1,port=9898,host-name=Elytron,ssl-
context=audit-ssl)
NOTE
The elytron subsystem comes pre-configured with the default JBoss EAP profiles alongside the legacy
security subsystem.
If you are using a profile where the elytron subsystem has not been configured, you can add it by
adding the elytron extension and enabling the elytron subsystem.
18
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
/extension=org.wildfly.extension.elytron:add()
/subsystem=elytron:add
reload
/subsystem=elytron:remove
reload
IMPORTANT
Other subsystems within JBoss EAP may have dependencies on the elytron
subsystem. If these dependencies are not resolved before disabling it, you will see errors
when starting JBoss EAP.
/subsystem=security:remove
IMPORTANT
Other subsystems within JBoss EAP may have dependencies on the security subsystem.
If these dependencies are not resolved before disabling it, you will see errors when
starting JBoss EAP.
/subsystem=security:add
<security-realms>
<security-realm name="ManagementRealm">
<authentication>
<local default-user="$local" skip-group-loading="true"/>
19
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
NOTE
In addition to updating the existing security realms, JBoss EAP also allows you to create
new security realms. You can create new security realms via the management console as
well as invoking the following command from the management CLI:
/core-service=management/security-realm=NEW-REALM-NAME:add()
If you create a new security realm and want to use a properties file for authentication or
authorization, you must create a new properties file specifically for the new security
domain. JBoss EAP does not reuse existing files used by other security domains nor
does it automatically create new files specified in the configuration if they do not exist.
2.1.5. Using Authentication and Socket Bindings for Securing the Management
Interfaces
By default, JBoss EAP defines an http-interface to connect to the management interfaces:
[standalone@localhost:9990 /] /core-service=management:read-
resource(recursive=true)
{
"outcome" => "success",
"result" => {
"access" => {...},
"ldap-connection" => undefined,
"management-interface" => {"http-interface" => {
"allowed-origins" => undefined,
"console-enabled" => true,
"http-authentication-factory" => "management-http-
authentication",
"http-upgrade" => {
"enabled" => true,
20
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
NOTE
The management CLI commands shown assume that you are running a JBoss EAP
standalone server. For more details on using the management CLI for a JBoss EAP
managed domain, see the JBoss EAP Management CLI Guide.
The SSL configuration for connections comes from one of these locations:
The default SSL configuration that automatically prompts users to accept the server’s certificate.
NOTE
If you set the -Dwildfly.config.url property, any file can be used by the client for
configuration.
21
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Depending on the configuration of the host, JBoss EAP may be configured to use various network
interfaces and ports. This allows JBoss EAP to work with different host, networking, and firewall
requirements.
For more information on the networking and ports used by JBoss EAP, as well as how to configure these
settings, see the Network and Port Configuration section of the JBoss EAP Configuration Guide.
/core-service=management/management-interface=http-interface/:write-
attribute(name=console-enabled,value=false)
/subsystem=jmx/remoting-connector=jmx/:remove
For more information on JMX, see the JMX section of the Red Hat JBoss Enterprise Application Platform
Security Architecture guide.
The convenience of silent authentication for local users can be disabled where greater security control is
required. This can be achieved by removing the local element within the security-realm attribute of
the configuration file. This is applicable to both standalone instance as well as managed domain.
IMPORTANT
The removal of the local element should only be done if the impact on the JBoss EAP
instance and its configuration is fully understood.
[standalone@localhost:9990 /] /subsystem=elytron/sasl-authentication-
factory=managenet-sasl-authentication:read-resource
{
"outcome" => "success",
22
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
"result" => {
"mechanism-configurations" => [
{
"mechanism-name" => "JBOSS-LOCAL-USER",
"realm-mapper" => "local"
},
{
"mechanism-name" => "DIGEST-MD5",
"mechanism-realm-configurations" => [{"realm-name" =>
"ManagementRealm"}]
}
],
"sasl-server-factory" => "configured",
"security-domain" => "ManagementDomain"
}
}
/subsystem=elytron/sasl-authentication-factory=temp-sasl-
authentication:list-remove(name=mechanism-configurations,index=0)
reload
/core-service=management/security-
realm=REALM_NAME/authentication=local:remove
Although these can be useful for development and debugging purposes, you might want to remove these
headers if you do not want to disclose information about the server in use.
Use the following management CLI commands to remove these response headers from the default-
host:
/subsystem=undertow/server=default-server/host=default-host/filter-
ref=server-header:remove
/subsystem=undertow/server=default-server/host=default-host/filter-ref=x-
powered-by-header:remove
reload
2.2.6. Enable One-way SSL/TLS for the Management Interfaces Using the Elytron
Subsystem
1. Obtain or generate your keystore.
23
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Before enabling one-way SSL/TLS in JBoss EAP, you must obtain or generate the keystore you
plan on using. To generate an example keystore in Red Hat Enterprise Linux 7, use the following
command.
/subsystem=elytron/key-store=httpsKS:add(path=keystore.jks,relative-
to=jboss.server.config.dir,credential-reference={clear-
text=secret},type=JKS)
/subsystem=elytron/key-manager=httpsKM:add(key-
store=httpsKS,algorithm="SunX509",credential-reference={clear-
text=secret})
/subsystem=elytron/server-ssl-context=httpsSSC:add(key-
manager=httpsKM,protocols=["TLSv1.2"])
IMPORTANT
You need to know what key manager algorithms are provided by the JDK you are
using. For example, a JDK that uses SunJSSE provides the PKIX and SunX509
algorithms. You also need to determine what HTTPS protocols you want to
support. The example commands above use TLSv1.2. You can use the
cipher-suite-filter argument to specify which cipher suites are allowed,
and the use-cipher-suites-order argument to honor server cipher suite
order. The use-cipher-suites-order attribute by default is set to true. This
differs from the legacy security subsystem behavior, which defaults to
honoring client cipher suite order.
NOTE
/core-service=management/management-interface=http-interface:write-
attribute(name=ssl-context, value=httpsSSC)
/core-service=management/management-interface=http-interface:write-
attribute(name=secure-socket-binding, value=management-https)
reload
24
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
IMPORTANT
In cases where you have both a security-realm and ssl-context defined, JBoss
EAP will use the SSL/TLS configuration provided by ssl-context.
2.2.7. Enable Two-way SSL/TLS for the Management Interfaces Using the Elytron
Subsystem
1. Obtain or generate your keystore.
Before enabling one-way SSL/TLS in JBoss EAP, you must obtain or generate the keystores,
truststores and certificates you plan on using. To generate an example set of keystores,
truststores, and certificates in Red Hat Enterprise Linux 7, use the following commands.
c. Import the server and client certificates into the opposing truststores.
/subsystem=elytron/key-
store=twoWayKS:add(path=server.keystore.jks,relative-
to=jboss.server.config.dir,credential-reference={clear-
text=secret},type=JKS)
/subsystem=elytron/key-
store=twoWayTS:add(path=server.truststore.jks,relative-
to=jboss.server.config.dir,credential-reference={clear-
text=secret},type=JKS)
/subsystem=elytron/key-manager=twoWayKM:add(key-
store=twoWayKS,algorithm="SunX509",credential-reference={clear-
25
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
text=secret})
/subsystem=elytron/trust-manager=twoWayTM:add(key-
store=twoWayTS,algorithm="SunX509")
/subsystem=elytron/server-ssl-context=twoWaySSC:add(key-
manager=twoWayKM,protocols=["TLSv1.2"],trust-manager=twoWayTM,want-
client-auth=true,need-client-auth=true)
IMPORTANT
You need to know what key manager algorithms are provided by the JDK you are
using. For example, a JDK that uses SunJSSE provides the PKIX and SunX509
algorithms. You also need to determine what HTTPS protocols you want to
support. The example commands above use TLSv1.2. You can use the
cipher-suite-filter argument to specify which cipher suites are allowed,
and the use-cipher-suites-order argument to honor server cipher suite
order. The use-cipher-suites-order attribute by default is set to true. This
differs from the legacy security subsystem behavior, which defaults to
honoring client cipher suite order.
NOTE
/core-service=management/management-interface=http-interface:write-
attribute(name=ssl-context, value=twoWaySSC)
/core-service=management/management-interface=http-interface:write-
attribute(name=secure-socket-binding, value=management-https)
reload
This results in a forced two-way SSL/TLS authentication, without changing the original
authentication to the server management.
If you want to change the original authentication method, see Configure Authentication with
Certificates in How to Configure Identity Management for JBoss EAP.
26
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
IMPORTANT
In cases where you have both a security-realm and ssl-context defined, JBoss
EAP will use the SSL/TLS configuration provided by ssl-context.
2.2.8. Configure the Management Interfaces for One-way SSL/TLS with Legacy
Core Management Authentication
Configuring the JBoss EAP management interfaces for communication only using one-way SSL/TLS
provides increased security. All network traffic between the client and the management interfaces is
encrypted, which reduces the risk of security attacks such as a man-in-the-middle attack.
In this procedure unencrypted communication with the JBoss EAP instance is disabled. This procedure
applies to both standalone server and managed domain configurations. For a managed domain, prefix
the management CLI commands with the name of the host, for example: /host=master.
IMPORTANT
While performing the steps for enabling one-way SSL/TLS on the management interfaces,
do not reload the configuration unless explicitly instructed. Doing so may cause you to be
locked out of the management interfaces.
NOTE
This keystore must be in JKS format as the management interfaces are not compatible
with keystores in JCEKS format.
Use the following to generate a keystore, replacing the example values for the parameters, for example
alias, keypass, keystore, storepass and dname, with the correct values for the environment.
27
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
NOTE
The parameter validity specifies for how many days the key is valid. A value of 730
equals two years.
Use the following CLI commands to bind the management interfaces to HTTPS:
/core-service=management/management-interface=http-interface:write-
attribute(name=secure-socket-binding, value=management-https)
/core-service=management/management-interface=http-interface:undefine-
attribute(name=socket-binding)
/host=master/core-service=management/management-interface=http-
interface:write-attribute(name=secure-port,value=9993)
/host=master/core-service=management/management-interface=http-
interface:undefine-attribute(name=port)
/socket-binding-group=standard-sockets/socket-binding=management-
https:read-resource(recursive=true)
{
"outcome" => "success",
"result" => {
"client-mappings" => undefined,
"fixed-port" => false,
"interface" => "management",
"multicast-address" => undefined,
"multicast-port" => undefined,
"name" => "management-https",
"port" => expression "${jboss.management.https.port:9993}"
}
}
28
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
In this example, the new security realm using HTTPS, ManagementRealmHTTPS, uses a properties file
named https-mgmt-users.properties located in the
EAP_HOME/standalone/configuration/ directory for storing user names and passwords.
$ touch EAP_HOME/standalone/configuration/https-mgmt-
users.properties
2. Next, use the following management CLI commands to create a new security realm named
ManagementRealmHTTPS:
/core-service=management/security-realm=ManagementRealmHTTPS:add
/core-service=management/security-
realm=ManagementRealmHTTPS/authentication=properties:add(path=https-
mgmt-users.properties,relative-to=jboss.server.config.dir)
$ EAP_HOME/bin/add-user.sh -up
EAP_HOME/standalone/configuration/https-mgmt-users.properties -r
ManagementRealmHTTPS
...
Enter the details of the new user to add.
Using realm 'ManagementRealmHTTPS' as specified on the command line.
...
Username : httpUser
Password requirements are listed below. To modify these restrictions
edit the add-user.properties configuration file.
- The password must not be one of the following restricted values
{root, admin, administrator}
- The password must contain at least 8 characters, 1 alphabetic
character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
- The password must be different from the username
...
Password :
Re-enter Password :
About to add user 'httpUser' for realm 'ManagementRealmHTTPS'
...
Is this correct yes/no? yes
..
29
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
When configuring security realms that use properties files to store usernames and
passwords, it is recommended that each realm use a distinct properties file that is
not shared with another realm.
/core-service=management/management-interface=http-interface:write-
attribute(name=security-realm,value=ManagementRealmHTTPS)
/core-service=management/security-realm=ManagementRealmHTTPS/server-
identity=ssl:add(keystore-path=identity.jks,keystore-relative-
to=jboss.server.config.dir,keystore-password=password1, alias=appserver)
NOTE
/core-service=management/security-
realm=ManagementRealmHTTPS/server-identity=ssl:write-
attribute(name=keystore-password,value=newpassword)
reload
After reloading the server configuration, the log should contain the following, just before the text which
states the number of services that are started:
30
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
The management interfaces are now listening on port 9993, which confirms that the procedure was
successful.
IMPORTANT
At this point, the CLI will disconnect and will be unable to reconnect since the port
bindings have changed. Proceed to the next step to update the jboss-cli.xml file to
allow the management CLI to reconnect.
Example: jboss-cli.xml
<jboss-cli xmlns="urn:jboss:cli:2.0">
<default-protocol use-legacy-override="true">https-remoting</default-
protocol>
<!-- The default controller to connect to when 'connect' command is
executed w/o arguments -->
<default-controller>
<protocol>https-remoting</protocol>
<host>localhost</host>
<port>9993</port>
</default-controller>
...
The next time you connect to the management interface using the management CLI, you must accept
the server certificate and authenticate against the ManagementRealmHTTPS security realm:
$ ./jboss-cli.sh -c
Unable to connect due to unrecognised server certificate
Subject - CN=appserver,OU=Sales,O=Systems Inc,L=Raleigh,ST=NC,C=US
Issuer - CN=appserver, OU=Sales, O=Systems Inc, L=Raleigh, ST=NC, C=US
Valid From - Tue Jun 28 13:38:48 CDT 2016
Valid To - Thu Jun 28 13:38:48 CDT 2018
MD5 : 76:f4:81:8b:7e:c3:be:6d:ee:63:c1:7a:b7:b8:f0:fb
SHA1 : ea:e3:f1:eb:53:90:69:d0:c9:69:4a:5a:a3:20:8f:76:c1:e6:66:b6
31
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
In cases where you have both a security-realm and ssl-context defined, JBoss
EAP will use the SSL/TLS configuration provided by ssl-context.
2.2.9. Setting up Two-way SSL/TLS for the Management Interfaces with Legacy
Core Management Authentication
Two-way SSL/TLS authentication, also known as client authentication, authenticates both the client and
the server using SSL/TLS certificates. This differs from the Configure the Management Interfaces for
One-way SSL/TLS section in that both the client and server each have a certificate. This provides
assurance that not only is the server who it says it is, but the client is also who it says it is.
HOST1
The JBoss server hostname. For example: jboss.redhat.com.
HOST2
A suitable name for the client. For example: myclient. Note this is not necessarily an actual
hostname.
CA_HOST1
The DN (distinguished name) to use for the HOST1 certificate. For example:
cn=jboss,dc=redhat,dc=com.
CA_HOST2
The DN (distinguished name) to use for the HOST2 certificate. For example:
cn=myclient,dc=redhat,dc=com.
Prerequisites
NOTE
If a password vault is used to store the keystore and truststore passwords, which is
recommended, the password vault should already be created. For more information on the
password vault, see the Password Vault section as well as the Password Vault System
section of the Red Hat JBoss Enterprise Application Platform 7 Security Architecture
guide.
WARNING
Red Hat recommends that SSLv2, SSLv3, and TLSv1.0 be explicitly disabled in
favor of TLSv1.1 or TLSv1.2 in all affected packages.
32
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
4. Define a CertificateRealm.
Define a CertificateRealm in the configuration for the server (host.xml or standalone.xml)
and point the interface to it. This can be done using the following commands:
/core-service=management/security-realm=CertificateRealm:add()
/core-service=management/security-realm=CertificateRealm/server-
identity=ssl:add(keystore-path=/path/to/HOST1.keystore.jks,
keystore-password=secret,alias=HOST1_alias)
/core-service=management/security-
realm=CertificateRealm/authentication=truststore:add(keystore-
path=/path/to/HOST1.truststore.jks,keystore-password=secret)
/core-service=management/management-interface=http-interface:write-
attribute(name=security-realm,value=CertificateRealm)
IMPORTANT
Add the SSL/TLS configuration for the CLI, which uses EAP_HOME/bin/jboss-cli.xml as a
settings file.
33
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
To store the keystore and truststore passwords in plain text, edit EAP_HOME/bin/jboss-
cli.xml and add the SSL/TLS configuration using the appropriate values for the variables:
<ssl>
<alias>HOST2_alias</alias>
<key-store>/path/to/HOST2.keystore.jks</key-store>
<key-store-password>secret</key-store-password>
<trust-store>/path/to/HOST2.truststore.jks</trust-store>
<trust-store-password>secret</trust-store-password>
<modify-trust-store>true</modify-trust-store>
</ssl>
To use the keystore and truststore passwords stored in a password vault, you need to add the
vault configuration and appropriate vault values to EAP_HOME/bin/jboss-cli.xml:
<ssl>
<vault>
<vault-option name="KEYSTORE_URL" value="path-
to/vault/vault.keystore"/>
<vault-option name="KEYSTORE_PASSWORD" value="MASK-
5WNXs8oEbrs"/>
<vault-option name="KEYSTORE_ALIAS" value="vault"/>
<vault-option name="SALT" value="12345678"/>
<vault-option name="ITERATION_COUNT" value="50"/>
<vault-option name="ENC_FILE_DIR" value="EAP_HOME/vault/"/>
</vault>
<alias>HOST2_alias</alias>
<key-store>/path/to/HOST2.keystore.jks</key-store>
<key-store-password>VAULT::VB::cli_pass::1</key-store-password>
<key-password>VAULT::VB::cli_pass::1</key-password>
<trust-store>/path/to/HOST2.truststore.jks</trust-store>
<trust-store-password>VAULT::VB::cli_pass::1</trust-store-
password>
<modify-trust-store>true</modify-trust-store>
</ssl>
IMPORTANT
In cases where you have both a security-realm and ssl-context defined, JBoss
EAP will use the SSL/TLS configuration provided by ssl-context.
34
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
You can configure a list of the encryption ciphers which are allowed. For JSSE syntax, it must be a
comma-separated list. For OpenSSL syntax, it must be a colon-separated list. Ensure that only one
syntax is used. The default is the JVM default.
IMPORTANT
Using weak ciphers is a significant security risk. See NIST Guidelines for NIST
recommendations on cipher suites.
See the OpenSSL documentation for a list of available OpenSSL ciphers. Note that the following are not
supported:
@SECLEVEL
SUITEB128
SUITEB128ONLY
SUITEB192
See the Java documentation for a list of the standard JSSE ciphers.
To update the list of enabled cipher suites, use the enabled-cipher-suites attribute of the HTTPS listener
in the undertow subsystem.
Example: Management CLI Command for Updating the List of Enabled Cipher Suites
/subsystem=undertow/server=default-server/https-listener=https:write-
attribute(name=enabled-cipher-
suites,value="TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA")
NOTE
The example only lists two possible ciphers, but real-world examples will likely use more.
2.2.11. Enable FIPS 140-2 Cryptography for SSL/TLS on Red Hat Enterprise Linux
7
You can configure Undertow to use FIPS 140-2 compliant cryptography for SSL/TLS. The scope of this
configuration example is limited to Red Hat Enterprise Linux 7, using the Mozilla NSS library in FIPS
mode.
IMPORTANT
Red Hat Enterprise Linux 7 must already be configured to be FIPS 140-2 compliant. For
more information, see the solution titled How can I make RHEL 6 or RHEL 7 FIPS 140-2
compliant?, which is located on the Red Hat Customer Portal.
35
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
WARNING
Using the TLS 1.2 protocol when running JBoss EAP in FIPS mode can cause a
NoSuchAlgorithmException to occur. More details on this issue can be found in
the solution titled NoSuchAlgorithmException: no such algorithm:
SunTls12MasterSecret, which is located on the Red Hat Customer Portal.
To configure Undertow to use FIPS 140-2 compliant cryptography for SSL/TLS, you must do the
following:
Configure the management CLI for FIPS 140-2 compliant cryptography for SSL/TLS.
Configure the undertow subsystem to use either Elytron or the legacy core management
authentication.
NOTE
The OpenSSL provider requires a private key, but it is not possible to retrieve a private
key from the PKCS11 store. FIPS does not allow the export of unencrypted keys from
FIPS compliant cryptographic module. Therefore, for both the elytron subsystem as
well as legacy security, it is not possible to use the OpenSSL provider for TLS when in
FIPS mode.
1. Create a directory owned by the appropriate user to house the NSS database.
$ mkdir -p /usr/share/jboss-as/nssdb
$ chown jboss /usr/share/jboss-as/nssdb
$ modutil -create -dbdir /usr/share/jboss-as/nssdb
NOTE
The jboss user is only an example. You need to replace it with a user on your
operating system that you plan on using for running JBoss EAP.
36
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
It must specify:
a name
the directory where the NSS database was created in the previous step
Example: nss_pkcsll_fips.cfg
name = nss-fips
nssLibraryDirectory=/usr/lib64
nssSecmodDirectory=/usr/share/jboss-as/nssdb
nssDbMode = readOnly
nssModule = fips
NOTE
If you are not running a 64-bit version of Red Hat Enterprise Linux 6 then set
nssLibraryDirectory to /usr/lib instead of /usr/lib64.
Example: java.security
security.provider.1=sun.security.pkcs11.SunPKCS11 /usr/share/jboss-
as/nss_pkcsll_fips.cfg
NOTE
security.provider.5=com.sun.net.ssl.internal.ssl.Provider
to
security.provider.5=com.sun.net.ssl.internal.ssl.Provider SunPKCS11-
nss-fips
IMPORTANT
37
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
4. Run the modutil command on the NSS database directory you created in the previous step to
enable FIPS mode.
NOTE
You may get a security library error at this point requiring you to regenerate the
library signatures for some of the NSS shared objects.
IMPORTANT
The password used for the FIPS token must be a FIPS compliant password. If the
password is not strong enough, you may receive an error: ERROR: Unable to
change password on token "NSS FIPS 140-2 Certificate DB".
Example Command
7. Verify that the JVM can read the private key from the PKCS11 keystore by running the following
command:
38
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
IMPORTANT
Once you have FIPS enabled, you may see the following error when starting JBoss EAP:
This message will appear if you have any existing key managers configured, such as the
default key manager in legacy core management authentication, that do not use FIPS
140-2 compliant cryptography.
2.2.11.2. Configure the Management CLI for FIPS 140-2 Compliant Cryptography for
SSL/TLS
You must configure the JBoss EAP management CLI to work in an environment with FIPS 140-2
compliant cryptography for SSL/TLS enabled. By default, if you try to use the management CLI in such
an environment, the following exception is thrown:
39
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
org.jboss.as.cli.CliInitializationException:
java.security.KeyManagementException: FIPS mode: only SunJSSE TrustManagers
may be used.
JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=NONE -
Djavax.net.ssl.trustStoreType=PKCS11"
JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.keyStore=NONE -
Djavax.net.ssl.keyStoreType=PKCS11 -
Djavax.net.ssl.keyStorePassword=P@ssword123"
1. Create an XML configuration file for the management CLI with the following contents:
Example: cli-wildfly-config.xml
<configuration>
<authentication-client xmlns="urn:elytron:1.0.1">
<key-stores>
<key-store name="truststore" type="PKCS11">
<key-store-clear-password password="P@ssword123"/>
</key-store>
</key-stores>
<ssl-contexts>
<ssl-context name="client-cli-context">
<trust-store key-store-name="truststore"/>
<cipher-suite selector="${cipher.suite.filter}"/>
<protocol names="TLSv1.1"/>
</ssl-context>
</ssl-contexts>
<ssl-context-rules>
<rule use-ssl-context="client-cli-context"/>
</ssl-context-rules>
</authentication-client>
</configuration>
NOTE
If you are using the IBM JDK, see the IBM management CLI configuration
example for the specific configuration required.
2. When starting the management CLI, pass the configuration file to the management CLI script
using the -Dwildfly.config.url property. For example:
$ jboss-cli.sh -Dwildfly.config.url=cli-wildfly-config.xml
1. Add the FIPS 140-2 compliant cryptography key-store, key-manager and ssl-context.
40
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
/subsystem=elytron/key-
store=fipsKS:add(type=PKCS11,provider="SunPKCS11-nss-
fips",credential-reference={clear-text="P@ssword123"})
/subsystem=elytron/key-manager=fipsKM:add(key-
store=fipsKS,algorithm="SunX509",provider=SunPKCS11-nss-
fips,credential-reference={clear-text="P@ssword123"})
/subsystem=elytron/server-ssl-context=fipsSSC:add(key-
manager=fipsKM,protocols=["TLSv1.1"])
NOTE
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=fipsSSC)
run-batch
reload
In the elytron subsystem, OpenJDK and Oracle JDK in FIPS mode restrict the usage of any advanced
features that are based on providing custom KeyManager or TrustManager implementations. The
following configuration attributes do not work:
On the client:
ssl-context.key-store-ssl-certificate
On the server:
server-ssl-context.security-domain
trust-manager.certificate-revocation-list
Optionally, you can still use the legacy core management authentication instead of the elytron
subsystem to complete the setup of FIPS 140-2 compliant cryptography for SSL/TLS:
NOTE
The following commands below must either be run in batch mode, or the server
must be reloaded after adding the ssl server identity. The example below is
shown using batch mode.
41
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
batch
/core-service=management/security-realm=HTTPSRealm:add
/core-service=management/security-realm=HTTPSRealm/server-
identity=ssl:add(keystore-provider=PKCS11, keystore-
password="strongP@ssword1")
/subsystem=undertow/server=default-server/https-
listener=https:add(socket-binding=https, security-realm=HTTPSRealm,
enabled-protocols="TLSv1.1")
run-batch
The basic details for configuring Undertow to SSL/TLS are covered in Setting up an SSL/TLS for
Applications.
SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA,
TLS_ECDH_anon_WITH_AES_128_CBC_SHA,
TLS_ECDH_anon_WITH_AES_256_CBC_SHA
The basics behind enabling cipher suites for the https listener are covered in About Cipher
Suites. To enable cipher suites on the https listener:
/subsystem=undertow/server=default-server/https-
listener=https:write-attribute(name=enabled-cipher-
suites,value="SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_DHE_RSA_WITH_3DES_ED
E_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_DSS_WITH_AES_128_CBC_
SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TL
S_DHE_DSS_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_
ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
42
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
,TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_3DES_EDE_C
BC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES
_256_CBC_SHA,TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_RSA_WITH_AE
S_128_CBC_SHA,TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_3
DES_EDE_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WIT
H_AES_256_CBC_SHA,TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_anon_
WITH_AES_128_CBC_SHA,TLS_ECDH_anon_WITH_AES_256_CBC_SHA")
/core-service=management/security-realm=HTTPSRealm/server-
identity=ssl:write-attribute(name=enabled-cipher-suites, value=
[SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA,
TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA,
TLS_ECDH_anon_WITH_AES_128_CBC_SHA,
TLS_ECDH_anon_WITH_AES_256_CBC_SHA])
For more information on the IBMJCEFIPS provider, see the IBM Documentation for IBM JCEFIPS and
NIST IBMJCEFIPS – Security Policy. For more information on IBMJSSE2, see Running IBMJSSE2 in
FIPS mode.
The IBM JCE does not provide a keystore. The keys are stored on the computer and do not leave its
physical boundary. If the keys are moved between computers they must be encrypted.
To run keytool in FIPS-compliant mode use the -providerClass option on each command like this:
43
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
To configure the management CLI for FIPS 140-2 compliant cryptography on the IBM JDK, you must use
a management CLI configuration file specifically for the IBM JDK, such as the following:
Example: cli-wildfly-config-ibm.xml
<configuration>
<authentication-client xmlns="urn:elytron:1.0.1">
<key-stores>
<key-store name="truststore" type="JKS">
<file name="/path/to/truststore"/>
<key-store-clear-password password="P@ssword123"/>
</key-store>
</key-stores>
<ssl-contexts>
<ssl-context name="client-cli-context">
<trust-store key-store-name="truststore"/>
<cipher-suite selector="${cipher.suite.filter}"/>
<protocol names="TLSv1"/>
</ssl-context>
</ssl-contexts>
<ssl-context-rules>
<rule use-ssl-context="client-cli-context"/>
</ssl-context-rules>
</authentication-client>
</configuration>
To examine information about the IBMJCEFIPS used by the server, enable debug-level logging by
adding -Djavax.net.debug=true to the standalone.conf or domain.conf files. Information
about the FIPS provider is logged to the server.log file, for example:
2.2.13. Starting a Managed Domain when the JVM is Running in FIPS Mode
44
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
IMPORTANT
It is assumed you have a managed domain, FIPS configured, as well as all necessary
certificates configured. This includes having imported the domain controller’s certificate
into each controller’s truststore. For more details on configuring a managed domain, see
the Domain Management section in the JBoss EAP Configuration Guide. For more details
on configuring FIPS, see Enable FIPS 140-2 Cryptography for SSL/TLS on Red Hat
Enterprise Linux 7.
You need to update each host controller and the master domain controller to use SSL/TLS for
communication.
WARNING
Red Hat recommends that SSLv2, SSLv3, and TLSv1.0 be explicitly disabled in
favor of TLSv1.1 in all affected packages.
<security-realm name="HTTPSRealm">
<server-identities>
<ssl>
<engine enabled-protocols="TLSv1.1"/>
<keystore provider="PKCS11" keystore-
password="strongP@ssword1"/>
</ssl>
</server-identities>
<authentication>
<local default-user="\$local"/>
<properties path="https-users.properties" relative-
to="jboss.domain.config.dir"/>
</authentication>
</security-realm>
<security-realm name="HTTPSRealm">
<authentication>
<truststore provider="PKCS11" keystore-
password="strongP@ssword1"/>
</authentication>
</security-realm>
45
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
NOTE
<management-interfaces>
...
<native-interface security-realm="HTTPSRealm">
<socket interface="management"
port="${jboss.management.native.port:9999}"/>
</native-interface>
</management-interfaces>
4. Use the SSL/TLS realm on each host controller to connect to the master domain controller.
You need to update the security realm used for connecting to the master domain controller. This
change must be done directly in the host controller’s configuration file, for example host.xml or
host-slave.xml, while the server is not running.
<domain-controller>
<remote security-realm="HTTPSRealm">
<discovery-options>
<static-discovery name="primary"
protocol="${jboss.domain.master.protocol:remote}"
host="${jboss.domain.master.address}"
port="${jboss.domain.master.port:9999}"/>
</discovery-options>
</remote>
</domain-controller>
/host=master/core-service=management/security-
realm=HTTPSRealm/authentication=truststore:add(keystore-
provider="PKCS11",keystore-password="strongP@ssword1")
46
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
reload --host=master
You also need to update each host controller’s security realm to have an SSL server identity,
execute the following management CLI commands:
/host=host1/core-service=management/security-
realm=HTTPSRealm/server-identity=ssl:add(keystore-provider=PKCS11,
keystore-password="strongP@ssword1",enabled-protocols=["TLSv1.1"])
reload --host=host1
IMPORTANT
You also need to ensure that each host’s certificate is imported into the domain
controller’s truststore.
Auditing uses provider modules. Both included provider modules as well as custom implementations
may be used.
b. In a managed domain, select a profile to modify from the Profile selection box at the top left.
The configuration area is divided into two areas: Provider Modules and Details. The provider
module is the basic unit of configuration. A security domain can include several provider
modules each of which can include attributes and options.
47
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
To edit an option that already exists, click Remove to remove it, and click Add to add it again
with the correct options.
This certificate is created for testing purposes and is assigned to the HTTPS interface used by
applications. The keystore containing the certificate will be generated if the file does not exist the first
time the HTTPS interface is accessed.
<security-realm name="ApplicationRealm">
<server-identities>
<ssl>
48
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
<subsystem xmlns="urn:jboss:domain:undertow:4.0">
...
<server name="default-server">
...
<https-listener name="https" socket-binding="https" security-
realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
...
NOTE
If you want to disable the self-signed certificate creation, you will need to remove the
generate-self-signed-certificate-host="localhost" from the server
keystore configuration. The generate-self-signed-certificate-host attribute
holds the host name for which the self-signed certificate should be generated.
WARNING
This self-signed certificate is intended for testing purposes only and is not intended
for use in production environments. For more information on configuring SSL/TLS
for applications with Elytron, see the Enable One-way SSL/TLS for Applications
using the Elytron Subsystem and Enable Two-way SSL/TLS for Applications using
the Elytron Subsystem sections. For more information on configuring SSL/TLS for
applications with legacy security, see the Enable One-way SSL/TLS for Applications
Using Legacy Security Realms and Enable Two-way SSL/TLS for Applications Using
Legacy Security Realms sections.
2.4.2.1. Enable One-way SSL/TLS for Applications Using the Elytron Subsystem
In JBoss EAP, you can use the elytron subsystem, along with the undertow subsystem, to enable
one-way SSL/TLS for deployed applications.
49
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/subsystem=elytron/key-store=httpsKS:add(path=/path/to/keystore.jks,
credential-reference={clear-text=secret}, type=JKS)
NOTE
The previous command uses an absolute path to the keystore. Alternatively you
can use the relative-to attribute to specify the base directory variable and
path attribute to specify a relative path.
/subsystem=elytron/key-
store=httpsKS:add(path=keystore.jks, relative-
to=jboss.server.config.dir, credential-reference={clear-
text=secret}, type=JKS)
/subsystem=elytron/key-manager=httpsKM:add(key-store=httpsKS,
algorithm="SunX509", credential-reference={clear-text=secret})
IMPORTANT
You need to know what key manager algorithms are provided by the JDK you are
using. For example, a JDK that uses SunJSSE provides the PKIX and SunX509
algorithms.
The example command above uses SunX509 for the key manager algorithm.
/subsystem=elytron/server-ssl-context=httpsSSC:add(key-
manager=httpsKM, protocols=["TLSv1.2"])
IMPORTANT
You need to determine what SSL/TLS protocols you want to support. The
example command above uses TLSv1.2. You can use the cipher-suite-
filter argument to specify which cipher suites are allowed, and the use-
cipher-suites-order argument to honor server cipher suite order. The use-
cipher-suites-order attribute by default is set to true. This differs from the
legacy security subsystem behavior, which defaults to honoring client cipher
suite order.
50
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
WARNING
5. Check and see if the https-listener is configured to use a legacy security realm for its SSL
configuration.
/subsystem=undertow/server=default-server/https-listener=https:read-
attribute(name=security-realm)
{
"outcome" => "success",
"result" => "ApplicationRealm"
}
The above command shows that the https-listener is configured to use the
ApplicationRealm legacy security realm for its SSL configuration. Undertow cannot
reference both a legacy security realm and an ssl-context in Elytron at the same time so you
must remove the reference to the legacy security realm.
NOTE
If the result is undefined, you do not need to remove the reference to the
security realm in the next step.
6. Remove the reference to the legacy security realm, and update the https-listener to use
the ssl-context from Elytron.
NOTE
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=httpsSSC)
run-batch
reload
51
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
2.4.2.2. Enable Two-way SSL/TLS for Applications Using the Elytron Subsystem
In JBoss EAP, you can use the elytron subsystem, along with the undertow subsystem, to enable
two-way SSL/TLS for deployed applications.
Example: Import the Server and Client Certificates Into the Opposing Truststores:
/subsystem=elytron/key-
store=twoWayKS:add(path=/path/to/server.keystore.jks, credential-
reference={clear-text=secret}, type=JKS)
/subsystem=elytron/key-
store=twoWayTS:add(path=/path/to/server.truststore.jks, credential-
reference={clear-text=secret}, type=JKS)
52
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
NOTE
The previous command uses an absolute path to the keystore. Alternatively you
can use the relative-to attribute to specify the base directory variable and
path attribute to specify a relative path.
/subsystem=elytron/key-store=myKS:add(path=keystore.jks,
relative-to=jboss.server.config.dir, credential-
reference={clear-text=secret}, type=JKS)
/subsystem=elytron/key-manager=twoWayKM:add(key-store=twoWayKS,
algorithm="SunX509", credential-reference={clear-text=secret})
IMPORTANT
You need to know what key manager algorithms are provided by the JDK you are
using. For example, a JDK that uses SunJSSE provides the PKIX and SunX509
algorithms.
The example command below uses SunX509 for the key manager algorithm.
/subsystem=elytron/trust-manager=twoWayTM:add(key-store=twoWayTS,
algorithm="SunX509")
IMPORTANT
You need to know what key manager algorithms are provided by the JDK you are
using. For example, a JDK that uses SunJSSE provides the PKIX and SunX509
algorithms.
The example command above uses SunX509 for the key manager algorithm.
/subsystem=elytron/server-ssl-context=twoWaySSC:add(key-
manager=twoWayKM, protocols=["TLSv1.2"], trust-manager=twoWayTM,
need-client-auth=true)
53
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
You need to determine what SSL/TLS protocols you want to support. The
example command above uses TLSv1.2. You can use the cipher-suite-
filter argument to specify which cipher suites are allowed, and the use-
cipher-suites-order argument to honor server cipher suite order. The use-
cipher-suites-order attribute by default is set to true. This differs from the
legacy security subsystem behavior, which defaults to honoring client cipher
suite order.
WARNING
6. Check and see if the https-listener is configured to use a legacy security realm for its SSL
configuration.
/subsystem=undertow/server=default-server/https-listener=https:read-
attribute(name=security-realm)
{
"outcome" => "success",
"result" => "ApplicationRealm"
}
The above command shows that the https-listener is configured to use the
ApplicationRealm legacy security realm for its SSL configuration. Undertow cannot
reference both a legacy security realm and an ssl-context in the elytron subsystem at the
same time. So you must remove the reference to the legacy security realm.
NOTE
If the result is undefined, you do not need to remove the reference to the
security realm in the next step.
7. Remove the reference to the legacy security realm, and update the https-listener to use
the ssl-context from Elytron.
NOTE
batch
/subsystem=undertow/server=default-server/https-
listener=https:undefine-attribute(name=security-realm)
54
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
/subsystem=undertow/server=default-server/https-
listener=https:write-attribute(name=ssl-context, value=twoWaySSC)
run-batch
reload
This procedure forces a two-way SSL/TLS but it does not change the original authentication
method of the application.
If you want to change the original authentication method, see Configure Authentication with
Certificates in How to Configure Identity Management for JBoss EAP.
IMPORTANT
2.4.3.1. Enable One-way SSL/TLS for Applications Using Legacy Security Realms
This example assumes that the keystore, identity.jks, has been copied to the server configuration
directory and configured with the given properties. Administrators should substitute their own values for
the example ones.
NOTE
The management CLI commands shown assume that you are running a JBoss EAP
standalone server. For more details on using the management CLI for a JBoss EAP
managed domain, see the JBoss EAP Management CLI Guide.
1. Add and configure an HTTPS security realm first. Once the HTTPS security realm has been
configured, configure an https-listener in the undertow subsystem that references the
security realm:
batch
/core-service=management/security-realm=HTTPSRealm:add
/core-service=management/security-realm=HTTPSRealm/server-
identity=ssl:add(keystore-path=identity.jks, keystore-relative-
55
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
to=jboss.server.config.dir, keystore-password=password1,
alias=appserver)
/subsystem=undertow/server=default-server/https-
listener=https:write-attribute(name=security-realm,
value=HTTPSRealm)
run-batch
WARNING
2. Restart the JBoss EAP instance for the changes to take effect.
2.4.3.2. Enable Two-way SSL/TLS for Applications Using Legacy Security Realms
Setting up two-way SSL/TLS for applications follows many of the same procedures outlined in Setting up
Two-way SSL/TLS for the Management Interfaces. To set up two-way SSL/TLS for applications, you
need to do the following:
4. Define a security realm, for example CertificateRealm, on the server that uses the server’s
keystore and truststore
5. Update the undertow subsystem to use the security realm and require client verification
The first four steps are covered in Setting up Two-way SSL/TLS for the Management Interfaces.
IMPORTANT
If the server has not been reloaded since the new security realm has been added, you
must reload the server before performing the next step.
/subsystem=undertow/server=default-server/https-listener=https:write-
attribute(name=security-realm, value=CertificateRealm)
56
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
/subsystem=undertow/server=default-server/https-listener=https:write-
attribute(name=verify-client, value=REQUIRED)
IMPORTANT
You must reload the server for these changes to take effect.
IMPORTANT
Any client connecting to a JBoss EAP instance with two-way SSL/TLS enabled for
applications must have access to a client certificate or keystore, in other words a client
keystore whose certificate is included in the server’s truststore. If the client is using a
browser to connect to the JBoss EAP instance, you need to import that certificate or
keystore into the browser’s certificate manager.
NOTE
NOTE
Although JBoss EAP and Elytron Client work with a variety of SASL authentication
mechanisms, you must ensure that the mechanisms you use are supported. See this list
for the support levels for SASL authentication mechanisms.
The authentication mechanisms you use depends on your environment and desired authentication
method. The following list summarizes the use of some of the supported SASL authentication
mechanisms:
ANONYMOUS
Unauthenticated guest access.
DIGEST-MD5
Uses HTTP digest authentication as a SASL mechanism.
EXTERNAL
Uses authentication credentials that are implied in the context of the request. For example, IPsec or
TLS authentication.
Mechanisms beginning with GS
57
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
For more information on individual SASL authentication mechanisms, see the IANA SASL mechanism list
and individual mechanism memos.
/subsystem=elytron/configurable-sasl-server-
factory=mySASLServerFactory:add(sasl-server-factory=elytron)
/subsystem=elytron/sasl-authentication-factory=mySASLAuthFactory:add(sasl-
server-factory=mySASLServerFactory,security-
domain=ApplicationDomain,mechanism-configurations=[{mechanism-name=DIGEST-
MD5,mechanism-realm-configurations=[{realm-name=ApplicationRealm}]}])
58
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
/subsystem=elytron/authentication-configuration=myAuthConfig:write-
attribute(name=sasl-mechanism-selector,value="DIGEST-MD5")
<configuration>
<authentication-client xmlns="urn:elytron:1.0.1">
<authentication-rules>
<rule use-configuration="default" />
</authentication-rules>
<authentication-configurations>
<configuration name="default">
<sasl-mechanism-selector selector="#ALL" />
...
</configuration>
</authentication-configurations>
</authentication-client>
</configuration>
See How to Configure Identity Management for more information on configuring client authentication with
Elytron Client.
sasl-mechanism-selector Grammar
The selector string for sasl-mechanism-selector has a specific grammar.
In a simple form, individual mechanisms are specified by listing their names in order, separated by a
spaces. For example, to specify DIGEST-MD5, SCRAM-SHA-1, and SCRAM-SHA-256 as allowed
authentication mechanisms, use the following string: DIGEST-MD5 SCRAM-SHA-1 SCRAM-SHA-256.
More advanced usage of the grammar can use the following special tokens:
#FAMILY(NAME): Mechanisms belonging to the specified mechanism family. For example, the
family could be DIGEST, EAP, GS2, SCRAM, or IEC-ISO-9798.
#MUTUAL: Mechanisms that authenticate the server in some way, for example making the server
prove that the server knows the password. #MUTUAL includes families such as
#FAMILY(SCRAM) and #FAMILY(GS2).
#HASH(ALGORITHM): Mechanisms that use the specified hash algorithm. For example, the
algorithm could be MD5, SHA-1, SHA-256, SHA-384, or SHA-512.
59
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
The above tokens and names can also be used with the following operations and predicates:
-: Forbids
!: Inverts
&&: And
||: Or
==: Equals
?: If
#TLS && !#MUTUAL: When TLS is active, all mechanisms without mutual authentication.
(SCRAM-SHA-1 || SCRAM-SHA-256): Adds the two mechanisms in the order that the
provider or server presents them.
!#HASH(MD5): Any mechanism that does not use the MD5 hashing algorithm.
On the server side, you define authentication mechanism properties in the configurable-
sasl-server-factory. The following example defines the
com.sun.security.sasl.digest.utf8 property with a value of false.
/subsystem=elytron/configurable-sasl-server-
factory=mySASLServerFactory:map-
put(name=properties,key=com.sun.security.sasl.digest.utf8,value=fals
e)
On the client side, you define authentication mechanisms properties in the client’s authentication
configuration:
/subsystem=elytron/authentication-configuration=myAuthConfig:map-
put(name=mechanism-properties,key=wildfly.sasl.local-user.quiet-
auth,value=true)
60
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
For Elytron Client, authentication mechanism properties are specified under the
configuration element of authentication-configurations in the client
configuration file, usually named wildfly-config.xml. For example:
...
<authentication-configurations>
<configuration name="default">
<sasl-mechanism-selector selector="#ALL" />
<set-mechanism-properties>
<property key="wildfly.sasl.local-user.quiet-auth"
value="true" />
</set-mechanism-properties>
...
</configuration>
</authentication-configurations>
...
You can see a list of standard Java SASL authentication mechanism properties in the Java
documentation. Other JBoss EAP-specific SASL authentication mechanism properties are listed in the
Authentication Mechanisms Reference.
When protecting the communication between the application server and the load balancer, you need to
define a client ssl-context in order to:
Define a truststore holding the certificate chain that will be used to validate load balancer’s
certificate.
Define a trust manager to perform validations against the load balancer’s certificate.
/subsystem=elytron/client-ssl-context=modcluster-client-ssl-
context:add(trust-manager=default-trust-manager)
2. Reference the newly created client SSL context using one of the following options.
/subsystem=modcluster/mod-cluster-config=configuration:write-
attribute(name=ssl-context, value=modcluster-client-ssl-context)
61
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Configure the undertow subsystem by defining the ssl-context attribute of the mod-
cluster filter.
/subsystem=undertow/configuration=filter/mod-
cluster=modcluster:write-attribute(name=ssl-
context,value=modcluster-client-ssl-context)
reload
For configuring the modcluster subsystem and using two-way authentication, along with the trust
manager, the key manager also needs to be configured.
/subsystem=elytron/key-
store=twoWayKS:add(path=/path/to/client.keystore.jks, credential-
reference={clear-text=secret},type=JKS)
/subsystem=elytron/key-manager=twoWayKM:add(key-store=twoWayKS,
algorithm="SunX509", credential-reference={clear-text=secret})
/subsystem=elytron/client-ssl-context=modcluster-client-ssl-
context:add(trust-manager=default-trust-manager, key-
manager=twoWayKM)
NOTE
If you already have an existing client SSL context, you can add the key-
manager to it as follows:
/subsystem=elytron/client-ssl-context=modcluster-client-
ssl-context:write-attribute(name=key-manager,
value=twoWayKM)
reload
62
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
sasl-authentication-factory
A reference to the SASL authentication factory to use for authenticating requests to this connector.
For more information on creating this factory, see Create an Elytron Authentication Factory.
socket-binding
A reference to the socket binding, detailing the interface and port where the connector should listen
for incoming requests.
ssl-context
An optional reference to the server-side SSL Context to use for this connector. The SSL Context
contains the server key manager and trust manager to be used, and should be defined in instances
where SSL is desired.
For example, a connector can be added as follows, where SASL_FACTORY_NAME is an already defined
authentication factory and SOCKET_BINDING_NAME is an existing socket binding.
/subsystem=remoting/connector=CONNECTOR_NAME:add(sasl-authentication-
factory=SASL_FACTORY_NAME,socket-binding=SOCKET_BINDING_NAME)
/subsystem=remoting/connector=CONNECTOR_NAME:add(sasl-authentication-
factory=SASL_FACTORY_NAME,socket-binding=SOCKET_BINDING_NAME,ssl-
context=SSL_CONTEXT_NAME)
Enable One-way SSL/TLS for Remoting Connectors Using the Elytron Subsystem
Before enabling one-way SSL/TLS in JBoss EAP, you must configure a key-store, key-manager,
and a server-ssl-context that references the defined key-manager.
The following SASL mechanisms support channel binding to external secure channels, such as
SSL/TLS:
GS2-KRB5-PLUS
SCRAM-SHA-1-PLUS
SCRAM-SHA-256-PLUS
SCRAM-SHA-384-PLUS
SCRAM-SHA-512-PLUS
To use any of the above mechanisms, a custom SASL factory can be configured, or one of the
predefined SASL authentication factories can be modified to offer any of these mechanisms. A SASL
mechanism selector can be used on the client to specify the appropriate SASL mechanism.
63
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
1. Create a socket-binding for the connector. The following command defines the
oneWayBinding binding that listens on port 11199.
/socket-binding-group=standard-sockets/socket-
binding=oneWayBinding:add(port=11199)
2. Create a connector that references the SASL authentication factory, the previously created
socket binding, and the SSL context.
/subsystem=remoting/connector=oneWayConnector:add(sasl-
authentication-factory=SASL_FACTORY,socket-
binding=oneWayBinding,ssl-context=SSL_CONTEXT)
IMPORTANT
3. Configure the client to trust the server certificate. A generic example client is found at Elytron
Client Side One Way Example. This example configures an ssl-context using the client
trust-store.
Enable Two-way SSL/TLS for Remoting Connectors Using the Elytron Subsystem
Before enabling two-way SSL/TLS in JBoss EAP, you must configure a separate key-store
components for the client and server certificates, a key-manager for the server key-store, a trust-
manager for the server trust-store, and a server-ssl-context that references the defined key-
manager and trust-manager.
The following SASL mechanisms support channel binding to external secure channels, such as
SSL/TLS:
GS2-KRB5-PLUS
SCRAM-SHA-1-PLUS
SCRAM-SHA-256-PLUS
SCRAM-SHA-384-PLUS
SCRAM-SHA-512-PLUS
To use any of the above mechanisms, a custom SASL factory can be configured, or one of the
predefined SASL authentication factories can be modified to offer any of these mechanisms. A SASL
mechanism selector can be used on the client to specify the appropriate SASL mechanism.
1. Create a socket-binding for the connector. The following command defines the
twoWayBinding binding that listens on port 11199.
/socket-binding-group=standard-sockets/socket-
binding=twoWayBinding:add(port=11199)
2. Create a connector that references the SASL authentication factory, the previously created
socket binding, and the SSL context.
64
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
/subsystem=remoting/connector=twoWayConnector:add(sasl-
authentication-factory=SASL_FACTORY,socket-
binding=twoWayBinding,ssl-context=SSL_CONTEXT)
IMPORTANT
3. Configure your client to trust the server certificate, and to present its certificate to the server.
You need to configure your client to present the trusted client certificate to the server to
complete the two-way SSL/TLS authentication. For example, if using a browser, you need to
import the trusted certificate into the browser’s truststore. A generic example client is found at
Elytron Client Side Two Way Example. This example configures an ssl-context using the
client trust-store and key-store.
connector-ref
A reference to a predefined undertow listener.
sasl-authentication-factory
A reference to the SASL authentication factory to use for authenticating requests to this connector.
For more information on creating this factory, see Create an Elytron Authentication Factory.
For example, a http-connector can be added as follows, where CONNECTOR_NAME references the
undertow listener, and SASL_FACTORY_NAME is an already defined authentication factory in the
elytron subsystem.
/subsystem=remoting/http-connector=HTTP_CONNECTOR_NAME:add(connector-
ref=CONNECTOR_NAME,sasl-authentication-factory=SASL_FACTORY_NAME)
The following SASL mechanisms support channel binding to external secure channels, such as
SSL/TLS:
GS2-KRB5-PLUS
SCRAM-SHA-1-PLUS
SCRAM-SHA-256-PLUS
65
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
SCRAM-SHA-384-PLUS
SCRAM-SHA-512-PLUS
To use any of the above mechanisms, a custom SASL factory can be configured, or one of the
predefined SASL authentication factories can be modified to offer any of these mechanisms. A SASL
mechanism selector can be used on the client to specify the appropriate SASL mechanism.
1. Check whether the https-listener is configured to use a legacy security realm for its SSL
configuration.
/subsystem=undertow/server=default-server/https-listener=https:read-
attribute(name=security-realm)
{
"outcome" => "success",
"result" => "ApplicationRealm"
}
The above command shows that the https-listener is configured to use the
ApplicationRealm legacy security realm for its SSL configuration. Undertow cannot
reference both a legacy security realm and an ssl-context in Elytron at the same time so you
must remove the reference to the legacy security realm.
NOTE
If the result is undefined, you do not need to remove the reference to the
security realm in the next step.
2. Remove the reference to the legacy security realm, and update the https-listener to use
the ssl-context from Elytron.
NOTE
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=SERVER_SSL_CONTEXT)
run-batch
3. Create an HTTP connector that references the HTTPS listener and the SASL authentication
factory.
/subsystem=remoting/http-connector=ssl-http-connector:add(connector-
ref=https,sasl-authentication-factory=SASL_FACTORY)
66
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
reload
5. Configure the client to trust the server certificate. For example, if using a browser, you need to
import the trusted certificate into the browser’s truststore.
The following SASL mechanisms support channel binding to external secure channels, such as
SSL/TLS:
GS2-KRB5-PLUS
SCRAM-SHA-1-PLUS
SCRAM-SHA-256-PLUS
SCRAM-SHA-384-PLUS
SCRAM-SHA-512-PLUS
To use any of the above mechanisms, a custom SASL factory can be configured, or one of the
predefined SASL authentication factories can be modified to offer any of these mechanisms. A SASL
mechanism selector can be used on the client to specify the appropriate SASL mechanism.
1. Check whether the https-listener is configured to use a legacy security realm for its SSL
configuration.
/subsystem=undertow/server=default-server/https-listener=https:read-
attribute(name=security-realm)
{
"outcome" => "success",
"result" => "ApplicationRealm"
}
The above command shows that the https-listener is configured to use the
ApplicationRealm legacy security realm for its SSL configuration. Undertow cannot
reference both a legacy security realm and an ssl-context in Elytron at the same time so you
must remove the reference to the legacy security realm.
NOTE
If the result is undefined, you do not need to remove the reference to the
security realm in the next step.
2. Remove the reference to the legacy security realm, and update the https-listener to use
the ssl-context from Elytron.
67
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
NOTE
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=SERVER_SSL_CONTEXT)
run-batch
3. Create an HTTP connector that references the HTTPS listener and the SASL authentication
factory.
/subsystem=remoting/http-connector=ssl-http-connector:add(connector-
ref=https,sasl-authentication-factory=SASL_FACTORY)
reload
5. Configure your client to trust the server certificate, and to present its certificate to the server.
You need to configure your client to present the trusted client certificate to the server to
complete the two-way SSL/TLS authentication. For example, if using a browser, you need to
import the trusted certificate into the browser’s truststore.
IMPORTANT
In cases where you have both a security-realm and ssl-context defined, JBoss
EAP will use the SSL/TLS configuration provided by ssl-context.
68
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
/subsystem=remoting/remote-outbound-
connection=OUTBOUND_CONNECTION_NAME:add(authentication-
context=AUTHENTICATION_CONTEXT_NAME, outbound-socket-binding-
ref=OUTBOUND_SOCKET_BINDING_NAME)
For information on concepts and general configuration for the managed domain operating mode, see the
Domain Management section of the JBoss EAP Configuration Guide.
The add-user utility can be used to manage both the users in the ManagementRealm and the
users in the ApplicationRealm.
NOTE
The server caches the contents of the properties files in memory. However, the
server does check the modified time of the properties files on each authentication
request and reloads if the time has been updated. This means that all changes
made by the add-user utility are immediately applied to any running server.
The slave controller attemps to authenticate using the native interface. If the native interface has
been secured with the ManagementRealm Elytron security realm, then you would need to add a
user to ManagementRealm for the slave controller to use.
NOTE
The following example assumes the user slave with the password password1! has been
added to ManagementRealm.
/host=slave/subsystem=elytron/authentication-
configuration=slave:add(authentication-name=slave, credential-
reference={clear-text=password1!})
69
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/host=slave/subsystem=elytron/authentication-context=slave-
context:add(match-rules=[{authentication-configuration=slave}])
4. Specify the domain controller location and authentication-context in the slave controller.
<domain-controller>
<remote protocol="remote" host="localhost" port="9999"
authentication-context="slave-context"/>
</domain-controller>
IMPORTANT
After adding the user, the script will output a <secret> element, which will be used
in the next step. You must keep this value for use in the next step.
$ EAP_HOME/bin/add-user.sh
70
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
What groups do you want this user to belong to? (Please enter a
comma separated list, or leave blank for none)[ ]:
About to add user 'slave-user' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'slave-user' to file '/home/user/EAP-
7.1.0/standalone/configuration/mgmt-users.properties'
Added user 'slave-user' to file '/home/user/EAP-
7.1.0/domain/configuration/mgmt-users.properties'
Added user 'slave-user' with groups to file '/home/user/EAP-
7.1.0/standalone/configuration/mgmt-groups.properties'
Added user 'slave-user' with groups to file '/home/user/EAP-
7.1.0/domain/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to
another AS process?
e.g. for a slave host controller connecting to the master or for a
Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities
definition <secret value="ABCzc3dv11Qx" />
...
<security-realm name="ManagementRealm">
<server-identities>
<!-- Replace this with either a base64 password of your own,
or use a vault with a vault expression -->
<secret value="ABCzc3dv11Qx"/>
</server-identities>
...
<domain-controller>
<remote security-realm="ManagementRealm" username="slave-user">
<discovery-options>
<static-discovery name="primary"
protocol="${jboss.domain.master.protocol:remote}"
host="${jboss.domain.master.address}"
port="${jboss.domain.master.port:9999}"/>
</discovery-options>
</remote>
</domain-controller>
2.9.3. Configuring SSL/TLS Between Domain and Host Controllers Using Elytron
71
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
When you configure SSL/TLS to be used between JBoss EAP instances in a managed
domain, each instance can have a client or server role depending on the interaction. This
includes all host controllers as well as domain controllers. As a result, it is recommended
that you set up two-way SSL/TLS between endpoints.
You can configure JBoss EAP instances in a managed domain to use SSL/TLS when communicating
with each other, in other words, between the master domain controller and host controllers. To do so
using Elytron, use the following procedure.
The add-user utility can be used to manage both the users in the ManagementRealm and the
users in the ApplicationRealm.
NOTE
The server caches the contents of the properties files in memory. However, the
server does check the modified time of the properties files on each authentication
request and reloads if the time has been updated. This means that all changes
made by the add-user utility are immediately applied to any running server.
The slave controller attemps to authenticate using the native interface. If the native interface has
been secured with the ManagementRealm Elytron security realm, then you would need to add a
user to ManagementRealm for the slave controller to use.
NOTE
The following example assumes the user slave with the password password1! has been
added to ManagementRealm.
/host=master/subsystem=elytron/key-
72
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
store=twoWayKS:add(path=/path/to/server.keystore.jks,credential-
reference={clear-text=secret},type=JKS)
/host=master/subsystem=elytron/key-
store=twoWayTS:add(path=/path/to/server.truststore.jks,credential-
reference={clear-text=secret},type=JKS)
/host=master/subsystem=elytron/key-manager=twoWayKM:add(key-
store=twoWayKS,algorithm="SunX509",credential-reference={clear-
text=secret})
/host=master/subsystem=elytron/trust-manager=twoWayTM:add(key-
store=twoWayTS,algorithm="SunX509")
/host=master/subsystem=elytron/server-ssl-context=twoWaySSC:add(key-
manager=twoWayKM,protocols=["TLSv1.2"],trust-manager=twoWayTM,want-
client-auth=true,need-client-auth=true)
/host=master/core-service=management/management-interface=native-
interface:write-attribute(name=ssl-context, value=twoWaySSC)
IMPORTANT
You need to know what key manager algorithms are provided by the JDK you are
using. For example, a JDK that uses SunJSSE provides the PKIX and SunX509
algorithms. You also need to determine what HTTPS protocols you want to
support. The example commands above use TLSv1.2. You can use the
cipher-suite-filter argument to specify which cipher suites are allowed,
and the use-cipher-suites-order argument to honor server cipher suite
order. The use-cipher-suites-order attribute by default is set to true. This
differs from the legacy security subsystem behavior, which defaults to
honoring client cipher suite order.
4. Configure an authentication context and domain controller location on each slave host controller.
The following example configuration assumes the domain controller exists on localhost.
Ensure you specify the correct management user, password, and domain controller location for
your environment.
/host=slave1/subsystem=elytron/authentication-
context=slaveHostSSLContext:add()
/host=slave1/subsystem=elytron/authentication-
configuration=slaveHostSSLConfiguration:add()
/host=slave1/subsystem=elytron/authentication-
configuration=slaveHostSSLConfiguration:write-attribute(name=sasl-
mechanism-selector,value=DIGEST-MD5)
/host=slave1/subsystem=elytron/authentication-
configuration=slaveHostSSLConfiguration:write-
attribute(name=authentication-name,value=slave)
/host=slave1/subsystem=elytron/authentication-
configuration=slaveHostSSLConfiguration:write-
73
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
attribute(name=realm,value=ManagementRealm)
/host=slave1/subsystem=elytron/authentication-
configuration=slaveHostSSLConfiguration:write-
attribute(name=credential-reference,value={clear-text=password1!})
/host=slave1/subsystem=elytron/authentication-
context=slaveHostSSLContext:write-attribute(name=match-rules,value=
[{match-host=localhost,authentication-
configuration=slaveHostSSLConfiguration}]
/host=slave1:write-remote-domain-
controller(host=localhost,port=9999,protocol=remote,authentication-
context=slaveHostSSLContext)
The following example configuration assumes the domain controller exists on localhost.
Ensure you specify the correct domain controller location for your environment.
/host=slave1/subsystem=elytron/key-
store=twoWayKS:add(path=/path/to/client.keystore.jks,credential-
reference={clear-text=secret},type=JKS)
/host=slave1/subsystem=elytron/key-
store=twoWayTS:add(path=/path/to/client.truststore.jks,credential-
reference={clear-text=secret},type=JKS)
/host=slave1/subsystem=elytron/key-manager=twoWayKM:add(key-
store=twoWayKS,algorithm="SunX509",credential-reference={clear-
text=secret})
/host=slave1/subsystem=elytron/trust-manager=twoWayTM:add(key-
store=twoWayTS,algorithm="SunX509")
/host=slave1/subsystem=elytron/client-ssl-context=twoWayCSC:add(key-
manager=twoWayKM,protocols=["TLSv1.2"],trust-manager=twoWayTM)
/host=slave1/subsystem=elytron/authentication-
context=slaveHostSSLContext:write-attribute(name=match-rules,value=
[{match-host=localhost,authentication-
configuration=slaveHostSSLConfiguration,ssl-context=twoWayCSC}])
2.9.4. Configuring SSL/TLS Between Domain and Host Controllers Using Legacy
Core Management Authentication
74
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
IMPORTANT
When you configure SSL/TLS to be used between JBoss EAP instances in a managed
domain, each instance can have a client or server role depending on the interaction. This
includes all host controllers as well as domain controllers. As a result, it is recommended
that you set up two-way SSL/TLS between endpoints.
You can configure JBoss EAP instances in a managed domain to use SSL/TLS when communicating
with each other, in other words, between the master domain controller and host controllers. To do so
using legacy core management authentication, use the following procedure.
NOTE
The following commands below must either be run in batch mode, or the server
must be reloaded after adding the ssl server identity. The example below is
shown using batch mode.
batch
/host=master/core-service=management/security-
realm=CertificateRealm:add()
/host=master/core-service=management/security-
realm=CertificateRealm/server-
identity=ssl:add(alias=domaincontroller,keystore-relative-
to=jboss.domain.config.dir,keystore-
path=domaincontroller.jks,keystore-password=secret)
/host=master/core-service=management/security-
realm=CertificateRealm/authentication=truststore:add(keystore-
relative-to=jboss.domain.config.dir,keystore-
path=domaincontroller.jks,keystore-password=secret)
/host=master/core-service=management/security-
realm=CertificateRealm/authentication=local:add(default-
user=\$local)
/host=master/core-service=management/security-
realm=CertificateRealm/authentication=properties:add(relative-
to=jboss.domain.config.dir,path=mgmt-users.properties)
75
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/host=master/core-service=management/management-interface=native-
interface:write-attribute(name=security-
realm,value=CertificateRealm)
run-batch
NOTE
The following commands below must either be run in batch mode, or the server
must be reloaded after adding the ssl server identity. The example below is
shown using batch mode.
batch
/host=instance1/core-service=management/security-
realm=CertificateRealm:add()
/host=instance1/core-service=management/security-
realm=CertificateRealm/server-
identity=ssl:add(alias=instance1,keystore-relative-
to=jboss.domain.config.dir,keystore-path=instance1.jks,keystore-
password=secret)
/host=instance1/core-service=management/security-
realm=CertificateRealm/authentication=truststore:add(keystore-
relative-to=jboss.domain.config.dir,keystore-
path=instance1.jks,keystore-password=secret)
/host=instance1/core-service=management/security-
realm=CertificateRealm/authentication=local:add(default-
user="\$local")
/host=instance1/core-service=management/security-
realm=CertificateRealm/authentication=properties:add(relative-
to=jboss.domain.config.dir,path=mgmt-users.properties)
/host=instance1/core-service=management/management-interface=native-
interface:write-attribute(name=security-
realm,value=CertificateRealm)
run-batch
Additionally, you will need to update the security realm used when connecting the master
domain controller. This change must be done directly in the host controller’s configuration file, for
example host.xml or host-slave.xml, while the server is not running.
76
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
<domain-controller>
<remote security-realm="CertificateRealm" username="slave-user">
<discovery-options>
<static-discovery name="primary"
protocol="${jboss.domain.master.protocol:remote}"
host="${jboss.domain.master.address}"
port="${jboss.domain.master.port:9999}"/>
</discovery-options>
</remote>
</domain-controller>
WARNING
Enable One-way SSL/TLS for the Management Interfaces Using the Elytron Subsystem
Enable Two-way SSL/TLS for the Management Interfaces Using the Elytron Subsystem
NOTE
It is not possible to use a JMX ObjectName to decrypt the LDAP credentials. Instead,
credentials can be secured by using a credential store.
1. Configure a dir-context.
To connect to the LDAP server from JBoss EAP, you need to configure a dir-context that
provides the URL as well as the principal used to connect to the server.
Example: dir-context
77
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/subsystem=elytron/dir-
context=exampleDC:add(url="ldap://127.0.0.1:10389",
principal="uid=admin,ou=system", credential-reference={clear-
text="secret"})
2. Configure an ldap-key-store.
When you configure an ldap-key-store, you need to specify both the dir-context used to
connect to the LDAP server as well as how to locate the keystore stored in the LDAP server. At
a minimum, this requires you to specify a search-path.
Example: ldap-key-store
/subsystem=elytron/ldap-key-store=ldapKS:add(dir-context=exampleDC,
search-path="ou=Keystores,dc=wildfly,dc=org")
For the full list of attributes for ldap-key-store as well as other Elytron components, see Elytron
Subsystem Components Reference.
To create a filtering-key-store:
1. Configure a key-store.
/subsystem=elytron/key-store=myKS:add(path=keystore.jks, relative-
to=jboss.server.config.dir, credential-reference={clear-
text=secret}, type=JKS)
2. Configure a filtering-key-store.
When you configure a filtering-key-store, you specify which key-store you want to
filter and the alias-filter for filtering aliases from the key-store. The filter can be
specified in one of the following formats:
ALL:-alias2, which exposes all aliases in the keystore except the ones listed.
NONE:+alias1:+alias3, which exposes no aliases in the keystore except the ones listed.
This example uses a comma-delimted list to expose alias1 and alias3.
/subsystem=elytron/filtering-key-store=filterKS:add(key-
store=myKS, alias-filter="alias1,alias3")
78
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
NOTE
For the full list of attributes for filtering-key-store as well as other Elytron components, see
Elytron Subsystem Components Reference.
To reload a keystore:
/subsystem=elytron/key-store=httpsKS:load
/subsystem=elytron/key-store=httpsKS/:read-alias(alias=localhost)
To create a client-ssl-context:
79
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
SSL/TLS connection, you need to create a key-store for the server certificate and a trust-
manager that references it. Examples on creating keystores and truststores are available in the
Enable Two-way SSL/TLS for Applications using the Elytron Subsystem section.
2. Create a client-ssl-context.
Create a client-ssl-context referencing keystores, truststores, as well as any other
necessary configuration options.
Example: client-ssl-context
/subsystem=elytron/client-ssl-context=exampleCSC:add(key-
manager=clientKM, trust-manager=clientTM, protocols=["TLSv1.2"])
For the full list of attributes for client-ssl-context as well as other Elytron components, see Elytron
Subsystem Components Reference.
2. Create a server-ssl-context.
Create a server-ssl-context that references the key manager, trust manager, or any other
desired configuration options using one of the options outlined below.
/subsystem=elytron/server-ssl-context=newServerSSLContext:add(key-
manager=KEY_MANAGER,protocols=["TLSv1.2"])
IMPORTANT
You need to determine what HTTPS protocols will be supported. The example commands
above use TLSv1.2. You can use the cipher-suite-filter argument to specify
which cipher suites are allowed, and the use-cipher-suites-order argument to
honor server cipher suite order. The use-cipher-suites-order attribute by default is
set to true. This differs from the legacy security subsystem behavior, which defaults
to honoring client cipher suite order.
1. Access the management console. For more information, see the Management Console section
in the JBoss EAP Configuration Guide.
80
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
3. Click on View. The Server SSL Context tab lets you do all the server SSL context related
configurations.
For the full list of attributes for server-ssl-context as well as other Elytron components, see Elytron
Subsystem Components Reference.
key-store
key-manager
trust-manager
client-ssl-context
server-ssl-context
WARNING
IMPORTANT
When using FIPS it is not possible to utilize a custom trust manager or key manager, as
FIPS requires these managers be embedded in the JDK for security reasons. Similar
behavior can be accomplished by implementing a SecurityRealm that validates X509
evidences.
When creating custom implementations of Elytron components, they must present the appropriate
capabilities and requirements. For more details on capabilities and requirements, see the Capabilities
and Requirements section of the JBoss EAP Security Architecture guide. Implementation details for each
component are provided by the JDK vendor.
1. Add the JAR containing the provider for the custom component as a module into JBoss EAP,
declaring any required dependencies, such as javax.api:
81
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
Using the module management CLI command to add and remove modules is
provided as Technology Preview only. This command is not appropriate for use in
a managed domain or when connecting to the management CLI remotely.
Modules should be added and removed manually in a production environment.
For more information, see the Create a Custom Module Manually and Remove a
Custom Module Manually sections of the JBoss EAP Configuration Guide.
Technology Preview features are not supported with Red Hat production service
level agreements (SLAs), might not be functionally complete, and Red Hat does
not recommend to use them for production. These features provide early access
to upcoming product features, enabling customers to test functionality and
provide feedback during the development process.
See Technology Preview Features Support Scope on the Red Hat Customer
Portal for information about the support scope for Technology Preview features.
/subsystem=elytron/provider-loader=LOADER_NAME:add(class-names=
[CLASS_NAME],module=MODULE_NAME)
/subsystem=elytron/provider-
loader=LOADER_NAME:add(module=MODULE_NAME)
3. Add the custom component into Elytron’s configuration, using the appropriate element for the
type to be added and referencing any defined providers.
/subsystem=elytron/COMPONENT_NAME=NEW_COMPONENT:add(providers=LOADER
_NAME,...)
For instance, to define a trust manager, the trust-manager element would be used, as seen
in the following command:
/subsystem=elytron/trust-
manager=newTrustManager:add(algorithm=MyX509,providers=customProvide
r,key-store=sampleKeystore)
82
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
By implementing a custom trust manager, it is possible to extend the validation of certificates when using
HTTPS in Undertow, LDAPS in a dir-context, or any place where Elytron is used for SSL
connections. This component is responsible for making trust decisions for the server, and it is strongly
recommended that these be implemented if a custom trust manager is used.
IMPORTANT
When using FIPS it is not possible to utilize a custom trust manager, as FIPS requires this
manager be embedded in the JDK for security reasons. Similar behavior can be
accomplished by implementing a SecurityRealm that validates X509 evidences.
The provider must be included in the JAR file to be added into JBoss EAP. Any implemented classes
must be included in JBoss EAP as a module. Classes are not required to be in one module, and can be
loaded from module dependencies.
Example Implementations
The following example demonstrates a provider that registers the custom trust manager factory as a
service.
Example: Provider
import org.kohsuke.MetaInfServices;
import javax.net.ssl.TrustManagerFactory;
import java.security.Provider;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@MetaInfServices(Provider.class)
public class CustomProvider extends Provider {
public CustomProvider() {
super("CustomProvider", 1.0, "Demo provider");
System.out.println("CustomProvider initialization.");
putService(new Service(this,
TrustManagerFactory.class.getSimpleName(),"CustomAlgorithm",
CustomTrustManagerFactorySpi.class.getName(), emptyList, emptyMap));
83
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
The following example demonstrates a custom trust manager. This trust manager contains overloaded
methods on checking if a client or server is trusted.
Example: TrustManager
import javax.net.ssl.SSLEngine;
import javax.net.ssl.X509ExtendedTrustManager;
import java.net.Socket;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
The following example is a factory used to return instances of the trust manager.
84
CHAPTER 2. SECURING THE SERVER AND ITS INTERFACES
Example: TrustManagerFactorySpi
import javax.net.ssl.ManagerFactoryParameters;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactorySpi;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyStore;
import java.security.KeyStoreException;
/subsystem=elytron/trust-manager=TRUST_MANAGER:write-
attribute(name=certificate-revocation-list,value=
{path=/path/to/CRL_FILE.crl.pem}
For more information on the available attributes for a trust manager, see the trust-manager Attributes
table.
NOTE
Your truststore must contain the certificate chain in order to check the validity of both the
certification revocation list and the certificate. The truststore should not contain end-entity
certificates, just certificate authority and intermediate certificates.
You can instruct the trust manager to reload the certificate revocation list by using the reload-
certificate-revocation-list operation.
85
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/subsystem=elytron/trust-manager=TRUST_MANAGER:reload-certificate-
revocation-list
86
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
/core-service=management/management-interface=http-interface:read-
resource()
{
"outcome" => "success",
"result" => {
"allowed-origins" => undefined,
"console-enabled" => true,
"http-authentication-factory" => undefined,
"http-upgrade" => {"enabled" => true},
"http-upgrade-enabled" => true,
"sasl-protocol" => "remote",
"secure-socket-binding" => undefined,
"security-realm" => "ManagementRealm",
"server-name" => undefined,
"socket-binding" => "management-http",
"ssl-context" => undefined
}
/core-service=management/management-interface=http-interface:write-
attribute(name=http-authentication-factory, value=management-http-
authentication)
/core-service=management/management-interface=http-interface:write-
attribute(name=http-upgrade.sasl-authentication-factory,
value=management-sasl-authentication)
3. Undefine security-realm:
/core-service=management/management-interface=http-
interface:undefine-attribute(name=security-realm)
87
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
reload
The management interfaces are now secured using the default components provided by the elytron
subsystem.
When you access the management interface over http, for example when using the web-based
management console, JBoss EAP will use the management-http-authentication http-
authentication-factory.
/subsystem=elytron/http-authentication-factory=management-http-
authentication:read-resource()
{
"outcome" => "success",
"result" => {
"http-server-mechanism-factory" => "global",
"mechanism-configurations" => [{
"mechanism-name" => "DIGEST",
"mechanism-realm-configurations" => [{"realm-name" =>
"ManagementRealm"}]
}],
"security-domain" => "ManagementDomain"
}
}
/subsystem=elytron/security-domain=ManagementDomain:read-resource()
{
"outcome" => "success",
"result" => {
"default-realm" => "ManagementRealm",
"permission-mapper" => "default-permission-mapper",
"post-realm-principal-transformer" => undefined,
"pre-realm-principal-transformer" => undefined,
"principal-decoder" => undefined,
"realm-mapper" => undefined,
"realms" => [
{
"realm" => "ManagementRealm",
"role-decoder" => "groups-to-roles"
},
{
"realm" => "local",
"role-mapper" => "super-user-mapper"
}
],
"role-mapper" => undefined,
"trusted-security-domains" => undefined
}
}
88
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
The ManagementDomain security domain is backed by the ManagementRealm Elytron security realm,
which is a properties-based realm.
IMPORTANT
A properties-based realm is only read when the server starts. Any users added after
server start, either manually or by using an add-user script, will require a server reload.
This reload is accomplished by running the reload command from the management CLI.
reload
/subsystem=elytron/properties-realm=ManagementRealm:read-resource()
{
"outcome" => "success",
"result" => {
"groups-attribute" => "groups",
"groups-properties" => {
"path" => "mgmt-groups.properties",
"relative-to" => "jboss.server.config.dir"
},
"plain-text" => false,
"users-properties" => {
"path" => "mgmt-users.properties",
"relative-to" => "jboss.server.config.dir"
}
}
}
<jboss-cli xmlns="urn:jboss:cli:3.1">
<default-protocol use-legacy-override="true">remote+http</default-
protocol>
This will establish a connection over HTTP and use HTTP upgrade to change the communication
protocol to Remoting. The HTTP upgrade connection is secured in the http-upgrade section of the
http-interface using a sasl-authentication-factory.
89
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/core-service=management/management-interface=http-interface:read-
resource()
{
"outcome" => "success",
"result" => {
"allowed-origins" => undefined,
"console-enabled" => true,
"http-authentication-factory" => "management-http-authentication",
"http-upgrade" => {
"enabled" => true,
"sasl-authentication-factory" => "management-sasl-
authentication"
},
"http-upgrade-enabled" => true,
"sasl-protocol" => "remote",
"secure-socket-binding" => undefined,
"security-realm" => undefined,
"server-name" => undefined,
"socket-binding" => "management-http",
"ssl-context" => undefined
}
}
/subsystem=elytron/sasl-authentication-factory=management-sasl-
authentication:read-resource()
{
"outcome" => "success",
"result" => {
"mechanism-configurations" => [
{
"mechanism-name" => "JBOSS-LOCAL-USER",
"realm-mapper" => "local"
},
{
"mechanism-name" => "DIGEST-MD5",
"mechanism-realm-configurations" => [{"realm-name" =>
"ManagementRealm"}]
}
],
"sasl-server-factory" => "configured",
"security-domain" => "ManagementDomain"
}
}
The ManagementRealm Elytron security realm, used in DIGEST-MD5, is the same realm used in the
management-http-authentication http-authentication-factory.
/subsystem=elytron/identity-realm=local:read-resource()
90
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
{
"outcome" => "success",
"result" => {
"attribute-name" => undefined,
"attribute-values" => undefined,
"identity" => "$local"
}
}
The local Elytron security realm is for handling silent authentication for local users.
Example: http-authentication-factory
/subsystem=elytron/http-authentication-factory=example-http-
auth:add(http-server-mechanism-factory=global, security-
domain=exampleSD, mechanism-configurations=[{mechanism-name=DIGEST,
mechanism-realm-configurations=[{realm-
name=exampleManagementRealm}]}])
Example: sasl-authentication-factory
/subsystem=elytron/sasl-authentication-factory=example-sasl-
auth:add(sasl-server-factory=configured, security-domain=exampleSD,
mechanism-configurations=[{mechanism-name=DIGEST-MD5, mechanism-
realm-configurations=[{realm-name=exampleManagementRealm}]}])
/subsystem=elytron/configurable-sasl-server-factory=configured:list-
add(name=filters, value={pattern-filter=GSSAPI})
This is an optional step. When a client attempts to connect to the HTTP management interfaces,
JBoss EAP sends back an HTTP response with a status code of 401 Unauthorized, and a
set of headers that list the supported authentication mechanisms, for example, Digest, GSSAPI,
and so on. For more information, see the Local and Remote Client Authentication with the HTTP
Interface section in the JBoss EAP Security Architecture guide.
91
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/core-service=management/management-interface=http-interface:write-
attribute(name=http-authentication-factory, value=example-http-auth)
reload
/core-service=management/management-interface=http-interface:write-
attribute(name=http-upgrade.sasl-authentication-factory,
value=example-sasl-auth)
reload
NOTE
/socket-binding-group=standard-sockets/socket-
binding=native:add(interface=management, port=9999)
/core-service=management/management-interface=native-
interface:add(socket-binding=native)
/core-service=management/management-interface=native-
interface:write-attribute(name=sasl-authentication-factory,
value=example-sasl-auth)
reload
NOTE
When using legacy core management authentication, you can only secure the http
management interface with a single legacy security realm. This forces the HTTP and
SASL configuration to appear in a single legacy security realm. When using the elytron
subsystem, you can configure the http-authentication-factory and sasl-
authentication-factory separately, allowing you to use distinct security domains
for securing the HTTP and SASL mechanisms of the http management interface.
NOTE
If two different attributes with similar implementation in legacy security and Elytron,
respectively, are configured in the management interface, only the Elytron related
configurations are used. For example, if security-realm for legacy security and
http-authentication-factory for Elytron are configured, then authentication is
handled by http-authentication-factory configuration.
92
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
NOTE
When the management interface includes both the security-realm and the ssl-
context, and the http-authentication-factory or sasl-authentication-
factory for the native interface is not used, then authentication is handled by the legacy
security realm and SSL is handled by Elytron.
/subsystem=elytron/sasl-authentication-factory=example-sasl-auth:list-
add(name=mechanism-configurations, value={mechanism-name=JBOSS-LOCAL-USER,
realm-mapper=local})
reload
/subsystem=elytron/sasl-authentication-factory=example-sasl-auth:add(sasl-
server-factory=configured,security-domain=ManagementDomain,mechanism-
configurations=[{mechanism-name=DIGEST-MD5,mechanism-realm-configurations=
[{realm-name=exampleManagementRealm}]},{mechanism-name=JBOSS-LOCAL-USER,
realm-mapper=local}])
reload
NOTE
The above example uses the existing ManagementDomain security domain, but you can
also create and use other security domains. You can find more examples of creating
security domains in the Elytron Subsystem section of the JBoss EAP How to Configure
Identity Management Guide.
93
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
If the Elytron security is used and an authentication attempt comes in using the JBOSS-
LOCAL-USER SASL mechanism with an authentication name that does not correspond to
a real identity, authentication fails.
The application server exposes more than one kind of management interface. Each type of interface can
be associated with an independent authentication-factory to handle the authentication
requirements of that interface.
To make the authorization decision, the current security identity is obtained from the security domain.
The returned security identity has the role mapping and permission assignment, based on the rules
defined within that security domain.
NOTE
In most cases, a common security domain is used for all management; for authentication
of the management interfaces as well as for obtaining the security identity used for the
authorization decisions. In these cases, the security domain is associated with the
authentication factory of the management interface and no special access=identity
needs to be defined.
In some cases, a different security domain is used to obtain the identity for the
authorization decisions. Here, the access=identity resource is defined. It contains a
reference to a security domain to obtain the identity for authorization.
The below example assumes you have secured the management interfaces with the exampleSD Elytron
security domain and have it exposed as exampleManagementRealm.
To define the identity mapping, add the identity resource to the management interfaces.
/core-service=management/access=identity:add(security-domain=exampleSD)
Once you have added the identity resource, the identity of an authenticated user will appear when
accessing the management interfaces. When the identity resource is not added, then the identity of
the security domain used for authentication is used.
For example, if you logged into the management CLI as user1, your identity will properly appear.
Example: Display the Identity of an Authenticated User from the Management CLI
:whoami
94
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
{
"outcome" => "success",
"result" => {"identity" => {"username" => "user1"}}
}
IMPORTANT
If the identity resource is added and legacy security realms are used to secure the
management interfaces, authenticated users will always have the anonymous identity.
Once the identity resource is removed, users authenticated from the legacy security
realms will appear with the appropriate identity.
Authorization for management operation always uses the security domain, which is the domain specified
on access=identity. If not specified, it is the domain used for authentication. Any role mapping is
always in the context of the security domain.
The identity resource for the current request will return a set of roles as mapped using the Elytron
configuration. When an RBAC based role mapping definition is in use, the roles from the identity
resource will be taken as groups and fed into the management RoleMapping to obtain the management
roles for the current request.
HTTP management interface using elytron HTTP Identity from connection. Identity from referenced
authentication factory backed by security- security-domain if
domain it was successfully
inflowed.
Native management, including over HTTP Upgrade, Identity from connection. Unsupported or
interface using legacy security-realm anonymous identity.
Native management, including over HTTP Upgrade, Identity from connection. Identity from referenced
interface using elytron SASL authentication security-domain if
factory backed by security-domain it was successfully
inflowed.
NOTE
If security domain used in the identity resource does not trust the security domain from
authentication, anonymous identity is used.
The security domain used in the identity resource does not need to trust the security
domain from authentication, when both are using an identical security realm.
95
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Where no access=identity resource is defined, then the identity established during authentication
against the management interface will be used. Identities established using connections, through the
remoting subsystem or using applications, will not be usable in this case.
Where an access=identity resource is defined but the security domain used by the management
interfaces is different and not listed in the list of domains to inflow from, no identity will be established. An
inflow will be attempted using the identity established during authentication. Identities established using
connections through the remoting subsystem or using applications will not be inflowed in this way.
IMPORTANT
Where the management interfaces are secured using the legacy security realms, the
identity will not be sharable across different security domains. In that case no
access=identity resource should be defined. So the identity established during
authentication can be used directly. Thus, applications secured using PicketBox are not
supported for the identity resource.
Example: custom-config.xml
<configuration>
<authentication-client xmlns="urn:elytron:1.0.1">
<authentication-rules>
<rule use-configuration="configuration1">
<match-host name="localhost" />
</rule>
</authentication-rules>
<authentication-configurations>
<configuration name="configuration1">
<sasl-mechanism-selector selector="DIGEST-MD5" />
<providers>
<use-service-loader />
</providers>
<set-user-name name="user1" />
<credentials>
<clear-password password="password123" />
</credentials>
<set-mechanism-realm name="exampleManagementRealm"
/>
</configuration>
96
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
</authentication-configurations>
</authentication-client>
</configuration>
3. Use the Elytron Client configuration file with management CLI script.
$ ./jboss-cli.sh -c -Dwildfly.config.url=/path/to/custom-config.xml
The example in this section demonstrates how to forward security identity credentials. It propagates the
security identity of a client and an EJB to a remote EJB. It returns a string containing the name of the
Principal that called the remote EJB along with the user’s authorized role information. The example
consists of the following components.
A secured EJB that contains a single method, accessible by all users, that returns authorization
information about the caller.
An intermediate EJB that contains a single method. It makes use of a remote connection and
invokes the method on the secured EJB.
You must first enable security identity propagation by configuring the server. Next review the example
application code that uses the WildFlyInitialContextFactory to look up and invoke the remote
EJB.
/subsystem=ejb3/application-security-domain=quickstart-
domain:add(security-domain=ApplicationDomain)
<subsystem xmlns="urn:jboss:domain:ejb3:5.0">
....
<application-security-domains>
<application-security-domain name="quickstart-domain"
security-domain="ApplicationDomain"/>
</application-security-domains>
</subsystem>
97
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
2. Add the PLAIN authentication configuration to send plain text user names and passwords, and
the authentication context that is to be used for outbound connections. See Mechanisms That
Support Security Identity Propagation for the list of mechanisms that support identity
propagation.
/subsystem=elytron/authentication-configuration=ejb-outbound-
configuration:add(security-domain=ApplicationDomain,sasl-mechanism-
selector="PLAIN")
/subsystem=elytron/authentication-context=ejb-outbound-
context:add(match-rules=[{authentication-configuration=ejb-outbound-
configuration}])
3. Add the remote destination outbound socket binding to the standard-sockets socket binding
group.
/socket-binding-group=standard-sockets/remote-destination-outbound-
socket-binding=ejb-outbound:add(host=localhost,port=8080)
This adds the following ejb-outbound outbound socket binding to the standard-sockets
socket binding group.
4. Add the remote outbound connection and set the SASL authentication factory in the HTTP
connector.
/subsystem=remoting/remote-outbound-connection=ejb-outbound-
connection:add(outbound-socket-binding-ref=ejb-outbound,
authentication-context=ejb-outbound-context)
98
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
/subsystem=remoting/http-connector=http-remoting-connector:write-
attribute(name=sasl-authentication-factory,value=application-sasl-
authentication)
<subsystem xmlns="urn:jboss:domain:remoting:4.0">
....
<http-connector name="http-remoting-connector" connector-
ref="default" security-realm="ApplicationRealm" sasl-authentication-
factory="application-sasl-authentication"/>
<outbound-connections>
<remote-outbound-connection name="ejb-outbound-connection"
outbound-socket-binding-ref="ejb-outbound" authentication-
context="ejb-outbound-context"/>
</outbound-connections>
</subsystem>
/subsystem=elytron/sasl-authentication-factory=application-sasl-
authentication:write-attribute(name=mechanism-configurations,value=
[{mechanism-name=PLAIN},{mechanism-name=JBOSS-LOCAL-USER,realm-
mapper=local},{mechanism-name=DIGEST-MD5,mechanism-realm-
configurations=[{realm-name=ApplicationRealm}]}])
The server is now configured to enable security propagation for the following example application.
99
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Once security identity propagation is enabled in the server configuration, the EJB client application can
use the WildFlyInitialContextFactory to look up and invoke the EJB proxy. The EJB is invoked
as the user that authenticated in the client example shown below. The following abbreviated code
examples are taken from the ejb-security-context-propagation quickstart that ships with JBoss
EAP 7.1. See that quickstart for a complete working example of security identity propagation.
To invoke the EJB as a different user, you can set the Context.SECURITY_PRINCIPAL and
Context.SECURITY_CREDENTIALS in the context properties.
AuthenticationContext.getContextManager().setThreadDefault(authCtx);
invokeIntermediateBean();
}
@Stateless
@Remote(IntermediateEJBRemote.class)
@SecurityDomain("quickstart-domain")
@PermitAll
100
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
@EJB(lookup="ejb:/ejb-security-context-
propagation/SecuredEJB!org.jboss.as.quickstarts.ejb_security_context_propa
gation.SecuredEJBRemote")
private SecuredEJBRemote remote;
@Resource
private EJBContext context;
return sb.toString();
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new RuntimeException("Teasting failed.", e);
}
}
}
@Stateless
@Remote(SecuredEJBRemote.class)
@SecurityDomain("quickstart-domain")
public class SecuredEJB implements SecuredEJBRemote {
@Resource
private SessionContext context;
@PermitAll
public String getSecurityInformation() {
StringBuilder sb = new StringBuilder("[");
sb.append("Principal=[").
append(context.getCallerPrincipal().getName()).
append("], ");
userInRole("guest", sb).append(", ");
userInRole("user", sb).append(", ");
userInRole("admin", sb).append("]");
return sb.toString();
}
}
101
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
<configuration>
<authentication-client xmlns="urn:elytron:1.0.1">
<authentication-rules>
<rule use-configuration="default"/>
</authentication-rules>
<authentication-configurations>
<configuration name="default">
<set-user-name name="quickstartUser"/>
<credentials>
<clear-password password="quickstartPwd1!"/>
</credentials>
<sasl-mechanism-selector selector="PLAIN"/>
<providers>
<use-service-loader />
</providers>
</configuration>
</authentication-configurations>
</authentication-client>
</configuration>
Requirements are such that you cannot send passwords over the wire.
The authentication type is one that does not support credential forwarding.
The environment requires a need to limit which systems are allowed to receive the propagated
requests.
To utilize authorization forwarding, you first configure an authentication client on the forwarding server
and then configure the receiving server to accept and handle the authorization.
The following management CLI commands create a default authentication client configuration to enable
authentication forwarding. You can configure a more advanced rule based selection if you need one.
/subsystem=elytron/authentication-
configuration=forwardit:add(authentication-name=theserver1,security-
domain=ApplicationDomain,realm=ApplicationRealm,forwarding-
mode=authorization,credential-reference={clear-
text=thereallysecretpassword})
/subsystem=elytron/authentication-context=forwardctx:add(match-rules=
[{authentication-configuration=forwardit,match-no-user=true}])
102
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
<authentication-client>
<authentication-configuration name="forwardit" authentication-
name="theserver1" security-domain="ApplicationDomain" forwarding-
mode="authorization" realm="ApplicationRealm">
<credential-reference clear-text="thereallysecretpassword"/>
</authentication-configuration>
<authentication-context name="forwardctx">
<match-rule match-no-user="true" authentication-
configuration="forwardit"/>
</authentication-context>
</authentication-client>
When the forwarding server contacts the receiving server, instead of using the default authentication-
based user name and credentials, it uses the predefined server login name theserver1 to establish the
trust relationship.
You must also configure a "RunAs" permission mapping in the elytron subsystem to allow the identity
switch for the theserver1 identity that is passed from the forwarding server. For more information
about permission mapping, see Create an Elytron Permission Mapper in How to Configure Server
Security for JBoss EAP.
A permission mapping for the user anonymous. This user has no permissions, which prevents
an anonymous user from being able to log in.
A permission mapping for the user theserver1. This user is assigned the
RunAsPrincipalPermission permission of *, which gives this user global permissions to run
as any identity. You can restrict the permission to a specific identity if you prefer.
/subsystem=elytron/simple-permission-mapper=auth-forwarding-permission-
mapper:add(permission-mappings=[{principals=["anonymous"]},{principals=
["theserver1"],permissions=[{class-
name="org.wildfly.security.auth.permission.RunAsPrincipalPermission",targe
t-name="*"},{class-
name="org.wildfly.security.auth.permission.LoginPermission"},{class-
name="org.wildfly.extension.batch.jberet.deployment.BatchPermission",modul
e="org.wildfly.extension.batch.jberet",target-name="*"},{class-
name="org.wildfly.transaction.client.RemoteTransactionPermission",module="
org.wildfly.transaction.client"},{class-
name="org.jboss.ejb.client.RemoteEJBPermission",module="org.jboss.ejb-
client"}]},{match-all=true,permissions=[{class-
name="org.wildfly.security.auth.permission.LoginPermission"},{class-
103
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
name="org.wildfly.extension.batch.jberet.deployment.BatchPermission",modul
e="org.wildfly.extension.batch.jberet",target-name="*"},{class-
name="org.wildfly.transaction.client.RemoteTransactionPermission",module="
org.wildfly.transaction.client"},{class-
name="org.jboss.ejb.client.RemoteEJBPermission",module="org.jboss.ejb-
client"}]}])
<simple-permission-mapper name="auth-forwarding-permission-mapper">
<permission-mapping>
<principal name="anonymous"/>
<!-- No permissions: Deny any permission to anonymous! -->
</permission-mapping>
<permission-mapping>
<principal name="theserver1"/>
<permission class-
name="org.wildfly.security.auth.permission.RunAsPrincipalPermission"
target-name="*"/>
<permission class-
name="org.wildfly.security.auth.permission.LoginPermission"/>
<permission class-
name="org.wildfly.extension.batch.jberet.deployment.BatchPermission"
module="org.wildfly.extension.batch.jberet" target-name="*"/>
<permission class-
name="org.wildfly.transaction.client.RemoteTransactionPermission"
module="org.wildfly.transaction.client"/>
<permission class-name="org.jboss.ejb.client.RemoteEJBPermission"
module="org.jboss.ejb-client"/>
</permission-mapping>
<permission-mapping match-all="true">
<permission class-
name="org.wildfly.security.auth.permission.LoginPermission"/>
<permission class-
name="org.wildfly.extension.batch.jberet.deployment.BatchPermission"
module="org.wildfly.extension.batch.jberet" target-name="*"/>
<permission class-
name="org.wildfly.transaction.client.RemoteTransactionPermission"
module="org.wildfly.transaction.client"/>
<permission class-name="org.jboss.ejb.client.RemoteEJBPermission"
module="org.jboss.ejb-client"/>
</permission-mapping>
</simple-permission-mapper>
In cases where principal transformers are used after forwarding authorization, then those transformers
are applied on both the authentication and the authorization principals.
104
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
import org.wildfly.security.auth.server.IdentityCredentials;
import org.wildfly.security.auth.server.SecurityDomain;
import org.wildfly.security.auth.server.SecurityIdentity;
import org.wildfly.security.credential.PasswordCredential;
import org.wildfly.security.password.interfaces.ClearPassword;
PLAIN
OAUTHBEARER
GSSAPI
GS2-KRB5
FORM 1
BASIC
105
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
BEARER_TOKEN
SPNEGO
1 FORM authentication is not automatically handled by the web browser. For this reason, you cannot use
identity propagation with web applications that use FORM authentication when running in an HA cluster.
Other mechanisms, such as BASIC and SPNEGO, support identity propagation in an HA cluster
environment.
You can use the Elytron API to switch identities in server-to-server EJB calls. When you do that, the
request received over the connection is executed as a new request, using the identity specified
programmatically in the API call.
The following code example demonstrates how to switch the identity that is used for authentication on a
remote EJB. The remoteUsername and remotePassword arguments passed in the
securityDomain.authenticate() method are the identity credentials that are to be used for
authentication on the target server.
securityDomain.authenticate(remoteUsername, new
PasswordGuessEvidence(remotePassword.toCharArray())).runAs(forwardIdentity
Callable);
106
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
running the JBoss EAP instance. Remote access is also enabled and is configured to use a file-based
identity store. By default it uses mgmt-users.properties file to store user names and passwords,
and mgmt-groups.properties to store user group information.
User information is added to these files by using the included adduser script located in the
EAP_HOME/bin/ directory.
3. Choose the realm the user will be added to. By default, the only available realms are
ManagementRealm and ApplicationRealm. If a custom realm has been added, its name
can be manually entered instead.
4. Type the desired user name, password, and optional roles when prompted. The changes are
written to each of the properties files for the security realm.
NOTE
When JBoss EAP instances are configured to run in ADMIN_ONLY mode, using JAAS to
secure the management interfaces is not supported. For more information on
ADMIN_ONLY mode, see the Running JBoss EAP in ADMIN_ONLY Mode section of the
JBoss EAP Configuration Guide.
To use JAAS to authenticate to the management interfaces, the following steps must be performed:
/subsystem=security/security-domain=UsersLMDomain:add(cache-
type=default)
/subsystem=security/security-
domain=UsersLMDomain/authentication=classic:add
107
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/subsystem=security/security-
domain=UsersLMDomain/authentication=classic/login-
module=UsersRoles:add(code=UsersRoles, flag=required,module-options=
[("usersProperties"=>"users.properties"),
("rolesProperties"=>"roles.properties")])
/core-service=management/security-realm=SecurityDomainAuthnRealm:add
/core-service=management/security-
realm=SecurityDomainAuthnRealm/authentication=jaas:add(name=UsersLMD
omain)
/core-service=management/management-interface=http-interface/:write-
attribute(name=security-realm,value=SecurityDomainAuthnRealm)
/core-service=management/security-
realm=SecurityDomainAuthnRealm/authentication=jaas:write-
attribute(name=assign-groups,value=true)
108
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
WARNING
Before changing the provider to rbac, be sure your configuration has a user who will
be mapped to one of the RBAC roles, preferably with at least one in the
Administrator or SuperUser role. Otherwise your installation will not be
manageable except by shutting it down and editing the XML configuration. If you
have started with one of the standard XML configurations shipped with JBoss EAP,
the $local user will be mapped to the SuperUser role and the local
authentication scheme will be enabled. This will allow a user, running the CLI on the
same system as the JBoss EAP process, to have full administrative permissions.
Remote CLI users and web-based management console users will have no
permissions.
It is recommended to map at least one user, besides $local, before switching the
provider to rbac. You can do all of the configuration associated with the rbac
provider even when the provider is set to simple.
Once enabled it can only be disabled by a user of the Administrator or SuperUser roles. By default
the management CLI runs as the SuperUser role if it is run on the same machine as the server.
/core-service=management/access=authorization:write-
attribute(name=provider, value=rbac)
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
reload
In a managed domain, the access control configuration is part of the domain wide configuration, so the
resource address is the same as above, but the management CLI is connected to the master domain
controller.
/core-service=management/access=authorization:write-
attribute(name=provider,value=rbac)
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
},
"result" => undefined,
"server-groups" => {"main-server-group" => {"host" => {"master" => {
109
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
reload --host=master
NOTE
As with a standalone server, a reload or restart is required for the change to take effect. In
a managed domain, all hosts and servers in the domain will need to be reloaded or
restarted, starting with the master domain controller.
/core-service=management/access=authorization:write-
attribute(name=provider, value=simple)
<management>
<access-control provider="rbac">
<role-mapping>
<role name="SuperUser">
<include>
<user name="$local"/>
</include>
</role>
</role-mapping>
</access-control>
</management>
110
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
The Permission Combination Policy determines how permissions are determined if a user is assigned
more than one role. This can be set to permissive or rejecting. The default is permissive.
When set to permissive, if any role is assigned to the user that permits an action, then the action is
allowed.
When set to rejecting, if multiple roles are assigned to a user, then no action is allowed. This means
that when the policy is set to rejecting each user should only be assigned one role. Users with multiple
roles will not be able to use the management console or the management CLI when the policy is set to
rejecting.
/core-service=management/access=authorization:write-
attribute(name=permission-combination-policy, value=POLICYNAME)
/core-service=management/access=authorization:write-
attribute(name=permission-combination-policy, value=rejecting)
If the server is offline the XML configuration can be edited to change the permission combination policy
value. To do this, edit the permission-combination-policy attribute of the access-control
element.
111
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Role include and exclude settings for users and groups can be configured using both the management
console and the management CLI.
Only users of the SuperUser or Administrator roles can perform this configuration.
The configuration of mapping users and groups to roles is located at: /core-
service=management/access=authorization as role-mapping elements.
Only users of the SuperUser or Administrator roles can perform this configuration.
/core-service=management/access=authorization:read-children-names(child-
type=role-mapping)
{
"outcome" => "success",
"result" => [
"Administrator",
"Deployer",
"Maintainer",
"Monitor",
"Operator",
"SuperUser"
]
}
Use the read-resource operation of a specified role-mapping to get the full details of a specific role:
/core-service=management/access=authorization/role-mapping=ROLENAME:read-
resource(recursive=true)
{
"outcome" => "success",
"result" => {
"include-all" => false,
"exclude" => undefined,
"include" => {
"user-theboss" => {
"name" => "theboss",
"realm" => undefined,
"type" => "USER"
},
112
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
"user-harold" => {
"name" => "harold",
"realm" => undefined,
"type" => "USER"
},
"group-SysOps" => {
"name" => "SysOps",
"realm" => undefined,
"type" => "GROUP"
}
}
}
}
/core-service=management/access=authorization/role-mapping=ROLENAME:add
ROLENAME is the name of the role that the new mapping is for, such as Auditor.
/core-service=management/access=authorization/role-mapping=Auditor:add
If no configuration for a role has been done, then a role-mapping entry for it must be done first.
Use the add operation to add a user entry to the includes list of the role.
/core-service=management/access=authorization/role-
mapping=ROLENAME/include=ALIAS:add(name=USERNAME, type=USER)
ALIAS is a unique name for this mapping. Red Hat recommends the use of a naming convention
for aliases, such as user-USERNAME (for example, user-max).
USERNAME is the name of the user being added to the include list, such as max.
/core-service=management/access=authorization/role-
mapping=Auditor/include=user-max:add(name=max, type=USER)
If no configuration for a role has been done, then a role-mapping entry for it must be done first.
113
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Use the add operation to add a user entry to the excludes list of the role.
/core-service=management/access=authorization/role-
mapping=ROLENAME/exclude=ALIAS:add(name=USERNAME, type=USER)
ROLENAME is the name of the role being configured, for example Auditor.
USERNAME is the name of the user being added to the exclude list, for example max.
ALIAS is a unique name for this mapping. Red Hat recommends that the use of a naming
convention for aliases, such as user-USERNAME (for example, user-max).
/core-service=management/access=authorization/role-
mapping=Auditor/exclude=user-max:add(name=max, type=USER)
/core-service=management/access=authorization/role-
mapping=ROLENAME/include=ALIAS:remove
ALIAS is a unique name for this mapping. Red Hat recommends that the use of a naming
convention for aliases, such as user-USERNAME (for example, user-max).
Example: Management CLI Command for Removing User Role Include Configuration
/core-service=management/access=authorization/role-
mapping=Auditor/include=user-max:remove
NOTE
Removing the user from the list of includes does not remove the user from the system, nor
does it guarantee that the role will not be assigned to the user. The role might still be
assigned based on group membership.
/core-service=management/access=authorization/role-
mapping=ROLENAME/exclude=ALIAS:remove
ALIAS is a unique name for this mapping. Red Hat recommends that the use of a naming
convention for aliases, such as user-USERNAME (for example, user-max).
114
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
/core-service=management/access=authorization/role-
mapping=Auditor/exclude=user-max:remove
NOTE
Removing the user from the list of excludes does not remove the user from the system,
nor does it guarantee the role will be assigned to the user. Roles might still be excluded
based on group membership.
To configure the RBAC system to use roles provided by the elytron subsystem:
/core-service=management/access=authorization:write-attribute(name=use-
identity-roles,value=true)
IMPORTANT
RBAC must be enabled to use this functionality, and the principal must have RBAC roles.
The configuration of mapping users and groups to roles is located in the management API at: /core-
service=management/access=authorization as role-mapping elements.
Only users in the SuperUser or Administrator roles can perform this configuration.
/core-service=management/access=authorization:read-children-names(child-
type=role-mapping)
{
"outcome" => "success",
"result" => [
"Administrator",
"Deployer",
"Maintainer",
"Monitor",
115
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
"Operator",
"SuperUser"
]
}
Use the read-resource operation of a specified role-mapping to get the full details of a specific role:
/core-service=management/access=authorization/role-mapping=ROLENAME:read-
resource(recursive=true)
{
"outcome" => "success",
"result" => {
"include-all" => false,
"exclude" => undefined,
"include" => {
"user-theboss" => {
"name" => "theboss",
"realm" => undefined,
"type" => "USER"
},
"user-harold" => {
"name" => "harold",
"realm" => undefined,
"type" => "USER"
},
"group-SysOps" => {
"name" => "SysOps",
"realm" => undefined,
"type" => "GROUP"
}
}
}
}
/core-service=management/access=authorization/role-mapping=ROLENAME:add
If no configuration for a role has been done, then a role-mapping entry for it must be done first.
Use the add operation to add a group entry to the includes list of the role.
/core-service=management/access=authorization/role-
mapping=ROLENAME/include=ALIAS:add(name=GROUPNAME, type=GROUP)
116
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
GROUPNAME is the name of the group being added to the include list, such as
investigators.
ALIAS is a unique name for this mapping. Red Hat recommends that you use a naming
convention for your aliases, such as group-GROUPNAME (for example, group-
investigators).
/core-service=management/access=authorization/role-
mapping=Auditor/include=group-investigators:add(name=investigators,
type=GROUP)
If no configuration for a role has been done, then a role-mapping entry for it must be created first.
Use the add operation to add a group entry to the excludes list of the role.
/core-service=management/access=authorization/role-
mapping=ROLENAME/exclude=ALIAS:add(name=GROUPNAME, type=GROUP)
GROUPNAME is the name of the group being added to the include list, such as supervisors.
ALIAS is a unique name for this mapping. Red Hat recommends that you use a naming
convention for your aliases, such as group-GROUPNAME (for example, group-supervisors).
/core-service=management/access=authorization/role-
mapping=Auditor/exclude=group-supervisors:add(name=supervisors,
type=GROUP)
/core-service=management/access=authorization/role-
mapping=ROLENAME/include=ALIAS:remove
ALIAS is a unique name for this mapping. Red Hat recommends that you use a naming
convention for your aliases, such as group-GROUPNAME (for example, group-
investigators).
Example: Management CLI Command for Removing Group Role Include Configuration
/core-service=management/access=authorization/role-
mapping=Auditor/include=group-investigators:remove
117
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
NOTE
Removing the group from the list of includes does not remove the group from the system,
nor does it guarantee that the role will not be assigned to users in this group. The role
might still be assigned to users in the group individually.
/core-service=management/access=authorization/role-
mapping=ROLENAME/exclude=ALIAS:remove
ALIAS is a unique name for this mapping. Red Hat recommends that you use a naming
convention for your aliases, such as group-GROUPNAME (for example, group-supervisors).
/core-service=management/access=authorization/role-
mapping=Auditor/exclude=group-supervisors:remove
NOTE
Removing the group from the list of excludes does not remove the group from the system.
It also does not guarantee the role will be assigned to members of the group. Roles might
still be excluded based on group membership.
IMPORTANT
A unique name.
118
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
Once created a scoped role can be assigned to users and groups the same way that the standard roles
are.
Creating a scoped role does not allow for defining new permissions. Scoped roles can only be used to
apply the permissions of an existing role in a limited scope. For example, a scoped role could be created
based on the Deployer role which is restricted to a single server group.
There are only two scopes that roles can be limited to:
Host-scoped roles
A role that is host-scoped restricts the permissions of that role to one or more hosts. This means
access is provided to the relevant /host=*/ resource trees but resources that are specific to other
hosts are hidden.
Server-group-scoped roles
A role that is server-group-scoped restricts the permissions of that role to one or more server groups.
Additionally the role permissions will also apply to the profile, socket binding group, server
configuration, and server resources that are associated with the specified server-groups. Any sub-
resources within any of those that are not logically related to the server-group will not be visible to the
user.
IMPORTANT
Some resources are non-addressable to server-group and host scoped roles in order
to provide a simplified view of the management model to improve usability. This is distinct
from resources that are non-addressable to protect sensitive data.
For host scoped roles this means that resources in the /host=* portion of the
management model will not be visible if they are not related to the server groups specified
for the role.
For server-group scoped roles, this means that resources in the profile, socket-
binding-group, deployment, deployment-overlay, server-group, server-
config and server portions of the management model will not be visible if they are not
related to the server groups specified for the role.
IMPORTANT
Only users in the SuperUser or Administrator roles can perform this configuration.
/core-service=management/access=authorization/role-mapping=NEW-SCOPED-
ROLE:add
119
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
/core-service=management/access=authorization/server-group-scoped-
role=NEW-SCOPED-ROLE:add(base-role=BASE-ROLE, server-groups=[SERVER-GROUP-
NAME])
/core-service=management/access=authorization/role-mapping=NEW-SCOPED-
ROLE:read-resource(recursive=true)
To edit a scoped role’s details, the write-attribute command may be used. For example:
/core-service=management/access=authorization/role-mapping=NEW-SCOPED-
ROLE:write-attribute(name=include-all, value=true)
/core-service=management/access=authorization/role-mapping=NEW-SCOPED-
ROLE:remove
/core-service=management/access=authorization/server-group-scoped-
role=NEW-SCOPED-ROLE:remove
IMPORTANT
A scoped role cannot be deleted if users or groups are assigned to it. Remove the role
assignments first, and then delete it.
IMPORTANT
Only users in the SuperUser or Administrator roles can perform this configuration.
Scoped role configuration in the management console can be found by following these steps:
120
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
3. Click on the Roles menu on the left and all roles, including scoped roles, are displayed.
The following procedures show how to perform configuration tasks for scoped roles.
4. Click Add.
Base Role, the role which this role will base its permissions on.
Scope, the list of hosts or server groups that the role is restricted to. Multiple entries can be
selected.
Include All, should this role automatically include all users. Defaults to no.
6. Click Save and the dialog will close and the newly created role will appear in the table.
5. Update the desired details to change and click the Save button.
4. Click on the desired scoped role and choose Include or Exclude to view the included or
excluded members.
121
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
4. Click on the desired scoped role, click the drop-down arrow next to the Edit button and click
Remove.
IMPORTANT
A scoped role cannot be deleted if users or groups are assigned to it. Remove the role
assignments first, and then delete it.
4. Click on the desired scoped role and choose Include or Exclude to view the included or
excluded members.
5. To add a member, click Add, choose the member to include or exclude, and click Save.
6. To remove a member, select the desired member to remove and click Remove.
Each sensitivity constraint defines a set of resources that are considered sensitive. A sensitive resource
is generally one that either should be secret, like passwords, or one that will have serious impact on the
server, like networking, JVM configuration, or system properties. The access control system itself is also
considered sensitive. Resource sensitivity limits which roles are able to read, write or address a specific
resource.
Within the management model each sensitivity constraint is identified as a classification. The
classifications are then grouped into types. Each classification has an applies-to element which is a
list of path patterns to which the classifications configuration applies.
To configure a sensitivity constraint, use the write-attribute operation to set the configured-
requires-read, configured-requires-write, or configured-requires-addressable
attribute. To make that type of operation sensitive set the value of the attribute to true, otherwise to
make it nonsensitive set it to false. By default these attributes are not set and the values of default-
requires-read, default-requires-write, and default-requires-addressable are used.
Once the configured attribute is set it is that value that is used instead of the default. The default values
cannot be changed.
122
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
/core-service=management/access=authorization/constraint=sensitivity-
classification/type=core/classification=system-property:write-
attribute(name=configured-requires-read,value=true)
Example: Result
/core-service=management/access=authorization/constraint=sensitivity-
classification/type=core/classification=system-property:read-resource
{
"outcome" => "success",
"result" => {
"configured-requires-addressable" => undefined,
"configured-requires-read" => true,
"configured-requires-write" => undefined,
"default-requires-addressable" => false,
"default-requires-read" => false,
"default-requires-write" => true,
"applies-to" => {
"/core-service=platform-mbean/type=runtime" => undefined,
"/system-property=*" => undefined,
"/" => undefined
}
}
}
The roles, and the respective operations that they are able to perform, depend on the configuration of the
attributes. This is summarized in the following table:
You can see a list of the available sensitivity constraints directly from the JBoss EAP management model
using the following management CLI command:
/core-service=management/access=authorization/constraint=sensitivity-
123
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
classification:read-resource(include-runtime=true,recursive=true)
Each application resource constraint defines a set of resources, attributes and operations that are usually
associated with the deployment of applications and services. When an application resource constraint is
enabled management users of the Deployer role are granted access to the resources that it applies to.
Each application resource constraint is identified as a classification. The classifications are then grouped
into types. Each classification has an applies-to element which is a list of path patterns to which the
classifications configuration applies.
By default the only application resource classification that is enabled is core. Core includes deployments,
deployment overlays, and the deployment operations.
To enable an application resource, use the write-attribute operation to set the configured-
application attribute of the classification to true. To disable an application resource, set this
attribute to false. By default these attributes are not set and the value of default-application
attribute is used. The default value cannot be changed.
/core-service=management/access=authorization/constraint=application-
classification/type=logging/classification=logging-profile:write-
attribute(name=configured-application,value=true)
Example: Result
/core-service=management/access=authorization/constraint=application-
classification/type=logging/classification=logging-profile:read-resource
{
"outcome" => "success",
"result" => {
"configured-application" => true,
"default-application" => false,
"applies-to" => {"/subsystem=logging/logging-profile=*" =>
undefined}
}
}
IMPORTANT
Application resource constraints apply to all resources that match its configuration. For
example, it is not possible to grant a Deployer user access to one datasource resource
but not another. If this level of separation is required then it is recommended to configure
the resources in different server groups and create different scoped Deployer roles for
each group.
124
CHAPTER 3. SECURING USERS OF THE SERVER AND ITS MANAGEMENT INTERFACES
You can see a list of the available application resource constraints directly from the JBoss EAP
management model using the following management CLI command:
/core-service=management/access=authorization/constraint=application-
classification:read-resource(include-runtime=true,recursive=true)
By default, reading and writing vault expressions are sensitive operations. Configuring the vault
expression constraint allows either or both of those operations to be set to nonsensitive. Changing this
constraint allows a greater number of roles to read and write vault expressions.
To configure the vault expression constraint, use the write-attribute operation to set the attributes
of configured-requires-write and configured-requires-read to true or false. By default
these are not set and the values of default-requires-read and default-requires-write are
used. The default values cannot be changed.
/core-service=management/access=authorization/constraint=vault-
expression:write-attribute(name=configured-requires-write,value=false)
Example: Result
/core-service=management/access=authorization/constraint=vault-
expression:read-resource
{
"outcome" => "success",
"result" => {
"configured-requires-read" => undefined,
"configured-requires-write" => false,
"default-requires-read" => true,
"default-requires-write" => true
}
}
The roles, and the respective vault expressions that they will be able to read and write, depend on the
configuration of the attributes. This is summarized in the following table:
125
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
126
CHAPTER 4. SECURELY STORING CREDENTIALS
Credential Store - Introduced in JBoss EAP 7.1, a credential store can safely secure sensitive
and plain text strings by encrypting them in a storage file. Each JBoss EAP server can contain
multiple credential stores.
Password Vault - Primarily used in legacy configurations, a password vault uses a Java Keystore
to store sensitive strings outside of the configuration files. Each JBoss EAP server can only
contain a single password vault.
If you decide to place plaintext passwords in the configuration files, then these files should only be
accessible by limited users. At a minimum, the user account under which JBoss EAP 7 is running
requires read-write access.
Using a credential store is preferred to using a password vault to store passwords and other sensitive
strings. Credential stores allow for easier credential management within the JBoss EAP management
CLI, without having to use an external tool. You can also use multiple credential stores within a JBoss
EAP server, compared to the limitation of only one password vault per JBoss EAP server.
The default credential store implementation uses a JCEKS keystore file to store credentials. When
creating a new credential store, the default implementation also allows you to reference an existing
keystore file or have JBoss EAP automatically create one for you. Currently, the default implementation
only allows you to store clear text passwords.
IMPORTANT
The elytron subsystem does not provide any checks for using the same file as storage
to multiple credential stores. It is strongly advised not to use the same file for multiple
credential stores or even to share the storage file using remote file systems.
If you need to use shared storage file, be sure to set the read-only flag on the
credential stores accessing it. This will prevent the file from being modified. After the file is
updated from outside, each credential store has to be reloaded to reflect the changed
values. A similar process needs to be followed when using credential stores in a managed
domain.
Since a credential store contains sensitive information, the directory containing the store
should be accessible to only limited users. At a minimum the user account under which
JBoss EAP is running requires read-write access.
127
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
JBoss EAP reads the credential store file into memory and writes changes to it at varying
times. You must ensure that the user running the JBoss EAP process has permissions to
the store file, and that you do not externally modify the store file while JBoss EAP is
running.
If the file is modified externally, you can use the reload() operation on the credential
store to make JBoss EAP reload the content of the store file.
IMPORTANT
JCEKS keystore implementations differ between Java vendors, so the JBoss EAP
instance must run a JDK from the same vendor that generated the JCEKS keystore.
Like providing paths in other JBoss EAP configuration, you can also use the relative-to attribute to
provide a path relative to another.
/subsystem=elytron/credential-
store=STORE_NAME:add(location="path/to/store_file", credential-reference=
{clear-text=STORE_PASSWORD},create=true)
For example, the following command creates a new store named my_store, and creates the file
jboss.server.data.dir/cred_stores/my_store.jceks:
/subsystem=elytron/credential-
store=my_store:add(location="cred_stores/my_store.jceks", relative-
to=jboss.server.data.dir, credential-reference={clear-
text=supersecretstorepassword},create=true)
NOTE
If you want to use an implementation other than default, you can explicitly define the
type of a credential store. For more information, see the section on using a custom
credential store implementation.
/profile=PROFILE_NAME/subsystem=elytron/credential-
store=STORE_NAME:add(location=path/to/store_file,credential-reference=
{clear-text="STORE_PASSWORD"},create=true)
128
CHAPTER 4. SECURELY STORING CREDENTIALS
For example, the following command creates a new store named my_store, and creates the file
jboss.server.data.dir/cred_stores/my_store.jceks:
/profile=full/subsystem=elytron/credential-store=my_store:add(relative-
to=jboss.server.data.dir,location="cred_stores/my_store.jceks",credential-
reference={clear-text=supersecretstorepassword},create=true)
NOTE
There is no need to define a credential store resource at each server. Every server
running the same profile, for which the credential store is created, contains our credential
store. Therefore, it is good idea to locate the storage file at the server data directory,
relative-to=jboss.server.data.dir.
For another way of creating a credential store in a managed domain, see Using Credential Stores in a
Managed Domain.
NOTE
Credential store aliases are case insensitive by default. Any stored alias is displayed in
lowercase, and may be referenced using any combination of uppercase and lowercase
letters.
If a custom credential store is used, then case sensitivity will be determined by the custom
implementation.
/subsystem=elytron/credential-store=STORE_NAME:add-alias(alias=ALIAS,
secret-value="SENSITIVE_STRING")
For example, to add a password with the alias database-pw to the store created in the previous
section:
/subsystem=elytron/credential-store=my_store:add-alias(alias=database-pw,
secret-value="speci@l_db_pa$$_01")
3. Select Security - Elytron and click on View. You can edit your credential store aliases here.
129
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
reference attribute in your JBoss EAP configuration. You can use credential-reference as an
alternative to providing a password or other sensitive string in most places throughout the JBoss EAP
configuration.
credential-reference={store=STORE_NAME, alias=ALIAS}
For example, to create a new datasource using the password that was added to the credential store in
the previous example, you can use credential-reference like the following:
/subsystem=datasources/data-source=my_DS:read-resource()
{
"outcome" => "success",
"result" => {
...
"credential-reference" => {
"store" => "my_store",
"alias" => "database-pw"
},
...
"password" => undefined,
...
}
}
/subsystem=elytron/credential-store=STORE_NAME:read-aliases()
For example:
/subsystem=elytron/credential-store=my_store:read-aliases()
{
"outcome" => "success",
"result" => [
"database-pw"
]
}
130
CHAPTER 4. SECURELY STORING CREDENTIALS
You can remove a credential from a credential store using the following command:
/subsystem=elytron/credential-store=STORE_NAME:remove-alias(alias=ALIAS)
For example:
/subsystem=elytron/credential-store=my_store:remove-alias(alias=database-
pw)
4.1.6. Obtain the Master Password for the Credential Store from an External
Source
Instead of providing your credential store’s master password in the clear, you can choose to provide that
password using a pseudo credential store. You have the following options:
EXT
External command using java.lang.Runtime#exec(java.lang.String). If parameters are
needed, they are supplied using a space-separated list of strings. An external command refers to any
executable from the operation system, for example a shell script or an executable binary. The
password is read from the standard output of the executed command.
Example
CMD
External command using java.lang.ProcessBuilder. If parameters are needed, they are
supplied using a comma-separated list of strings. An external command refers to any executable from
the operation system, for example a shell script or an executable binary. The password is read from
the standard output of the executed command.
Example
{CMD}/usr/bin/getTheMasterPassswordScript.sh par1,par2
MASK
Masked password using PBE, or Password Based Encryption. It must be in the following format,
which includes the SALT and ITERATION values:
MASK-MASKED_VALUE;SALT;ITERATION
Example
MASK-NqMznhSbL3lwRpDmyuqLBW==;12345678;123
131
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
EXT, CMD, and MASK provide backward compatibility with the legacy security vault style of
supplying an external password. For MASK you must use the above format that includes
the SALT and ITERATION values.
You can also use a password located in another credential store as the master password for a new
credential store.
Example Credential Store Created with a Password from Another Credential Store
/subsystem=elytron/credential-
store=exampleCS:add(location="cred_stores/exampleCS.jceks", relative-
to=jboss.server.data.dir, create=true, credential-reference={store=master-
cred-store, alias=master-pw})
2. Create an external credential store. An external credential store holds a secret key in a
PKCS#11 keystore, and accesses this keystore using the alias defined in the previous step. This
keystore is then used to decrypt the credentials in a JCEKS keystore. In addition to the
credential-store attributes, the credential-store KeyStoreCredentialStore
implementation properties are used to configure external credential stores.
/subsystem=elytron/credential-store=STORE_NAME:add(modifiable=true,
implementation-properties=
{"keyStoreType"=>"PKCS11","external"=>"true","keyAlias"=>"ALIAS",ext
ernalPath="/path/to/EXTERNAL_STORAGE"},credential-reference={clear-
text="STORE_PASSWORD"}, create=true)
3. Once created, the credential store can be used to store aliases as normal.
/subsystem=elytron/credential-store=STORE_NAME:add-
alias(alias="ALIAS", secret-value="SENSITIVE_STRING")
4. Confirm that the alias has been added successfully by reading from the credential store.
/subsystem=elytron/credential-store=STORE_NAME:read-aliases()
132
CHAPTER 4. SECURELY STORING CREDENTIALS
1. Create a class that extends the Service Provider Interface (SPI) CredentialStoreSpi
abstract class.
2. Create a class that implements the Java Security Provider. The provider must add the custom
credential store class as a service.
3. Create a module containing your credential store and provider classes, and add it to JBoss EAP
with a dependency on org.wildfly.security.elytron. For example:
/subsystem=elytron/provider-loader=myCustomLoader:add(class-names=
[org.wildfly.security.mycustomcredstore.CustomElytronProvider],modul
e=org.jboss.customcredstore)
NOTE
Ensure that you specify the correct providers and type values. The value of
type is what is used in your provider class where it adds your custom credential
store class as a service.
For example:
/subsystem=elytron/credential-
store=my_store:add(providers=myCustomLoader,type=CustomKeyStorePassw
ordStore,location="cred_stores/my_store.jceks",relative-
to=jboss.server.data.dir,credential-reference={clear-
text=supersecretstorepassword},create=true)
Alternatively, if you have created multiple providers, you can specify the additional providers
using another provider loader with other-providers. This allows you to have other additional
implementations for new types of credentials. These specified other providers are automatically
accessible in the custom credential store’s initialize method as the Provider[] argument.
For example:
/subsystem=elytron/credential-
store=my_store:add(providers=myCustomLoader,other-
providers=myCustomLoader2,type=CustomKeyStorePasswordStore,location=
"cred_stores/my_store.jceks",relative-
to=jboss.server.data.dir,credential-reference={clear-
text=supersecretstorepassword},create=true)
4.1.9. Create and Modify Credential Stores Offline with the WildFly Elytron Tool
You can use the WildFly Elytron tool, which you access using the elytron-tool script located in
EAP_HOME/bin/, to create and modify a credential store for an offline, or stopped, JBoss EAP server.
133
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
JCEKS keystore implementations differ between Java vendors, so the JBoss EAP
instance must run a JDK from the same vendor that generated the JCEKS keystore.
IMPORTANT
Using the WildFly Elytron tool to modify a credential store that is in use by a running
JBoss EAP server can result in changes to the store being lost. Instead, you should
create and modify credential stores for a running server by using the management CLI, as
described in the previous sections.
The following commands are shown using elytron-tool.sh for Red Hat Enterprise Linux and Solaris
systems. For Windows Server systems, use the elytron-tool.bat script instead.
For example:
If you do not want to provide your store password in the command, you can omit that argument and you
will be prompted to enter the password manually using standard input. You can also use a masked
password generated by the WildFly Elytron tool for the store password.
For example:
Similar to providing the credential store password, if you do not want to provide your secret in the
command, you can omit that argument and you will be prompted to enter the secret manually using
standard input.
List All the Credentials in the Credential Store Using the WildFly Elytron Tool
List the credentials in a credential store using the WildFly Elytron tool with the following command:
134
CHAPTER 4. SECURELY STORING CREDENTIALS
For example:
Check If an Alias Exists in the Credential Store Using the Wildfly Elytron Tool
Check if an alias exists in a credential store using the WildFly Elytron tool with the following command:
For example:
Remove a Credential from the Credential Store Using the WildFly Elytron Tool
Remove a credential from a credential store using the WildFly Elytron tool with the following command:
For example:
Add a Credential Store Created with the WildFly Elytron Tool to a JBoss EAP Server
After you have created a credential store with the WildFly Elytron tool, add it to your running JBoss EAP
server with the following management CLI command:
/subsystem=elytron/credential-
store=STORE_NAME:add(location="path/to/store_file",credential-reference=
{clear-text=STORE_PASSWORD})
For example:
/subsystem=elytron/credential-
store=my_store:add(location="../cred_stores/my_store.jceks",credential-
reference={clear-text=supersecretstorepassword})
After adding the credential store to the JBoss EAP configuration, you can then refer to a password or
sensitive string stored in the credential store using the credential-reference attribute.
135
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
4.1.9.1. Generate Masked Encrypted Strings Using the WildFly Elytron Tool
You can use the WildFly Elytron tool to generate PicketBox-compatible MASK- encrypted strings to use
instead of a plain text password for a credential store.
To generate a masked string, use the following command and provide values for the salt and the iteration
count:
For example:
MASK-8VzWsSNwBaR676g8ujiIDdFKwSjOBHCHgnKf17nun3v;12345678;123
If you do not want to provide the secret in the command, you can omit that argument and you will be
prompted to enter the secret manually using standard input.
For more information, use the EAP_HOME/bin/elytron-tool.sh mask --help command for a
detailed listing of available options.
4.1.9.2. Convert a Password Vault to a Credential Store Using the WildFly Elytron Tool
You can use the WildFly Elytron tool to convert a password vault to a credential store. To convert a
password vault to a credential store, you need the vault’s values used when initializing the vault.
NOTE
When converting a password vault, aliases in the new credential store are named in the
following format based on their equivalent password vault block and attribute name:
VAULT_BLOCK::ATTRIBUTE_NAME.
For example, you can also specify the new credential store’s file name and location with the --
location argument:
136
CHAPTER 4. SECURELY STORING CREDENTIALS
NOTE
You can also use the --summary argument to print a summary of the management CLI
commands used to convert it. Note that even if a plain text password is used, it is masked
in the summary output. The default SALT and ITERATION values are used unless they
are specified in the command.
1. Put the details of the vaults you want to convert into a description file in the following format:
keystore:path/to/vault_file
keystore-password:VAULT_PASSWORD
enc-dir:path/to/vault_directory
salt:SALT 1
iteration:ITERATION_COUNT
location:path/to/converted_cred_store 2
alias:VAULT_ALIAS
properties:PARAMETER1=VALUE1;PARAMETER2=VALUE2; 3
1 salt and iteration can be omitted if you are providing a plain text password for the
vault.
2 Specifies the location and file name for the converted credential store.
For example:
keystore:/vaults/vault1/vault1.keystore
keystore-password:vault11
enc-dir:/vaults/vault1/
salt:1234abcd
iteration:120
location:/cred_stores/vault1_converted.cred_store
alias:my_vault
keystore:/vaults/vault2/vault2.keystore
keystore-password:vault22
enc-dir:/vaults/vault2/
salt:abcd1234
iteration:130
location:/cred_stores/vault2_converted.cred_store
alias:my_vault2
2. Run the bulk convert command with your description file from the previous step:
137
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
For more information, use the EAP_HOME/bin/elytron-tool.sh vault --help command for a
detailed listing of available options.
The following example shows you how to use a credential store in an Elytron Client configuration file.
<configuration>
<authentication-client xmlns="urn:elytron:1.0.1">
...
<credential-stores>
<credential-store name="my_store"> 1
<protection-parameter-credentials>
<credential-store-reference clear-text="pass123"/> 2
</protection-parameter-credentials>
<attributes>
<attribute name="location" value="/path/to/my_store.jceks"/> 3
</attributes>
</credential-store>
</credential-stores>
...
<authentication-configurations>
<configuration name="my_user">
<set-host name="localhost"/>
<set-user-name name="my_user"/>
<set-mechanism-realm name="ManagementRealm"/>
<use-provider-sasl-factory/>
<credentials>
<credential-store-reference store="my_store" alias="my_user"/>
4
</credentials>
</configuration>
</authentication-configurations>
...
</authentication-client>
</configuration>
1 A name for the credential store for use within the Elytron Client configuration file.
See the JBoss EAP How to Configure Identity Management Guide for more information on configuring
client authentication using Elytron Client.
138
CHAPTER 4. SECURELY STORING CREDENTIALS
1. Use the WildFly Elytron Tool to prepare the credential store. For more information on this, see
Create and Modify Credential Stores Offline with the WildFly Elytron Tool.
2. Distribute the created credential store storage file. For example, distribute it to each server, for
example by using scp, or store it in NFS and use it for all the created credential stores.
3. You can then create a credential store with the create property set to false, using the already
created file.
/profile=full/subsystem=elytron/credential-store=test:add(relative-
to=jboss.server.data.dir,location="store.keystore",credential-
reference={clear-text="secret2"},create=false)
NOTE
When using one credential store to store all credential stores, when storing it on
NFS, you must use the credential store in read-only mode. The read-only
mode is used to maintain consistency. It is also prefered to use an absolute path
in this case.
/profile=full/subsystem=elytron/credential-
store=test:add(location=/absolute/path/to/store.keystore,
credential-reference={clear-
text="secret2"},create=false,modifiable=false)
For other ways of creating a credential store in a managed domain, see Create a Credential Store in a
Managed Domain.
The password vault uses the Java keystore as its storage mechanism. Password vault consists of two
parts: storage and key storage. Java keystore is used to store the key, which is used to encrypt or
decrypt sensitive strings in Vault storage.
139
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
IMPORTANT
The keytool utility, provided by the Java Runtime Environment (JRE), is utilized for this
steps. Locate the path for the file, which on Red Hat Enterprise Linux is
/usr/bin/keytool.
JCEKS keystore implementations differ between Java vendors so the keystore must be
generated using the keytool utility from the same vendor as the JDK used. Using a
keystore generated by the keytool from one vendor’s JDK in a JBoss EAP 7 instance
running on a JDK from a different vendor results in the following exception:
java.io.IOException:
com.sun.crypto.provider.SealedObjectForKeyProtector
alias
The alias is a unique identifier for the vault or other data stored in the keystore. Aliases are
case-insensitive.
storetype
The storetype specifies the keystore type. The value jceks is recommended.
keyalg
The algorithm to use for encryption. Use the documentation for the JRE and operating
system to see which other choices are available.
keysize
The size of an encryption key impacts how difficult it is to decrypt through brute force. For
information on appropriate values, see the documentation distributed with the keytool utility.
storepass
The value of storepass is the password that is used to authenticate to the keystore so that the
key can be read. The password must be at least 6 characters long and must be provided
when the keystore is accessed. If this parameter is omitted, the keytool utility will prompt for it
to be entered after the command has been executed
keypass
The value of keypass is the password used to access the specific key and must match the
value of the storepass parameter.
validity
The value of validity is the period (in days) for which the key will be valid.
keystore
The value of keystore is the file path and file name in which the keystore’s values are to be
stored. The keystore file is created when data is first added to it. Ensure the correct file path
140
CHAPTER 4. SECURELY STORING CREDENTIALS
separator is used: / (forward slash) for Red Hat Enterprise Linux and similar operating
systems, \ (backslash) for Windows Server.
The keytool utility has many other options. See the documentation for the JRE or the
operating system for more details.
3. Run the keytool command, ensuring keypass and storepass contain the same value.
141
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
To run the password vault command non-interactively, the vault script located in EAP_HOME/bin/ can
be invoked with parameters for the relevant information:
Example: Output
=========================================================================
JBoss Vault
JBOSS_HOME: EAP_HOME
JAVA: java
=========================================================================
</extensions>
<vault>
<vault-option name="KEYSTORE_URL"
value="EAP_HOME/vault/vault.keystore"/>
<vault-option name="KEYSTORE_PASSWORD" value="MASK-5dOaAVafCSd"/>
<vault-option name="KEYSTORE_ALIAS" value="vault"/>
<vault-option name="SALT" value="1234abcd"/>
<vault-option name="ITERATION_COUNT" value="120"/>
<vault-option name="ENC_FILE_DIR" value="EAP_HOME/vault/"/>
</vault><management> ...
********************************************
142
CHAPTER 4. SECURELY STORING CREDENTIALS
To run the password vault command interactively, the following steps are required:
143
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
+ The keystore password has been masked for use in configuration files and deployments. In addition,
the vault is initialized and ready to use.
The following command can be used to configure JBoss EAP 7 to use the password vault:
/core-service=vault:add(vault-options=[("KEYSTORE_URL" =>
PATH_TO_KEYSTORE),("KEYSTORE_PASSWORD" => MASKED_PASSWORD),
("KEYSTORE_ALIAS" => ALIAS),("SALT" => SALT),("ITERATION_COUNT" =>
ITERATION_COUNT),("ENC_FILE_DIR" => ENC_FILE_DIR)])
/core-service=vault:add(vault-options=[("KEYSTORE_URL" =>
"EAP_HOME/vault/vault.keystore"),("KEYSTORE_PASSWORD" => "MASK-
5dOaAVafCSd"),("KEYSTORE_ALIAS" => "vault"),("SALT" => "1234abcd"),
("ITERATION_COUNT" => "120"),("ENC_FILE_DIR" => "EAP_HOME/vault/")])
NOTE
If Microsoft Windows Server is being used, use two backslashes (\\) in the file path instead
using one. For example, C:\\data\\vault\\vault.keystore. This is because a
single backslash character (\) is used for character escaping.
Sensitive strings can be stored in the Password Vault either interactively, where the tool prompts for
each parameter’s value, or non-interactively, where all the parameters' values are provided on the
command line. Each method gives the same result, so either may be used. Both of these methods are
invoked using the vault script.
To run the password vault command non-interactively, the vault script (located in EAP_HOME/bin/)
can be invoked with parameters for the relevant information:
NOTE
The keystore password must be given in plaintext form, not masked form.
144
CHAPTER 4. SECURELY STORING CREDENTIALS
Example: Output
=========================================================================
JBoss Vault
JBOSS_HOME: EAP_HOME
JAVA: java
=========================================================================
After invoking the vault script, a message prints to standard output, showing the vault block, attribute
name, masked string, and advice about using the string in your configuration. Make note of this
information in a secure location. An extract of sample output is as follows:
Vault Block:vb
Attribute Name:password
Configuration should be done as follows:
VAULT::vb::password::1
To run the password vault command interactively, the following steps are required:
145
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Follow the prompts to input the required parameters. These values must match those provided
when the Password Vault was created.
NOTE
The keystore password must be given in plaintext form, not masked form.
Vault Block:ds_Example1
Attribute Name:password
Configuration should be done as follows:
VAULT::ds_Example1::password::1
=========================================================================
JBoss Vault
JBOSS_HOME: EAP_HOME
JAVA: java
=========================================================================
**********************************
**** JBoss Vault ***************
**********************************
Please enter a Digit:: 0: Start Interactive Session 1: Remove
Interactive Session 2: Exit
0
Starting an interactive session
Enter directory to store encrypted files:EAP_HOME/vault/
Enter Keystore URL:EAP_HOME/vault/vault.keystore
Enter Keystore password:
Enter Keystore password again:
Values match
Enter 8 character salt:1234abcd
Enter iteration count as a number (Eg: 44):120
Enter Keystore Alias:vault
Initializing Vault
Nov 09, 2015 9:24:36 PM org.picketbox.plugins.vault.PicketBoxSecurityVault
init
INFO: PBOX000361: Default Security Vault Implementation Initialized and
Ready
Vault Configuration in AS7 config file:
********************************************
...
146
CHAPTER 4. SECURELY STORING CREDENTIALS
</extensions>
<vault>
<vault-option name="KEYSTORE_URL"
value="EAP_HOME/vault/vault.keystore"/>
<vault-option name="KEYSTORE_PASSWORD" value="MASK-5dOaAVafCSd"/>
<vault-option name="KEYSTORE_ALIAS" value="vault"/>
<vault-option name="SALT" value="1234abcd"/>
<vault-option name="ITERATION_COUNT" value="120"/>
<vault-option name="ENC_FILE_DIR" value="EAP_HOME/vault/"/>
</vault><management> ...
********************************************
Vault is initialized and ready for use
Handshake with Vault complete
Please enter a Digit:: 0: Store a secured attribute 1: Check whether a
secured attribute exists 2: Remove secured attribute 3: Exit
0
Task: Store a secured attribute
Please enter secured attribute value (such as password):
Please enter secured attribute value (such as password) again:
Values match
Enter Vault Block:ds_Example1
Enter Attribute Name:password
Secured attribute value has been stored in vault.
Please make note of the following:
********************************************
Vault Block:ds_Example1
Attribute Name:password
Configuration should be done as follows:
VAULT::ds_Example1::password::1
********************************************
Please enter a Digit:: 0: Store a secured attribute 1: Check whether a
secured attribute exists 2: Remove secured attribute 3: Exit
To confirm if expressions are allowed within a particular subsystem, run the following management CLI
command against that subsystem:
/subsystem=SUBSYSTEM:read-resource-description(recursive=true)
From the output of running this command, look for the value of the expressions-allowed parameter.
If this is true, then expressions can be used within the configuration of this subsystem.
Use the following syntax to replace any plaintext string with the masked form.
${VAULT::VAULT_BLOCK::ATTRIBUTE_NAME::MASKED_STRING}
...
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
147
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS"
enabled="true" use-java-context="true" pool-name="H2DS">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-
url>
<driver>h2</driver>
<pool></pool>
<security>
<user-name>sa</user-name>
<password>${VAULT::ds_ExampleDS::password::1}</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-
datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
...
@DataSourceDefinition(
name = "java:jboss/datasources/LoginDS",
user = "sa",
password = "VAULT::DS::thePass::1",
className = "org.h2.jdbcx.JdbcDataSource",
url = "jdbc:h2:tcp://localhost/mem:test"
)
/*old (plaintext) definition
@DataSourceDefinition(
name = "java:jboss/datasources/LoginDS",
user = "sa",
password = "sa",
className = "org.h2.jdbcx.JdbcDataSource",
url = "jdbc:h2:tcp://localhost/mem:test"
)*/
This check can be done either interactively, where the user is prompted for each parameter’s value, or
non-interactively, where all parameters' values are provided on the command line. Each method gives
the same result, so either may be used. Both of these methods are invoked using the vault script.
148
CHAPTER 4. SECURELY STORING CREDENTIALS
Use the non-interative method to provide all parameters' values at once. For a description of all
parameters, see Initialize the Password Vault. To run the password vault command non-interactively, the
vault script located in EAP_HOME/bin/ can be invoked with parameters for the relevant information:
Substitute the placeholder values with the actual values. The values for parameters KEYSTORE_URL,
KEYSTORE_PASSWORD and KEYSTORE_ALIAS must match those provided when the password vault
was created.
NOTE
The keystore password must be given in plaintext form, not masked form.
If the sensitive string is stored in the vault block specified, the following message will be displayed:
If the value is not stored in the specified block, the following message will be displayed:
To run the password vault command interactively, the following steps are required:
2. Complete the prompted parameters. Follow the prompts to input the required authentication
parameters. These values must match those provided when the password vault was created.
NOTE
Enter the name of the vault block in which the sensitive string is stored.
If the sensitive string is stored in the vault block specified, a confirmation message like the following will
be output:
If the sensitive string is not stored in the specified block, a message like the following will be output:
149
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
=========================================================================
JBoss Vault
JBOSS_HOME: EAP_HOME
JAVA: java
=========================================================================
**********************************
**** JBoss Vault ***************
**********************************
Please enter a Digit:: 0: Start Interactive Session 1: Remove
Interactive Session 2: Exit
0
Starting an interactive session
Enter directory to store encrypted files:EAP_HOME/vault
Enter Keystore URL:EAP_HOME/vault/vault.keystore
Enter Keystore password:
Enter Keystore password again:
Values match
Enter 8 character salt:1234abcd
Enter iteration count as a number (Eg: 44):120
Enter Keystore Alias:vault
Initializing Vault
Nov 09, 2015 9:24:36 PM org.picketbox.plugins.vault.PicketBoxSecurityVault
init
INFO: PBOX000361: Default Security Vault Implementation Initialized and
Ready
Vault Configuration in AS7 config file:
********************************************
...
</extensions>
<vault>
<vault-option name="KEYSTORE_URL"
value="EAP_HOME/vault/vault.keystore"/>
<vault-option name="KEYSTORE_PASSWORD" value="MASK-5dOaAVafCSd"/>
<vault-option name="KEYSTORE_ALIAS" value="vault"/>
<vault-option name="SALT" value="1234abcd"/>
<vault-option name="ITERATION_COUNT" value="120"/>
<vault-option name="ENC_FILE_DIR" value="EAP_HOME/vault/"/>
</vault><management> ...
********************************************
Vault is initialized and ready for use
Handshake with Vault complete
Please enter a Digit:: 0: Store a secured attribute 1: Check whether a
secured attribute exists 2: Remove secured attribute 3: Exit
1
Task: Verify whether a secured attribute exists
Enter Vault Block:vb
Enter Attribute Name:password
A value exists for (vb, password)
Please enter a Digit:: 0: Store a secured attribute 1: Check whether a
secured attribute exists 2: Remove secured attribute 3: Exit
150
CHAPTER 4. SECURELY STORING CREDENTIALS
IMPORTANT
As a prerequisite, before removing a sensitive string from the Password Vault, confirm if it
is used in the configuration of JBoss EAP.
This operation can be done either interactively, where the user is prompted for each parameter’s value,
or non-interactively, where all parameters' values are provided on the command line. Each method gives
the same result, so either may be used. Both of these methods are invoked using the vault script.
Use the non-interative method to provide all parameters' values at once. For a description of all
parameters, see Initialize the Password Vault. To run the password vault command non-interactively, the
vault script (located in EAP_HOME/bin/) can be invoked with parameters for the relevant information:
Substitute the placeholder values with the actual values. The values for parameters KEYSTORE_URL,
KEYSTORE_PASSWORD and KEYSTORE_ALIAS must match those provided when the password
Vault was created.
NOTE
The keystore password must be given in plaintext form, not masked form.
If the sensitive string is successfully removed, a confirmation message like the following will be
displayed:
If the sensitive string is not removed, a message like the following will be displayed:
Example: Output
151
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
NOTE
Enter the name of the vault block in which the sensitive string is stored.
If the sensitive string is successfully removed, a confirmation message like the following will be
displayed:
If the sensitive string is not removed, a message like the following will be displayed:
Example: Output
**********************************
**** JBoss Vault ***************
**********************************
Please enter a Digit:: 0: Start Interactive Session 1: Remove
Interactive Session 2: Exit
0
Starting an interactive session
Enter directory to store encrypted files:EAP_HOME/vault/
Enter Keystore URL:EAP_HOME/vault/vault.keystore
Enter Keystore password:
Enter Keystore password again:
Values match
152
CHAPTER 4. SECURELY STORING CREDENTIALS
4.2.9. Configure Red Hat JBoss Enterprise Application Platform to Use a Custom
Implementation of the Password Vault
In addition to using the provided password vault implementation, a custom implementation of
SecurityVault can also be used.
IMPORTANT
As a prerequisite, ensure that the password vault has been initialized. For more
information, see Initialize the Password Vault.
2. Create a module containing the class from the previous step, and specify a dependency on
org.picketbox where the interface is SecurityVault.
3. Enable the custom password vault in the JBoss EAP configuration by adding the vault element
with the following attributes:
153
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
module - The name of the module that contains the custom class.
Optionally, the vault-options parameters can be used to initialize the custom class for a password
vault.
/core-
service=vault:add(code="custom.vault.implementation.CustomSecurityVault",
module="custom.vault.module", vault-options=[("KEYSTORE_URL" =>
PATH_TO_KEYSTORE),("KEYSTORE_PASSWORD" => MASKED_PASSWORD),
("KEYSTORE_ALIAS" => ALIAS),("SALT" => SALT),("ITERATION_COUNT" =>
ITERATION_COUNT),("ENC_FILE_DIR" => ENC_FILE_DIR)])
{EXT}…
Refers to the exact command, where the … is the exact command. For example:
{EXT}/usr/bin/getmypassword --section 1 --query company, run the
/usr/bin/getmypassword command, which displays the password on standard output and use it
as password for Security Vault’s keystore. In this example, the command is using two options: --
section 1 and --query company.
{EXTC[:expiration_in_millis]}…
Refers to the exact command, where the … is the exact command line that is passed to the
Runtime.exec(String) method to execute a platform command. The first line of the command
output is used as the password. EXTC variant caches the passwords for expiration_in_millis
milliseconds. Default cache expiration is 0 = infinity. For example:
{EXTC:120000}/usr/bin/getmypassword --section 1 --query company verifies if the
cache contains /usr/bin/getmypassword output, if it contains the output then use it. If it does not
contain the output, run the command to output it to cache and use it. In this example, the cache
expires in 2 minutes, that is 120000 milliseconds.
{CMD}… or {CMDC[:expiration_in_millis]}…
The general command is a string delimited by , (comma) where the first part is the actual command
and further parts represents the parameters. The comma can be backslashed to keep it as a part of
the parameter. For example, {CMD}/usr/bin/getmypassword,--section,1,--
query,company.
{CLASS[@jboss_module_spec]}classname[:ctorargs]
Where the [:ctorargs] is an optional string delimited by the : (colon) from the classname is
passed to the classname ctor. The ctorargs is a comma delimited list of strings. For example,
{[email protected]}org.test.passwd.ExternamPassworProvider. In this example,
the org.test.passwd.ExternamPassworProvider class is loaded from org.test.passwd
module and uses the toCharArray() method to get the password. If toCharArray() is not
available the toString() method is used. The org.test.passwd.ExternamPassworProvider
class must have the default constructor.
154
CHAPTER 5. JAVA SECURITY MANAGER
IMPORTANT
Previous versions of JBoss EAP defined policies using an external file, e.g.
EAP_HOME/bin/server.policy. JBoss EAP 7 defines Java Security Policies in two
ways: the security-manager subsystem and through XML files in the individual
deployments. The security-manager subsystem defines minimum and maximum
permission for ALL deployments, while the XML files specify the permissions requested
by the individual deployment.
/subsystem=security-manager/deployment-permissions=default:write-
attribute(name=minimum-permissions, value=
[{class="java.util.PropertyPermission", actions="read", name="*"}])
/subsystem=security-manager/deployment-permissions=default:write-
attribute(name=maximum-permissions, value=
[{class="java.util.PropertyPermission", actions="read,write", name="*"},
{class="java.io.FilePermission", actions="read,write", name="/-"}])
NOTE
155
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
You can find a full reference of the security-manager subsystem in the JBoss EAP Configuration
Guide.
The Java EE 7 specification dictates that permissions.xml cover the entire application or top-level
deployment module. In cases where you wish to define specific permissions for a subdeployment, you
can use the JBoss EAP-specific META-INF/jboss-permissions.xml. It follows the same exact
format as permissions.xml and will apply only to the deployment module in which it is declared.
<permissions version="7">
<permission>
<class-name>java.util.PropertyPermission</class-name>
<name>*</name>
<actions>read</actions>
</permission>
</permissions>
permission
The qualified class name of the permission to grant.
name
The permission name to provide to the permission class constructor.
actions
The (optional) list of actions, required by some permission types.
156
CHAPTER 5. JAVA SECURITY MANAGER
</permissions>
...
</module>
If the <permissions> element is present, the module will be restricted to only the permissions you
have listed. If the <permissions> element is not present, there will be no restrictions on the module.
IMPORTANT
Previous version of JBoss EAP allowed for the use of the -Djava.security.manager
Java system property as well as custom security managers. Neither of these are
supported in JBoss EAP 7. In addition, the Java Security Manager policies are now
defined within the security-manager subsystem, meaning external policy files and the
-Djava.security.policy Java system property are not supported JBoss EAP 7.
IMPORTANT
Before starting JBoss EAP with the Java Security Manager enabled, you need make sure
all security policies are defined in the security-manager subsystem.
To run JBoss EAP with the Java Security Manager, you need to use the secmgr option during startup.
There are two ways to do this:
Use the flag with the startup script To use the -secmgr flag with the startup script, include it
when starting up your JBoss EAP instance:
./standalone.sh -secmgr
IMPORTANT
The domain or standalone server must be completely stopped before you edit
any configuration files.
NOTE
If you are using JBoss EAP in a managed domain, you must perform the
following procedure on each physical host or instance in your domain.
To enable the Java Security Manager using the startup configuration file, you need to edit either
the standalone.conf or domain.conf file, depending if you are running a standalone
instance or managed domain. If running in Windows, the standalone.conf.bat or
domain.conf.bat files are used instead.
157
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
158
APPENDIX A. REFERENCE MATERIAL
Attribute Description
Attribute Description
Attribute Description
Attribute Description
Attribute Description
Attribute Description
Attribute Description
159
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
authorization-realm Reference to the security realm to use for loading the identity for
authorization steps.
Attribute Description
Attribute Description
Attribute Description
credential-reference The credential to use for authentication. This can be in clear text
or as a reference to a credential stored in a credential-
store.
160
APPENDIX A. REFERENCE MATERIAL
Attribute Description
Attribute Description
Attribute Description
161
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
Attribute Description
maximum-age The time in milliseconds that an item can stay in the cache. A
value of -1 keeps items indefinitely. This defaults to -1.
Attribute Description
Attribute Description
cipher-suite-filter The filter to apply to specify the enabled cipher suites. This filter
takes a list of items delimited by colons, commas, or spaces.
Each item may be a OpenSSL-style cipher suite name, a
standard SSL/TLS cipher suite name, or a keyword such as
TLSv1.2 or DES. A full list of keywords as well as additional
details on creating a filter can be found in the JavaDocs . The
default value is DEFAULT, which corresponds to all known
cipher suites that do not have NULL encryption and excludes
any cipher suites that have no authentication.
162
APPENDIX A. REFERENCE MATERIAL
Attribute Description
WARNING
provider-name The name of the provider to use. If not specified, all providers
from providers will be passed to the SSLContext.
Attribute Description
joiner The string that will be used to join the values in the
principal-decoders attribute.
Attribute Description
163
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
Attribute Description
enabling If true the filter will be enabled if the mechanism matches. This
defaults to true.
Attribute Description
protocol The protocol passed into the factory when creating the
mechanism.
server-name The server name passed into the factory when creating the
mechanism.
Attribute Description
enabling If true the filter will be enabled if the factory matches. This
defaults to true.
164
APPENDIX A. REFERENCE MATERIAL
Attribute Description
Attribute Description
Attribute Description
constant The constant value the principal decoder will always return.
Attribute Description
constant The constant value this principal transformer will always return.
Attribute Description
Attribute Description
165
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
other-providers The name of the providers to obtain the providers to search for
the one that can create the required JCA objects within the
credential store. This is valid only for keystore-based credential
store. If this is not specified, then the global list of providers is
used instead.
providers The name of the providers to obtain the providers to search for
the one that can create the required credential store type. If this
is not specified, then the global list of providers is used instead.
relative-to The base path this credential store path is relative to.
Attribute Description
Attribute Description
166
APPENDIX A. REFERENCE MATERIAL
Attribute Description
keyAlias The secret key alias within the credential store that is used to
encrypt or decrypt data to the external storage.
Attribute Description
configuration The optional key and value configuration for the custom security
factory.
Attribute Description
configuration The optional key and value configuration for the custom realm.
Attribute Description
configuration The optional key and value configuration for the permission
mapper.
167
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
Attribute Description
configuration The optional key and value configuration for the principal
decoder.
Attribute Description
configuration The optional key and value configuration for the principal
transformer.
Attribute Description
configuration The optional key and value configuration for the custom realm.
Attribute Description
configuration The optional key and value configuration for the realm mapper.
168
APPENDIX A. REFERENCE MATERIAL
Attribute Description
Attribute Description
configuration The optional key and value configuration for the role decoder.
Attribute Description
configuration The optional key and value configuration for the role mapper.
Attribute Description
169
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
module Name of module that will be used as the class loading base.
ssl-context The name of the SSL context used to secure connection to the
LDAP server.
Attribute Description
relative-to The predefined relative path to use with path. For example
jboss.server.config.dir .
Attribute Description
170
APPENDIX A. REFERENCE MATERIAL
Attribute Description
ALL:-alias1:-alias2
NONE:+alias1:+alias2
NOTE
Attribute Description
Attribute Description
mechanism-name This configuration will only apply where a mechanism with the
name specified is used. If this attribute is omitted then this will
match any mechanism name.
171
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
Attribute Description
Attribute Description
Attribute Description
172
APPENDIX A. REFERENCE MATERIAL
Attribute Description
bcrypt-mapper A key mapper that maps a column returned from a SQL query to
a Bcrypt key type.
clear-password-mapper A key mapper that maps a column returned from a SQL query to
a clear password key type. This has a password-index child
element that is the column index from an authentication query
that represents the user’s password.
salted-simple-digest-mapper A key mapper that maps a column returned from a SQL query to
a Salted Simple Digest key type.
scram-mapper A key mapper that maps a column returned from a SQL query to
a SCRAM key type.
simple-digest-mapper A key mapper that maps a column returned from a SQL query to
a Simple Digest key type.
sql The SQL statement used to obtain the keys as table columns for
a specific user and map them accordingly with their type.
Attribute Description
index The column index from a query that representing the mapped
attribute.
Attribute Description
173
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
Attribute Description
Attribute Description
Attribute Description
algorithm The algorithm for a specific password key mapper. The allowed
values are scram-sha-1 and scram-sha-256 . The default
value is scram-sha-256 .
174
APPENDIX A. REFERENCE MATERIAL
Attribute Description
Attribute Description
debug If true the JAAS step of obtaining the credential will have
debug logging enabled. Defaults to false.
mechanism-oids The list of mechanism OIDs the credential should be usable with.
175
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
alias-filter A filter to apply to the aliases returned from the keystore. This
can either be a comma-separated list of aliases to return or one
of the following formats:
ALL:-alias1:-alias2
NONE:+alias1:+alias2
Attribute Description
176
APPENDIX A. REFERENCE MATERIAL
Attribute Description
alias-filter A filter to apply to the aliases returned from the keystore, can
either be a comma separated list of aliases to return or one of
the following formats:
ALL:-alias1:-alias2
NONE:+alias1:+alias2
NOTE
provider-name The name of the provider to use to load the keystore. Setting this
attribute disables searching for the first provider that can create a
keystore of the specified type.
providers A reference to the providers that should be used to obtain the list
of provider instances to search. If not specified, the global list of
providers will be used instead.
relative-to The base path this store is relative to. This can be a full path or
predefined path such as jboss.server.config.dir .
type The type of the keystore, for example, JKS. A full list of keystore
types can be found in the Java Cryptography Architecture
Standard Algorithm Name Documentation for JDK 8.
Attribute Description
177
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
alias-attribute The name of LDAP attribute where the item alias will be stored.
certificate-attribute The name of LDAP attribute where the certificate will be stored.
certificate-chain-attribute The name of LDAP attribute where the certificate chain will be
stored.
filter-alias The LDAP filter for obtaining an item in the keystore by alias.
filter-iterate The LDAP filter for iterating over all items of the keystore.
key-attribute The name of LDAP attribute where the key will be stored.
new-item-template Configuration for item creation. This defines how the LDAP entry
of newly created keystore item will look.
search-path The path in LDAP where the keystore items will be searched.
search-time-limit The time limit in milliseconds for obtaining keystore items from
LDAP. Defaults to 10000.
Attribute Description
new-item-attributes The LDAP attributes which will be set for newly created items.
This takes a list of items with name and value pairs.
178
APPENDIX A. REFERENCE MATERIAL
Attribute Description
new-item-path The path in LDAP where the newly created keystore items will
be stored.
new-item-rdn The name of LDAP RDN for the newly created items.
Attribute Description
identity-mapping The configuration options that define how principals are mapped
to their corresponding entries in the underlying LDAP server.
Attribute Description
iterator-filter The LDAP filter for iterating over identities of the realm.
179
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
new-identity-attributes The list of attributes of newly created identities and is required for
modifiability of the realm. This is a list of name and value pair
objects.
Attribute Description
extract-rdn The RDN key to use as the value for an attribute, in case the
value in its raw form is in X.500 format.
filter The filter to use to obtain the values for a specific attribute.
filter-base-dn The name of the context where the filter should be performed.
180
APPENDIX A. REFERENCE MATERIAL
Attribute Description
Attribute Description
Attribute Description
Attribute Description
181
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
Attribute Description
Attribute Description
Attribute Description
pattern The regular expression which must contain at least one capture
group to extract the realm from the name.
182
APPENDIX A. REFERENCE MATERIAL
Attribute Description
filters The list of filters to apply when comparing the mechanisms from
the providers. A filter matches when all of the specified values
match the mechanism and provider pair.
Attribute Description
mechanism-name The name of the SASL mechanism this filter matches with.
version-comparison The equality to use when evaluating the Provider’s version. The
allowed values are less-than and greater-than. The
default value is less-than.
Attribute Description
groups-properties The properties file containing the users and their groups.
users-properties The properties file containing the users and their passwords.
Attribute Description
digest-realm-name The default realm name to use for digested passwords if one is
not discovered in the properties file.
183
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
path The path to the file containing the users and their passwords.
The file should contain realm name declaration.
Attribute Description
path The path to the file containing the users and their groups.
Attribute Description
providers The providers to use to locate the factories. If not specified, the
globally registered list of providers will be used.
Attribute Description
class-names The list of the fully qualified class names of providers to load.
These are loaded after the service-loader discovered providers,
and any duplicates will be skipped.
184
APPENDIX A. REFERENCE MATERIAL
Attribute Description
Attribute Description
providers The providers to use to locate the factories. If not specified, the
globally registered list of providers will be used.
Attribute Description
pattern The regular expression to use to locate the portion of the name
to be replaced.
Attribute Description
match If true the name must match the given pattern to make
validation successful. If false the name must not match the
given pattern to make validation successful. This defaults to
true.
Attribute Description
185
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
mechanism-name This configuration will only apply where a mechanism with the
name specified is used. If this attribute is omitted then this will
match any mechanism name.
Attribute Description
Attribute Description
186
APPENDIX A. REFERENCE MATERIAL
Attribute Description
cipher-suite-filter The filter to apply to specify the enabled cipher suites. This filter
takes a list of items delimited by colons, commas, or spaces.
Each item may be an OpenSSL-style cipher suite name, a
standard SSL/TLS cipher suite name, or a keyword such as
TLSv1.2 or DES. A full list of keywords as well as additional
details on creating a filter can be found in the JavaDocs . The
default value is DEFAULT, which corresponds to all known
cipher suites that do not have NULL encryption and excludes
any cipher suites that have no authentication.
WARNING
provider-name The name of the provider to use. If not specified, all providers
from providers will be passed to the SSLContext.
187
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
use-cipher-suites-order If true the cipher suites order defined on the server will be
used. If false the cipher suites order presented by the client
will be used. Defaults to true.
NOTE
The realm mapper and principal transformer attributes for a server-ssl-context apply
only for the SASL EXTERNAL mechanism, where the certificate is verified by the trust
manager. HTTP CLIENT-CERT authentication settings are configured in an http-
authentication-factory.
Attribute Description
module The module to use to obtain the class loader to load the
factories. If not specified the class loader to load the resource
will be used instead.
188
APPENDIX A. REFERENCE MATERIAL
Attribute Description
module The module to use to obtain the class loader to load the
factories. If not specified the class loader to load the resource
will be used instead.
Attribute Description
mapping-mode The mapping mode that should be used in the event of multiple
matches. Allowed values are, and, or, xor, unless , and
first. The default is first.
Attribute Description
Attribute Description
Attribute Description
189
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
pattern The regular expression which must contain at least one capture
group to extract the realm from the name.
Attribute Description
attribute The name of the attribute from the identity to map directly to
roles.
Attribute Description
principal-claim The name of the claim that should be used to obtain the
principal’s name. The default is username.
Attribute Description
certificate The name of the certificate with a public key to load from the
keystore.
key-store A keystore from where the certificate with a public key should be
loaded from.
190
APPENDIX A. REFERENCE MATERIAL
Attribute Description
Attribute Description
host-name-verification-policy A policy that defines how host names should be verified when
using HTTPS. The only allowed value is ANY.
Attribute Description
alias-filter A filter to apply to the aliases returned from the keystore. This
can either be a comma-separated list of aliases to return or one
of the following formats:
ALL:-alias1:-alias2
NONE:+alias1:+alias2
191
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
Attribute Description
Attribute Description
attribute-name The name of the X.500 attribute to map. This can also be
defined using the oid attribute.
convert When set to true, the principal decoder will attempt to convert
a principal to a X500Principal , if it is not already of that
type. If the conversion fails, the original value is used as the
principal.
oid The OID of the X.500 attribute to map. This can also be defined
using the attribute-name attribute.
required-attributes The list of attribute names of the attributes that must be present
in the principal
192
APPENDIX A. REFERENCE MATERIAL
Attribute Description
required-oids The list of OIDs of the attributes that must be present in the
principal.
start-segment The starting occurrence of the attribute you want to map. This
uses a zero-based index and the default value is 0 .
ANONYMOUS Supported
DIGEST-MD5 Supported
EXTERNAL Supported
GS2-KRB5 Supported
GS2-KRB5-PLUS Supported
GSSAPI Supported
OAUTHBEARER Supported
PLAIN Supported
193
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
SCRAM-SHA-1 Supported
SCRAM-SHA-1-PLUS Supported
SCRAM-SHA-256 Supported
SCRAM-SHA-256-PLUS Supported
SCRAM-SHA-384 Supported
SCRAM-SHA-384-PLUS Supported
SCRAM-SHA-512 Supported
SCRAM-SHA-512-PLUS Supported
Table A.94. SASL Properties Used During SASL Mechanism Negotiation or Authentication
Exchange
194
APPENDIX A. REFERENCE MATERIAL
195
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
wildfly.sasl.scram.min-iteration- Client, server The minimum iteration count to use for SCRAM. The
count default value is 4096.
wildfly.sasl.scram.max-iteration- Client, server The maximum iteration count to use for SCRAM. The
count default value is 32786.
196
APPENDIX A. REFERENCE MATERIAL
1. If the server keystore already exists, then proceed to the next step; otherwise, create the server
keystore.
2. If the server certificate has already been exported, then proceed to the next step; otherwise,
export the server certificate.
4. Define the client-side SSL context inside of example-security.xml. This configuration file
contains an Elytron authentication-client that defines the authentication and SSL
configuration for outbound connections. The following file demonstrates defining a client SSL
context and keystore.
<configuration>
197
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
<authentication-client xmlns="urn:elytron:1.0.1">
<key-stores>
<key-store name="clientStore" type="jks" >
<file name="/path/to/client.truststore.jks"/>
<key-store-clear-password password="secret" />
</key-store>
</key-stores>
<ssl-contexts>
<ssl-context name="client-SSL-context">
<trust-store key-store-name="clientStore" />
</ssl-context>
</ssl-contexts>
<ssl-context-rules>
<rule use-ssl-context="client-SSL-context" />
</ssl-context-rules>
</authentication-client>
</configuration>
5. Using the management CLI, reference the newly created file and attempt to access the server.
The following command accesses the management interface and executes the whoami
command.
$ EAP_HOME/bin/jboss-cli.sh -c --
controller=remote+https://127.0.0.1:9993 -
Dwildfly.config.url=/path/to/example-security.xml :whoami
1. If the server and client keystores already exist, then proceed to the next step; otherwise, create
the server and client keystores.
2. If the server and client certificates have already been exported, then proceed to the next step;
otherwise, export the server and client certificates.
198
APPENDIX A. REFERENCE MATERIAL
5. Define the client-side SSL context inside of example-security.xml. This configuration file
contains an Elytron authentication-client that defines the authentication and SSL
configuration for outbound connections. The following file demonstrates defining a client SSL
context and keystore.
<configuration>
<authentication-client xmlns="urn:elytron:1.0.1">
<key-stores>
<key-store name="clientStore" type="jks" >
<file name="/path/to/client.truststore.jks"/>
<key-store-clear-password password="secret" />
</key-store>
</key-stores>
<key-store name="clientKeyStore" type="jks" >
<file name="/path/to/client.keystore.jks"/>
<key-store-clear-password password="secret" />
</key-store>
<ssl-contexts>
<ssl-context name="client-SSL-context">
<trust-store key-store-name="clientStore" />
<key-store-ssl-certificate key-store-
name="clientKeyStore" alias="client">
<key-store-clear-password password="secret" />
</key-store-ssl-certificate>
</ssl-context>
</ssl-contexts>
<ssl-context-rules>
<rule use-ssl-context="client-SSL-context" />
</ssl-context-rules>
</authentication-client>
</configuration>
6. Using the management CLI, reference the newly created file and attempt to access the server.
The following command accesses the management interface and executes the whoami
command.
$ EAP_HOME/bin/jboss-cli.sh -c --
controller=remote+https://127.0.0.1:9993 -
Dwildfly.config.url=/path/to/example-security.xml :whoami
199
Red Hat JBoss Enterprise Application Platform 7.1 How to Configure Server Security
200