Chapter 2. How Red Hat JBoss Enterprise Application Platform 7 Handles Security out of the Box
There are two components that ship with JBoss EAP 7 that relate to security: Core Management Authentication and the
security subsystem. These two components are based on the general security concepts discussed in the Overview of General Security Concepts, but they also incorporate some JBoss EAP-specific concepts in their implementation discussed in the Red Hat JBoss Enterprise Application Platform-Specific Concepts section.
2.1. Red Hat JBoss Enterprise Application Platform-Specific Concepts
In addition to the general security concept covered in the Overview of General Security Concepts section, it is important to understand some of the concepts specific to JBoss EAP and JBoss EAP security.
2.1.1. Core Services, Subsystems, and Profiles
JBoss EAP is built on the concept of modular class loading. Each API or service provided by JBoss EAP is implemented as a module, which is loaded and unloaded on demand. The core services are services that are always loaded on server startup and are required to be running prior to starting an additional subsystem.
A subsystem is a set of capabilities added to the core server by an extension. Some example subsystems include a subsystem that provides servlet handling capabilities, a subsystem that provides an EJB container, and a subsystem that provides JTA.
A profile is a named list of subsystems, along with the details of each subsystem’s configuration. A profile with a large number of subsystems results in a server with a large set of capabilities. A profile with a small, focused set of subsystems will have fewer capabilities but a smaller footprint. By default, JBoss EAP comes with several predefined profiles, for example
full-ha. In these profiles, the management interfaces and the associated security realms are loaded as core services.
2.1.2. Management Interfaces
JBoss EAP offers two different management interfaces for interacting with and editing its configuration: the management console and the management CLI. Both interfaces expose the functionality of the core management of JBoss EAP. These interfaces offer two ways to access the same core management system.
The management console is a web-based administration tool for JBoss EAP. It may be used to start and stop servers, deploy and undeploy applications, tune system settings, and make persistent modifications to the server configuration. The management console also has the ability to perform administrative tasks, with live notifications when any changes require the server instance to be restarted or reloaded. In a managed domain, server instances and server groups in the same domain can be centrally managed from the management console of the domain controller.
The management CLI is a command line administration tool for JBoss EAP. The management CLI may be used to start and stop servers, deploy and undeploy applications, configure system settings, and perform other administrative tasks. Operations can be performed in batch mode, allowing multiple tasks to be run as a group. The management CLI may also connect to the domain controller in a managed domain to execute management operations on the domain. The management CLI can perform all tasks that the web-based administration tool can perform as well as many other lower-level operations that are unavailable to the web-based administration tool.
In addition to the clients that ship with JBoss EAP, other clients can be written to invoke the management interfaces over either the HTTP or native interfaces using the APIs included with JBoss EAP.
2.1.3. Security Realms
A security realm is effectively an identity store of usernames, passwords, and group membership information that can be used when authenticating users in EJBs, web applications, and the management interface. Initially, JBoss EAP comes preconfigured with two security realms by default:
ApplicationRealm. Both security realms use the file system to store mappings between users and passwords and users and group membership information. They both use a digest mechanism by default when authenticating.
A digest mechanism is an authentication mechanism that authenticates the user by making use of one-time, one-way hashes comprising various pieces of information, including information stored in the usernames and passwords mapping property file. This allows JBoss EAP to authenticate users without sending any passwords in plain text over the network.
The JBoss EAP installation contains a script that enables administrators to add users to both realms. When users are added in this way, the username and hashed password are stored in the corresponding users/passwords properties file. When a user attempts to authenticate, JBoss EAP sends back a one-time use number, nonce, to the client. The client then generates a one-way hash using their username, password, nonce, and a few other fields and sends the username, nonce, and one-way hash to JBoss EAP. JBoss EAP looks up the user’s prehashed password and uses it, along with the provided username, nonce, and a few other fields, to generate another one-way hash in the same manner. If all the same information is used, for example, correct password, on both sides, hashes will match and the user is authenticated.
Though security realms use the digest mechanism by default, they may be reconfigured to use other authentication mechanisms. On startup, the management interfaces determine which authentication mechanisms will be enabled based on what authentication mechanisms are configured in
Security realms are not involved in any authorization decisions; however, they can be configured to load a user’s group membership information, which can subsequently be used to make authorization decisions. After a user has been authenticated, a second step occurs to load the group membership information based on the username.
By default, the
ManagementRealm is used during authentication and authorization for the management interfaces. The
ApplicationRealm is a default realm made available for web applications and EJBs to use when authenticating and authorizing users.
2.1.4. Security Domains
A security domain is a set of Java Authentication and Authorization Service (JAAS) declarative security configurations that one or more applications use to control authentication, authorization, auditing, and mapping. Four security domains are included by default:
jboss-web-policy security domains are the default authorization mechanisms that are used if an application’s configured security domain has none. Those security domains, along with
other, are also used internally within JBoss EAP for authorization and are required for correct operation. The
jaspitest security domain is a simple JASPI security domain included for development purposes.
A security domain comprises configurations for authentication, authorization, security mapping, and auditing. Security domains are part of the JBoss EAP
security subsystem and are managed centrally by the domain controller or standalone server. Users can create as many security domains as needed to accommodate application requirements.
2.1.5. Using Security Realms and Security Domains
Security realms and security domains can be used as a part of securing web applications deployed to JBoss EAP. When deciding if either should be used, it is important to understand the difference between the two.
Web applications and EJB deployments can only use security domains directly. They perform the actual authentication and authorization via login modules using the identity information passed from an identity store. Security domains can be configured to use security realms for identity information; for example,
other allows applications to specify a security realm to use for authentication and getting authorization information. They may also be configured to use external identity stores. Web applications and EJB deployments cannot be configured to directly use security realms for authentication. The security domains are also part of the
security subsystem and are loaded after core services.
Only the core management, for example, the management interfaces, and the EJB remoting end points can use the security realms directly. They are identity stores that provide authentication as well as authorization information. They are also a core service and are loaded before any subsystems are started. The out-of-the-box security realms,
ApplicationRealm, use a simple file-based authentication mechanism, but they can be configured to use other mechanisms.
2.1.6. Security Auditing
Security auditing refers to triggering events, such as writing to a log, in response to an event that happens within the
security subsystem. Auditing mechanisms are configured as part of a security domain, along with authentication, authorization, and security mapping details. Auditing uses provider modules to control the way that security events are reported. JBoss EAP ships with several security auditing providers, but custom ones may be used. The core management of JBoss EAP also has its own security auditing and logging functionality, which is configured separately and is not part of the
2.1.7. Security Mapping
Security mapping adds the ability to combine authentication and authorization information after the authentication or authorization happens but before the information is passed to your application. Roles for authorization, principals for authentication, or credentials which are attributes that are not principals or roles, may all be mapped. Role mapping is used to add, replace, or remove roles to the subject after authentication. Principal mapping is used to modify a principal after authentication. Credential mapping is used to convert attributes from an external system to be used by your application and vice versa.
Java Management Extensions (JMX) provides a way to remotely trigger JDK and application management operations. The management API of JBoss EAP is exposed as JMX managed beans. These managed beans are referred to as core mbeans, and access to them is controlled and filtered exactly the same as the underlying management API itself.
In addition to the management CLI and management console, JMX-exposed beans are an alternative mechanism to access and perform management operations.
2.1.9. Role-Based Access Control
Role-Based Access Control (RBAC) is a mechanism for specifying a set of permissions for management users. It allows multiple users to share responsibility for managing JBoss EAP servers without each of them requiring unrestricted access. By providing a separation of duties for management users, JBoss EAP makes it easy for an organization to spread responsibility between individuals or groups without granting unnecessary privileges. This ensures the maximum possible security of your servers and data while still providing flexibility for configuration, deployment, and management.
RBAC in JBoss EAP works through a combination of role permissions and constraints. Seven predefined roles are provided, with every role having different fixed permissions. Each management user is assigned one or more roles that specify what the user is permitted to do when managing the server.
RBAC is disabled by default.
JBoss EAP provides seven predefined user roles:
SuperUser. Each role has a different set of permissions and is designed for specific use cases. The
SuperUser roles build successively upon each other, with each having more permissions than the previous. The
Deployer roles are similar to the
Maintainer roles, respectively, but they have some special permissions and restrictions.
Users of the
Monitorrole have the fewest permissions and can only read the current configuration and state of the server. This role is intended for users who need to track and report on the performance of the server.
Monitorcannot modify server configuration, nor can they access sensitive data or operations.
Operatorrole extends the
Monitorrole by adding the ability to modify the runtime state of the server. This means that
Operatorcan reload and shutdown the server as well as pause and resume JMS destinations. The
Operatorrole is ideal for users who are responsible for the physical or virtual hosts of the application server so they can ensure that servers can be shutdown and restarted correctly when need be.
Operatorcannot modify server configuration or access sensitive data or operations.
Maintainerrole has access to view and modify the runtime state and all configurations except sensitive data and operations. The
Maintainerrole is the general purpose role that does not have access to sensitive data and operation. The
Maintainerrole allows users to be granted almost complete access to administer the server without giving those users access to passwords and other sensitive information.
Maintainercannot access sensitive data or operations.
Administratorrole has unrestricted access to all resources and operations on the server except the audit logging system. The
Administratorrole has access to sensitive data and operations. This role can also configure the access control system. The
Administratorrole is only required when handling sensitive data or configuring users and roles.
Administratorcannot access the audit logging system and cannot change themselves to the
SuperUserrole does not have any restrictions, and it has complete access to all resources and operations of the server, including the audit logging system. If RBAC is disabled, all management users have permissions equivalent to the
Deployerrole has the same permissions as the
Monitor, but it can modify the configuration and state for deployments and any other resource type enabled as an application resource.
Auditorrole has all the permissions of the
Monitorrole and can also view, but not modify, sensitive data. It has full access to the audit logging system. The
Auditorrole is the only role besides
SuperUserthat can access the audit logging system.
Auditorcannot modify sensitive data or resources. Only read access is permitted.
Permissions determine what each role can do; not every role has every permission.
SuperUser has every permission and
Monitor has the least. Each permission can grant read and/or write access for a single category of resources. The categories are runtime state, server configuration, sensitive data, the audit log, and the access control system.
Table 2.1. Permissions of Each Role
Read Config and State
Read Sensitive Data 2
Modify Sensitive Data 2
Read/Modify Audit Log
Modify Runtime State
Modify Persistent Config
Read/Modify Access Control
1 Permissions are restricted to application resources.
2 Which resources are considered to be sensitive data are configured using sensitivity.
Constraints are named sets of access-control configuration for a specified list of resources. The RBAC system uses the combination of constraints and role permissions to determine if any specific user can perform a management action.
Constraints are divided into three classifications.
- Application Constraints
- Application Constraints define sets of resources and attributes that can be accessed by Deployer users. By default, the only enabled Application Constraint is core, which includes deployments and deployment overlays. Application Constraints are also included, but not enabled by default, for data sources, logging, mail, messaging, naming, resource-adapters, and security. These constraints allow Deployer users to not only deploy applications, but also configure and maintain the resources that are required by those applications.
- Sensitivity Constraints
- Sensitivity Constraints define sets of resources that are considered sensitive. A sensitive resource is generally one that is either secret, like a password, or one that will have serious impact on the operation of the server, like networking, JVM configuration, or system properties. The access control system itself is also considered sensitive. The only roles permitted to write to sensitive resources are Administrator and SuperUser. The Auditor role is only able to read sensitive resources. No other roles have access.
- Vault Expression Constraint
- The Vault Expression Constraint defines if reading and writing vault expressions are considered sensitive operations. By default, reading and writing vault expressions are sensitive operations.
2.1.10. Declarative Security and JAAS
Declarative security is a method to separate security concerns from application code by using the container to manage security. The container provides an authorization system based on either file permissions or users, groups, and roles. This approach is usually superior to programmatic security, which gives the application itself all of the responsibility for security. JBoss EAP provides declarative security by using security domains in the
Java Authentication and Authorization Service (JAAS), is a declarative security API comprising a set of Java packages designed for user authentication and authorization. The API is a Java implementation of the standard Pluggable Authentication Modules (PAM) framework. It extends the Java EE access control architecture to support user-based authorization. The JBoss EAP
security subsystem is actually based on the JAAS API.
Because JAAS is the foundation for the
security subsystem, authentication is performed in a pluggable fashion. This permits Java applications to remain independent from underlying authentication technologies, such as Kerberos or LDAP, and allows the security manager to work in different security infrastructures. Integration with a security infrastructure is achievable without changing the security manager implementation. Only the configuration of the authentication stack that JAAS uses needs to be changed.
2.2. Core Management Authentication
Core Management Authentication is responsible for securing the management interfaces, HTTP and native, for the core management functionality using the
ManagementRealm. It is built into the core management and is enabled and configured as a core service by default. It is only responsible for securing the management interfaces.
2.2.1. Default Security
By default, the Core Management Authentication secures each of the management interfaces, HTTP and native, in two different forms: local clients and remote clients, both of which are configured using the
ManagementRealm security realm by default. These defaults may be configured differently or replaced entirely.
Out of the box, the management interfaces are configured to use simple access controls, which does not use roles. As a result, all users by default, when using simple access controls, have the same privileges as the SuperUser Role, which essentially has access to everything.
184.108.40.206. Local and Remote Client Authentication with the Native Interface
The native interface, or management CLI, can be invoked locally on the same host as the running JBoss EAP instance or remotely from another machine. When attempting to connect using the native interface, JBoss EAP presents the client with a list of available SASL authentication mechanisms, for example,
local jboss user, BASIC, etc. The client chooses its desired authentication mechanism and attempts to authenticate with the JBoss EAP instance. If it fails, it retries with any remaining mechanisms or stops attempting to connect. Local clients have the option to use the
local jboss user authentication mechanism. This security mechanism is based on the client’s ability to access the local file system. It validates that the user attempting to log in actually has access to the local file system on the same host as the JBoss EAP instance.
This authentication mechanism happens in four steps:
The client sends a message to the server that includes a request to authenticate using
local jboss user.
- The server generates a one-time token, writes it to a unique file, and sends a message to the client with the full path of the file.
- The client reads the token from the file and sends it to the server, verifying that it has local access to the file system.
- The server verifies the token and then deletes the file.
This form of authentication is based on the principle that if physical access to the file system is achieved, other security mechanisms are superfluous. The reasoning is that if a user has local file system access, that user has enough access to create a new user or otherwise thwart other security mechanisms put in place. This is sometimes referred to as silent authentication because it allows the local user to access the management CLI without username or password authentication.
This functionality is enabled as a convenience and to assist local users running management CLI scripts without requiring additional authentication. It is considered a useful feature given that access to the local configuration typically also gives the user the ability to add their own user details or otherwise disable security checks.
The native interface can also be accessed from other servers, or even the same server, as a remote client. When accessing the native interface as a remote client, clients will not be able to authenticate using
local jboss user and will be forced to use another authentication mechanism, for example, DIGEST. If a local client fails to authenticate by using
local jboss user, it will automatically fall back and attempt to use the other mechanisms as a remote client.
The management CLI may be invoked from other servers, or even the same server, using the HTTP interface as opposed to the native interface. All HTTP connections, CLI or otherwise, are considered to be remote and NOT covered by local interface authentication.
By default, the native interface is not configured, and all management CLI traffic is handled by the HTTP interface. JBoss EAP 7 supports HTTP upgrade, which allows a client to make an initial connection over HTTP but then send a request to upgrade that connection to another protocol. In the case of the management CLI, an initial request over HTTP to the HTTP interface is made, but then the connection is upgraded to the native protocol. This connection is still handled over the HTTP interface, but it is using the native protocol for communication rather than HTTP. Alternatively, the native interface may still be enabled and used if desired.
220.127.116.11. Local and Remote Client Authentication with the HTTP Interface
The HTTP interface can be invoked locally by clients on the same host as the running JBoss EAP instance or remotely by clients from another machine. Despite allowing local and remote clients to access the HTTP interface, all clients accessing the HTTP interface are treated as remote connections.
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. The header for Digest also includes the nonce generated by JBoss EAP. The client looks at the headers and chooses which authentication method to use and sends an appropriate response. In the case where the client chooses Digest, it prompts the user for their username and password. The client uses the supplied fields such as username and password, the nonce, and a few other pieces of information to generate a one-way hash. The client then sends the one-way hash, username, and nonce back to JBoss EAP as a response. JBoss EAP takes that information, generates another one-way hash, compares the two, and authenticates the user based on the result.
2.2.2. Advanced Security
There are a number of ways to change the default configuration of management interfaces as well as the authentication and authorization mechanisms to affect how it is secured.
18.104.22.168. Updating the Management Interfaces
In addition to modifying the Authentication and Authorization mechanisms, JBoss EAP allows administrators to update the configuration of the management interface itself. There are a number of options.
- Configuring the Management Interfaces to use HTTPS
- Configuring the JBoss EAP management console for communication only via HTTPS provides increased security. All network traffic between the client and management console is encrypted, which reduces the risk of security attacks, such as a man-in-the-middle attack. Anyone administering a JBoss EAP instance has greater permissions on that instance than non-privileged users, and using HTTPS helps protect the integrity and availability of that instance. When configuring HTTPS with JBoss EAP, authority-signed certificates are preferred over self-signed certificates because they provide a chain of trust. Self-signed certificates are permitted but are not recommended.
- Using Two-Way SSL/TLS
- Two-Way SSL/TLS authentication, also known as client authentication, authenticates the client and the server using SSL/TLS certificates. This provides assurance that not only is the server what it says it is, but the client is also what it says it is.
- Updating or Creating a New Security Realm
- The default security realm can be updated or replaced with a new security realm.
22.214.171.124. Adding Outbound Connections
Some security realms connect to external interfaces, such as an LDAP server. An outbound connection defines how to make this connection. A predefined connection type,
ldap-connection, sets all of the required and optional attributes to connect to the LDAP server and verify the credential.
126.96.36.199. Adding RBAC to the Management Interfaces
By default the RBAC system is disabled. It is enabled by changing the
provider attribute from
rbac. This can be done using the management CLI. When RBAC is disabled or enabled on a running server, the server configuration must be reloaded before it takes effect.
When RBAC is enabled for the management interfaces, the role assigned to a user determines the resources to which they have access and what operations they can conduct with a resource’s attributes. Only users of the
SuperUser role can view and make changes to the access control system.
Enabling RBAC without having users and roles properly configured could result in administrators being unable to log in to the management interfaces.
RBAC’s Effect on the Management Console
In the management console, some controls and views are disabled, which show up as grayed out, or not visible at all, depending on the permissions of the role the user has been assigned.
If the user does not have read permissions to a resource attribute, that attribute will appear blank in the console. For example, most roles cannot read the username and password fields for data sources.
If the user has read permissions but does not have write permissions to a resource attribute, that attribute will be disabled in the edit form for the resource. If the user does not have write permissions to the resource, the edit button for the resource will not appear.
If a user does not have permissions to access a resource or attribute, meaning it is unaddressable for that role, it will not appear in the console for that user. An example of that is the access control system itself, which is only visible to a few roles by default.
The management console also provides an interface for the following common RBAC tasks:
- View and configure what roles are assigned to, or excluded from, each user.
- View and configure what roles are assigned to, or excluded from, each group.
- View group and user membership per role.
- Configure default membership per role.
- Create a scoped role.
Constraints cannot be configured in the management console at this time.
RBAC’s Effect on the Management CLI or Management API
Users of the management CLI or management API will encounter slightly different behavior when RBAC is enabled.
Resources and attributes that cannot be read are filtered from results. If the filtered items are addressable by the role, their names are listed as
filtered-attributes in the
response-headers section of the result. If a resource or attribute is not addressable by the role, it is not listed.
Attempting to access a resource that is not addressable will result in a resource not found error.
If a user attempts to write or read a resource that they can address but lacks the appropriate write or read permissions, a
Permission Denied error is returned.
The management CLI can perform all of same RBAC tasks as the management console as well as a few additional tasks:
- Enable and disable RBAC
- Change permission combination policy
- Configuring application resource and resource sensitivity constraints
RBAC’s Effect on JMX Managed Beans
Role-Based Access Control applies to JMX in three ways:
The management API of JBoss EAP is exposed as JMX managed beans. These managed beans are referred to as
core mbeans, and access to them is controlled and filtered exactly the same as the underlying management API itself.
jmxsubsystem is configured with write permissions being sensitive. This means only users of the
SuperUserroles can make changes to that subsystem. Users of the
Auditorrole can also read this subsystem configuration.
By default, managed beans registered by deployed applications and services, or non-core mbeans, can be accessed by all management users, but only users of the
SuperUserroles can write to them.
RBAC works with the standard authentication providers that are included with JBoss EAP:
Users are authenticated using a username and password combination that is verified according to the settings of the
ManagementRealm, which has the ability to use a local properties file or LDAP.
- Client Certificate
- The truststore provides authentication information for client certificates.
- local jboss user
jboss-cliscript authenticates automatically as
local jboss userif the server is running on the same machine. By default
local jboss useris a member of the
Regardless of which provider is used, JBoss EAP is responsible for assigning roles to users. When authenticating with the
ManagementRealm or an LDAP server, those systems can supply user group information. This information can also be used by JBoss EAP to assign roles to users.
188.8.131.52. Using LDAP with the Management Interfaces
JBoss EAP includes several authentication and authorization modules that allow an LDAP server to be used as the authentication and authorization authority for web and EJB applications.
To use an LDAP directory server as the authentication source for the management console, management CLI, or management API, the following tasks must be performed:
- Create an outbound connection to the LDAP server.
- Create an LDAP-enabled security realm or update an existing security realm to use LDAP.
- Reference the new security realm in the management interface.
The LDAP authenticator operates by first establishing a connection to the remote directory server. It then performs a search using the username, which the user passed to the authentication system, to find the fully qualified distinguished name (DN) of the LDAP record. A new connection to the LDAP server is established, using the DN of the user as the credential and password supplied by the user. If this authentication to the LDAP server is successful, the DN is verified as valid.
Once an LDAP-enabled security realm is created, it can be referenced by the management interface. The management interface will use the security realm for authentication. JBoss EAP can also be configured to use an outbound connection to an LDAP server using two-way SSL/TLS for authentication in the management interface and management CLI.
184.108.40.206. JAAS and the Management Interfaces
JAAS can be used to secure the management interfaces. When using JAAS for the management interfaces, the security realm must be configured to use a security domain. This introduces a dependency between core services and the subsystems. While SSL/TLS is not required to use JAAS to secure the management interfaces, it is recommended that administrators enable SSL/TLS to avoid accidentally transmitting sensitive information in an unsecured manner.
When JBoss EAP instances are running in
admin-only mode, using JAAS to secure the management interfaces is not supported. For more information on admin-only mode, see Running JBoss EAP in Admin-Only Mode in the JBoss EAP Configuration Guide.
2.3. Security Subsystem
security subsystem provides security infrastructure for applications and is based on the JAAS API. The subsystem uses a security context associated with the current request to expose the capabilities of the authentication manager, authorization manager, audit manager, and mapping manager to the relevant container.
The authentication and authorization managers handle authentication and authorization. The mapping manager handles adding, modifying, or deleting information from a principal, role, or attribute before passing the information to your application. The auditing manager allows users to configure provider modules to control the way that security events are reported.
In most cases, administrators should need to focus only on setting up and configuring security domains in regards to updating the configuration of the
security subsystem. Outside of security domains, the only security element that may need to be changed is whether to use
deep-copy-subject-mode. In the rare case that security elements require changes, those configuration changes, as well as
deep-copy-subject-mode, may be found in the Security Management section of the
2.3.1. Password Vault System
JBoss EAP has a Password Vault to encrypt sensitive strings, store them in an encrypted keystore, and decrypt them for applications and verification systems. In plain text configuration files, such as XML deployment descriptors, it is sometimes necessary to specify passwords and other sensitive information. The JBoss EAP Password Vault can be used to securely store sensitive strings for use in plain text files.
2.3.2. Security Domains
Security domains are configured centrally either at the domain controller or on the standalone server. When security domains are used, an application may be configured to use a security domain in lieu of individually configuring security. This allows users and administrators to leverage Declarative Security.
One common scenario that benefits from this type of configuration structure is the process of moving applications between testing and production environments. If an application has its security individually configured, it may need to be updated every time it is promoted to a new environment, for example, from a testing environment to a production environment. If that application used a security domain instead, the JBoss EAP instances in the individual environments would have their security domains properly configured for the current environment, allowing the application to rely on the container to provide the proper security configuration, using the security domain.
220.127.116.11. Login Modules
JBoss EAP includes several bundled login modules suitable for most user management roles that are configured within a security domain. The
security subsystem offers some core login modules that can read user information from a relational database, an LDAP server, or flat files. In addition to these core login modules, JBoss EAP provides other login modules that provide user information and functionality for customized needs.
Summary of the Login Modules Commonly Used
- Ldap Login Module
The Ldap login module is a login module implementation that authenticates against an LDAP server. The
securitysubsystem connects to the LDAP server using connection information, that is, a bindDN that has permissions to search the
rolesCtxDNtrees for the user and roles, provided using a JNDI initial context. When a user attempts to authenticate, the LDAP login module connects to the LDAP server and passes the user’s credentials to the LDAP server. Upon successful authentication, an
InitialLDAPContextis created for that user within JBoss EAP, populated with the user’s roles.
- LdapExtended Login Module
- The LdapExtended login module searches for the user to bind, as well as the associated roles, for authentication. The roles query recursively and follow DNs to navigate a hierarchical role structure. The login module options include whatever options are supported by the chosen LDAP JNDI provider supports.
- UsersRoles Login Module
- The UsersRoles login module is a simple login module that supports multiple users and user roles loaded from Java properties files. The primary purpose of this login module is to easily test the security settings of multiple users and roles using properties files deployed with the application.
- Database Login Module
- The Database login module is a Java Database Connectivity-based (JDBC) login module that supports authentication and role mapping. This login module is used if username, password, and role information are stored in a relational database. This works by providing a reference to logical tables containing principals and roles in the expected format.
- Certificate Login Module
The Certificate login module authenticates users based on X509 certificates. A typical use case for this login module is CLIENT-CERT authentication in the web tier. This login module only performs authentication and must be combined with another login module capable of acquiring authorization roles to completely define access to secured web or EJB components. Two subclasses of this login module,
DatabaseCertLoginModule, extend the behavior to obtain the authorization roles from either a properties file or database.
- Identity Login Module
The Identity login module is a simple login module that associates a hard-coded username to any subject authenticated against the module. It creates a
SimplePrincipalinstance using the name specified by the principal option. This login module is useful when a fixed identity is required to be provided to a service. This can also be used in development environments for testing the security associated with a given principal and associated roles.
- RunAs Login Module
- The RunAs login module is a helper module that pushes a run as role onto the stack for the duration of the login phase of authentication; it then pops the run as role from the stack in either the commit or abort phase. The purpose of this login module is to provide a role for other login modules that must access secured resources to perform their authentication, for example, a login module that accesses a secured EJB. The RunAs login module must be configured ahead of the login modules that require a run as role established.
- Client Login Module
The Client login module is an implementation of a login module for use by JBoss clients when establishing caller identity and credentials. This creates a new SecurityContext, assigns it a principal and a credential, and sets the SecurityContext to the ThreadLocal security context. The Client login module is the only supported mechanism for a client to establish the current thread’s caller. Both standalone client applications and server environments, acting as JBoss EJB clients where the security environment has not been configured to use the JBoss EAP
securitysubsystem transparently, must use the Client login module.
This login module does not perform any authentication. It merely copies the login information provided to it into the server EJB invocation layer for subsequent authentication on the server. Within JBoss EAP, this is only supported for switching a user’s identity for in-JVM calls. This is NOT supported for remote clients to establish an identity.
- SPNEGO Login Module
The SPNEGO login module is an implementation of a login module that establishes caller identity and credentials with a KDC. The module implements SPNEGO and is a part of the JBoss Negotiation project. This authentication can be used in the chained configuration with the AdvancedLdap login module to allow cooperation with an LDAP server. Web applications must also enable the
NegotiationAuthenticatorwithin the application to use this login module.
- RoleMapping Login Module
The RoleMapping login module supports mapping roles that are the end result of the authentication process to one or more declarative roles. For example, if the authentication process has determined that the user John has the roles
testAdmin, and the declarative role defined in the
ejb-jar.xmlfile for access is
admin, then this login module maps the
testAdminroles to John. The RoleMapping login module must be defined as an optional module to a login module configuration as it alters mapping of the previously mapped roles.
- Remoting Login Module
- The Remoting login module checks if the request that is currently being authenticated was received over the Remoting connection. In cases where the request was received using the remoting interface, that request is associated with the identity created during the authentication process.
- RealmDirect Login Module
The RealmDirect login module allows an existing security realm to be used in making authentication and authorization decisions. When configured, this module will look up identity information using the referenced realm for making authentication decisions and mapping user roles. For example, the preconfigured
othersecurity domain that ships with JBoss EAP has a Realm Direct login module. If no realm is referenced in this module, the
ApplicationRealmsecurity realm is used by default.
- Custom Modules
- In cases where the login modules bundled with the JBoss EAP security framework do not meet the needs of the security environment, a custom login module implementation may be written. The AuthenticationManager requires a particular usage pattern of the Subject principals set. A full understanding of the JAAS Subject class’s information storage features and the expected usage of these features are required to write a login module that works with the AuthenticationManager.
The UnauthenticatedIdentity login module option is also commonly used. There are certain cases when requests are not received in an authenticated format. The Unauthenticated Identity is a login module configuration option that assigns a specific identity, for example,
guest, to requests that are made with no associated authentication information. This can be used to allow unprotected servlets to invoke methods on EJBs that do not require a specific role. Such a principal has no associated roles and can only access either unsecured EJBs or EJB methods that are associated with the unchecked permission constraint.
18.104.22.168. Password Stacking
Multiple login modules can be chained together in a stack, with each login module providing the credentials verification and role assignment during authentication. This works for many use cases, but sometimes credentials verification and role assignment are split across multiple user management stores.
Consider the case where users are managed in a central LDAP server and application-specific roles are stored in the application’s relational database. The
password-stacking module option captures this relationship.
To use password stacking, each login module should set the
password-stacking attribute to
useFirstPass, which is located in the
<module-option> section. If a previous module configured for password stacking has authenticated the user, all the other stacking modules will consider the user authenticated and only attempt to provide a set of roles for the authorization step.
password-stacking option is set to
useFirstPass, this module first looks for a shared username and password under the property names
javax.security.auth.login.password, respectively, in the login module shared state map.
If found, these properties are used as the principal name and password. If not found, the principal name and password are set by this login module and stored under the property names
22.214.171.124. Password Hashing
Most login modules must compare a client-supplied password to a password stored in a user management system. These modules generally work with plain text passwords, but they can be configured to support hashed passwords to prevent plain text passwords from being stored on the server side. JBoss EAP supports the ability to configure the hashing algorithm, encoding, and character set as well as define when the user password and store password are hashed.
Red Hat JBoss Enterprise Application Platform Common Criteria certified configuration does not support hash algorithms weaker than SHA-256.
2.3.3. Security Management
The security management portion of the
security subsystem is used to override the high-level behaviors of the
security subsystem. Each setting is optional. It is unusual to change any of these settings except for the deep copy subject mode.
126.96.36.199. Deep Copy Mode
If the deep copy subject mode is disabled, with it is by default, copying a security data structure makes a reference to the original rather than copying the entire data structure. This behavior is more efficient, but it is prone to data corruption if multiple threads with the same identity clear the subject by means of a flush or logout operation.
If the deep copy subject mode is enabled, a complete copy of the data structure, along with all its associated data as long as they are marked cloneable, is made. This is more thread-safe but less efficient.
2.3.4. Additional Components
Java Authentication SPI for Containers (JASPI or JASPIC) is a pluggable interface for Java applications and is defined in JSR-196. In addition to JAAS authentication, JBoss EAP allows for JASPI authentication to be used. JASPI authentication is configured using login modules in a security domain, and those modules may be stacked. The
jaspitest security domain is a simple JASPI security domain that is included by default for development purposes. The web-based management console does not expose the configuration of JASPI authentication modules. Applications deployed to JBoss EAP require a special authenticator to be configured in their deployment descriptor to use JASPI security domains.
Java Authorization Contract for Containers (JACC) is a standard that defines a contract between containers and authorization service providers, which results in the implementation of providers for use by containers. It was defined in JSR-115 and has been part of the core Java EE specification since version 1.3.
JBoss EAP implements support for JACC within the security functionality of the
JBoss EAP provides out-of-the-box support for clustered and non-clustered SSO using the
infinispan subsystems. This requires:
- A configured security domain that handles authentication and authorization.
SSOinfinispan replication cache. It is present in the
full-haprofiles for a managed domain, or by using the
standalone-full-ha.xmlconfiguration files for a standalone server.
SSOreplication cache within it must be present.
undertowsubsystem needs to be configured to use SSO.
- Each application that will share the SSO information must be configured to use the same security domain.