Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

Chapter 2. How Red Hat JBoss Enterprise Application Platform 6 Handles Security Out of the Box

There are two components that ship with JBoss EAP 6 and above 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 section, but they also incorporate some JBoss EAP-specific concepts in their implementation discussed in the in the Section 2.1, “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 Chapter 1, Overview of General Security Concepts section, it’s 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 6 is built on the concept of modular classloading. 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 which are always loaded on server startup and are required to be running prior to starting any additional subsystems.

A subsystem is an additional set of capabilities added to the core server by an extension. Some example subsystems include: a subsystem that provides servlet handling capabilities, a subsystem provides an EJB container, and a subsystem 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 6 comes with several pre-defined profiles (e.g. default, full, ha, 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 6 offers two different management interfaces (APIs) for interacting with and editing its configuration: The Management Console (HTTP API) and the Management CLI (Native API). Both of these interfaces expose the functionality of the core management of JBoss EAP. In essence, these interfaces offer two ways to access the same core management system.

The Management Console is a web-based administration tool for JBoss EAP 6 . 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 Command Line Interface (CLI) is a command line administration tool for JBoss EAP 6. 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.

Note

In addition to the clients that ship with JBoss EAP 6, other clients can be written to invoke the management interfaces over either the HTTP or native interfaces using the APIs included with JBoss EAP 6.

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 6 comes pre-configured with two security realms by default: ManagementRealm and ApplicationRealm. Both of these security realms use the filesystem to store mappings between users and passwords, and users and group membership information and use a digest mechanism by default when authenticating.

A digest mechanism is simply an authentication mechanism that authenticates the user by making use of one-time, one-way hashes comprised of various pieces of information including information stored in the users/passwords mapping property file. This allows JBoss EAP to authenticate users without sending any passwords in plain text over the network.

A script is included with the JBoss EAP 6 install which 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 then sends back to JBoss EAP the username, nonce and one-way hash. JBoss EAP then looks up the user’s pre-hashed password and uses it along with the provided username and nonce and few other fields to generate another one-way hash in the same manner. If all the same information is used (e.g. correct password) on both sides then 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 as well. On startup, the management interfaces determine which authentication mechanisms will be enabled based on what authentication mechanisms are configured in ManagementRelam.

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 will occur 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 which one or more applications use to control authentication, authorization, auditing, and mapping. Three security domains are included by default: jboss-ejb-policy, jboss-web-policy, and other. jboss-ejb-policy and jboss-web-policy 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 therefore required for correct operation.

A security domain consists of configurations for authentication, authorization, security mapping, and auditing. Security domains are part of the JBoss EAP 6 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

Both 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’s 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 (e.g. other allows applications to specify a security realm to use for authentication and getting authorization information), but 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 therefore loaded after core services.

Only the core management (e.g. 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 (ManagementRealm and 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 secuirty auditing providers, but custom ones may be used as well. In addition, the core management of JBoss EAP also has its own security auditing and logging functionality which is configure separately and is not part of the security subsystem.

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 (authorization), principals (authentication), or credentials (attributes which 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 (attribute) mapping is used to convert attributes from an external system to be used by your application, and vice versa.

2.1.8. JMX

Java Management Extensions (JMX) provides a way to remotely trigger JDK and application management operations. The Management API of JBoss EAP 6 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.

Note

Prior to JBoss EAP 6, the management functionality was primarily JMX based, meaning the management functionality relied on these JMX exposed beans to perform operations. With JBoss EAP 6, the core management does not rely on them to perform operations. JMX exposed beans are now just alternative mechanism (in addition to the native and http interfaces) 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 6 servers without each of them requiring unrestricted access. By providing a separation of duties for management users, JBoss EAP 6 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.

Role-Based Access Control in JBoss EAP 6 works through a combination of role permissions and constraints. Seven predefined roles are provided that each have different fixed permissions. Each management user is assigned one or more roles, which specify what the user is permitted to do when managing the server.

Role-Based Access Control is supported by JBoss EAP 6.2 and above, but is disabled by default.

Standard Roles

JBoss EAP 6 provides seven predefined user roles: Monitor, Operator, Maintainer, Deployer, Auditor, Administrator, and SuperUser. Each of these roles has a different set of permissions and is designed for specific use cases. The Monitor, Operator, Maintainer, Administrator, and SuperUser role each build successively upon each other, with each having more permissions than the previous. The Auditor and Deployer roles are similar to the Monitor and Maintainer roles respectively but have some additional special permissions and restrictions.

Monitor
Users of the Monitor role 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. Monitors cannot modify server configuration nor can they access sensitive data or operations.
Operator
The Operator role extends the Monitor role by adding the ability to modify the runtime state of the server. This means that Operators can reload and shutdown the server as well as pause and resume JMS destinations. The Operator role 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 corrected when needed. Operators cannot modify server configuration or access sensitive data or operations.
Maintainer
The Maintainer role has access to view and modify runtime state and all configuration except sensitive data and operations. The Maintainer role is the general purpose role that doesn’t have access to sensitive data and operation. The Maintainer role allows users to be granted almost complete access to administer the server without giving those users access to passwords and other sensitive information. Maintainers cannot access sensitive data or operations.
Administrator
The Administrator role has unrestricted access to all resources and operations on the server except the audit logging system. The Administrator role has access to sensitive data and operations. This role can also configure the access control system. The Administrator role is only required when handling sensitive data or configuring users and roles. Administrators cannot access the audit logging system and cannot change themselves to the Auditor or SuperUser role.
SuperUser
The SuperUser role has no restrictions and has complete access to all resources and operations of the server including the audit logging system. This role is equivalent to the administrator users of earlier versions of JBoss EAP 6 (6.0 and 6.1). If RBAC is disabled, all management users have permissions equivalent to the SuperUser role.
Deployer
The Deployer role has the same permissions as the Monitor, but can modify configuration and state for deployments and any other resource type enabled as an application resource.
Auditor
The Auditor role has all the permissions of the Monitor role and can also view (but not modify) sensitive data, and has full access to the audit logging system. The Auditor role is the only role other than SuperUser that can access the audit logging system. Auditors cannot modify sensitive data or resources. Only read access is permitted.

Permissions

What each role is allowed to do is defined by what permissions it has. Not every role has every permission. Notably 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

 MonitorOperatorMaintainerDeployerAuditorAdministratorSuperUser

Read Config and State

X

X

X

X

X

X

X

Read Sensitive Data 2

    

X

X

X

Modify Sensitive Data 2

     

X

X

Read/Modify Audit Log

    

X

 

X

Modify Runtime State

 

X

X

X1

 

X

X

Modify Persistent Config

  

X

X1

 

X

X

Read/Modify Access Control

     

X

X

1 permissions are restricted to application resources.

2 What resources are considered to be "sensitive data" are configured using Sensitivity

Constraints

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 users of the Deployer role. By default the only enabled Application Constraint is core which includes deployments, deployment overlays. Application Constraints are also included (but not enabled by default) for datasources, 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 or writing vault expressions is consider a sensitive operation. By default both reading and writing vault expressions is a sensitive operation.

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 6 provides declarative security via security domains in the Security Subsystem.

Java Authentication and Authorization Service (JAAS) is a declarative security API which consists of 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 6 security subsystem is actually based on the JAAS API.

Since 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 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. In addition to securing the Management Interfaces, the HTTP and Native interfaces may each be disabled.

Note

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.

2.2.1.1. Local and Remote Client Authentication with the Native Interface

The Native Interface (CLI) can be invoked on the same host as the running JBoss EAP instance (local) or from another machine with the jboss-cli script (remote). When attempting to connect via the Native Interface, JBoss EAP presents the client with a list of available SASL authentication mechanisms (e.g. 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 filesystem. It simply validates that the user attempting to log in actually has access to the local filesystem on the same host as the JBoss EAP instance.

This authentication mechanism happens in four steps:

  1. The client sends a message to the server which includes a request to authenticate using local jboss user.
  2. 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.
  3. The client reads the token from the file and sends it to the server, verifying that it has local access to the filesystem.
  4. 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 filesystem is achieved, other security mechanisms are superfluous. The reasoning being that if a user has local filesystem access, that user has enough access to create a new user or otherwise thwart other security mechanism put in place. This is sometimes referred to as Silent Authentication since it allows the local user the ability 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 another authentication mechanism (e.g. DIGEST). If a local client fails to authenticate via local jboss user it will automatically fall back and attempt to use the other mechanisms as a remote client.

Note

The Management CLI may also be invoked from other servers (or even the same server) using the HTTP interface as apposed to the native interface. All HTTP connections (CLI or otherwise) are considered to be remote and NOT covered by local interface authentication.

2.2.1.2. Local and Remote Client Authentication with the HTTP Interface

The HTTP Interface can be invoked by clients on the same host as the same host as the running JBoss EAP instance (local) or by clients from another machine (remote). Despite allowing both 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 (requires authentication) and a set of headers that list the supported authentication mechanisms (e.g. Digest, GSSAPI, etc). The header for Digest also includes the nonce generated by JBoss EAP. The client then 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 then uses the supplied fields (e.g. 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 then takes that information, generates another one-way hash, compares to 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/Authorization mechanisms to affect how it is secured.

2.2.2.1. Updating the Management Interfaces

In addition to modifying the Authentication and Authorization mechanisms, JBoss EAP 6 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 6, authority-signed certificates are preferred over self-signed certificates since they provide a chain of trust. Self-signed certificates are still permitted but not recommended.
Using 2-way SSL/TLS
2-way SSL/TLS authentication, also known as client authentication, authenticates both the client and the server using SSL/TLS certificates. This provides assurance that not only is the server who it says it is, but the client is also who it says it is.
Using Distinct Network Interfaces for HTTP and HTTPS Traffic
The Management Interface can listen on distinct network interfaces for HTTP and HTTPS connections. For instance, an administrator may want to configure an external interface to listen for HTTPS traffic only while the internal-facing interface can accept HTTP traffic. If a server listens for HTTP and HTTPS traffic on the same interface, HTTPS requests received by the HTTP listener are automatically redirected to the HTTPS port. When distinct interfaces are used for HTTP and HTTPS traffic, no redirection is performed when an HTTPS request is received by the HTTP listener.
Disabling Management Interfaces
In certain instances, such as with managed domains or when using other management clients such as JBoss Operations Network, administrators may wish disable the HTTP interface, the Native interface, or the Web Console. Each of these interfaces may be disabled or removed entirely.
Note

The native interface is used by JBoss EAP 6 when running in domain mode for several purposes, including communication with slave domain controllers. As a result, the native interface should not be disabled when running in domain mode.

Updating or Creating a New Security Realm
The default security realm can be updated or replaced with a new security realm.

2.2.2.2. 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 pre-defined connection type, ldap-connection, sets all of the required and optional attributes to connect to the LDAP server and verify the credential.

2.2.2.3. Adding RBAC to the Management Interfaces

By default the Role-Based Access Control (RBAC) system is disabled. It is enabled by changing the provider attribute from simple to rbac. This can be done using the jboss-cli script. 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 Administration or SuperUser role can view and make changes to the access control system.

Warning

Enabling RBAC without having users and roles properly configured could result in administrators being unable to login to the management interfaces.

RBAC’s Effect on the Management Console (Web Console)

In the management console some controls and views are disabled (greyed out) or not visible at all depending on the permissions of the role to which 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 datasources.

If the user has read permissions but does not have write permissions to a resource attribute, that attribute will be disabled (greyed-out) in the edit form for the resource. If the user does not have write permissions to the resource, then the edit button for the resource will not appear.

If a user does not have permissions to access a resource or attribute (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
Note

Constraints cannot be configured in the Management Console at this time.

RBAC’s Effect on the Management CLI or API (HTTP and Native)

Users of the jboss-cli script or management API will encounter slightly different behavior in the API 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 lack 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:

  1. The Management API of JBoss EAP 6 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.
  2. The JMX subsystem is configured with write permissions being sensitive. This means only users of the Administrator and SuperUser roles can make changes to that subsystem. Users of the Auditor role can also read this subsystem configuration.
  3. By default Managed Beans registered by deployed applications and services (non-core mbeans) can be accessed by all management users, but only users of the Maintainer, Operator, Administrator, and SuperUser roles can write to them.

RBAC Authentication

Role-Based Access Control works with the standard authentication providers that are included with JBoss EAP 6 :

Username/Password
Users are authenticated using a username and password combination which is verified according to the settings of the ManagementRealm, which has the ability to use a local properties file or LDAP.
Client Certificate
Using the Trust Store.
Local User
jboss-cli script authenticates automatically as Local User if the server that is running on the same machine. By default Local User is a member of the SuperUser group.

Regardless of which provider is used, JBoss EAP is responsible for the assignment of roles to users. However 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.

2.2.2.4. Using LDAP with the Management Interfaces

JBoss EAP 6 includes several authentication and authorization modules which 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 must be done:

  1. Create an outbound connection to the LDAP server.
  2. Create an LDAP-enabled security realm or update an existing security realm to use LDAP.
  3. 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 to be valid.

Once an LDAP-enabled security realm is created, it can be referenced by the management interface. The management interface will then use the security realm for authentication. JBoss EAP 6 can also be configured to use an outbound connection to a LDAP server using 2-way SSL/TLS for authentication in the Management Interface and CLI.

2.2.2.5. 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. In addition, while SSL/TLS is not required to use JAAS to secure the management interfaces, it is heavily recommend that administrators enable SSL/TLS to avoid accidentally transmitting sensitive information in an unsecured manner.

Note

When JBoss EAP 6 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, please see section Reference of Switches and Arguments to pass at Server Runtime of the Administration and Configuration Guide.

2.3. Security Subsystem

The 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 only need to focus 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 where security elements do require changes, those configuration changes (as well as deep-copy-subject-mode) may be found in the security management portion of the security subsystem.

2.3.1. Password Vault System

JBoss EAP 6 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 lieu of individually configuring security. This allows users and administrators to leverage declarative security.

Example

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 it’s security individually configured, it may need to be updated every time its promoted to a new environment (e.g. from a testing environment to a production environment). If that application instead used a security domain, 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 (via the security domain).

2.3.2.1. Login Modules

JBoss EAP 6 includes several bundled login modules suitable for most user management which 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 6 provides other login modules that provide user information and functionality for very customized needs.

Summary of the login modules commonly used

Ldap Login Module
Ldap login module is a LoginModule implementation that authenticates against an LDAP server. The security subsystem connects to the LDAP server using connection information (i.e. a bindDN that has permissions to search both the baseCtxDN and rolesCtxDN trees 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 InitialLDAPContext is created for that user within JBoss EAP, populated with the user’s roles.
LdapExtended Login Module
The LdapExtended (org.jboss.security.auth.spi.LdapExtLoginModule) login module searches for the user to bind, as well as the associated roles, for authentication. The roles query recursively follows DNs to navigate a hierarchical role structure. The LoginModule options include whatever options are supported by the chosen LDAP JNDI provider supports.
UsersRoles Login Module
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 user name, 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
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 a secured web or EJB components. Two subclasses of this login module, CertRolesLoginModule and DatabaseCertLoginModule extend the behavior to obtain the authorization roles from either a properties file or database.
Identity Login Module
Identity login module is a simple login module that associates a hard-coded user name to any subject authenticated against the module. It creates a SimplePrincipal instance 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
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, 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 in order to perform their authentication (for example, a login module that accesses a secured EJB). RunAs login module must be configured ahead of the login modules that require a run as role established.
Client Login Module
Client login module (org.jboss.security.ClientLoginModule) is an implementation of LoginModule 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. Client login module is the only supported mechanism for a client to establish the current thread’s caller. Both stand-alone client applications, and server environments (acting as JBoss EJB clients where the security environment has not been configured to use the JBoss EAP security subsystem transparently) must use Client login module.
Warning

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 6, this is only supported for the purpose of 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 (org.jboss.security.negotiation.spnego.SPNEGOLoginModule) is an implementation of LoginModule that establishes caller identity and credentials with a KDC. The module implements SPNEGO (Simple and Protected GSSAPI Negotiation mechanism) 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 NegotiationAuthenticator within the application in order 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 ldapAdmin and testAdmin, and the declarative role defined in the web.xml or ejb-jar.xml file for access is admin, then this login module maps the admin roles 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 via the remoting interface, that request is associated with the identity created during the authentication process.
Realm Direct Login Module
The Realm Direct login module allows for the use of 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 pre-configured other security domain that ships with JBoss EAP 6 has a Realm Direct login module. If no realm is referenced in this module, the ApplicationRealm security 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.

In addition, the Unauthenticated Identity login module option is also commonly used. There are certain cases where requests are not received in an authenticated format. unauthenticatedIdentity is a login module configuration option that assigns a specific identity (guest, for example) 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 so can only access either unsecured EJBs or EJB methods that are associated with the unchecked permission constraint.

2.3.2.2. Password Stacking

Multiple login modules can be chained together in a stack, with each login module providing both 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 but 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.

When password-stacking option is set to useFirstPass, this module first looks for a shared user name and password under the property names javax.security.auth.login.name and 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 javax.security.auth.login.name and javax.security.auth.login.password respectively.

2.3.2.3. 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 can be configured to support hashed passwords to prevent plain text passwords from being stored on the server side. JBoss EAP 6 supports the ability to configure the hashing algorithm, encoding, and character set as well as when the user password and store password are hashed.

Important

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 deep copy subject mode.

2.3.3.1. Deep Copy Mode

If deep copy subject mode is disabled (the 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 is prone to data corruption if multiple threads with the same identity clear the subject by means of a flush or logout operation.

If deep copy subject mode is enabled, a complete copy of the data structure along with and all its associated data is made (as long as they are marked cloneable). This is more thread-safe, but less efficient.

2.3.4. Additional Components

2.3.4.1. JASPI

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 6 also 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 web-based management console does not expose the configuration of JASPI authentication modules. In addition, applications deployed to JBoss EAP 6 require a special authenticator to be configured in their deployment descriptor to use JASPI security domains.

2.3.4.2. JACC

Java Authorization Contract for Containers (JACC) is a standard which 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 6 implements support for JACC within the security functionality of the security subsystem.

2.3.4.3. About Fine Grained Authorization and XACML

Fine Grained Authorization caters to the changing requirements and multiple variables involved in the decision making process, which becomes the basis of providing authorization for accessing a module. Hence, the process of Fine Grained Authorization is complex in itself.

Note

The XACML bindings (web, ejb) are not supported in JBoss EAP 6.

JBoss EAP uses XACML as a medium to achieve Fine Grained Authorization. XACML provides standards based solution to the complex nature of achieving Fine Grained Authorization. XACML defines a policy language and an architecture for decision making. The XACML architecture includes a Policy Enforcement Point (PEP), which intercepts any requests in a normal program flow, then asks a Policy Decision Point (PDP) to make an access decision based on the policies associated with the PDP. The PDP evaluates the XACML request created by the PEP and runs through the policies to make one of the following access decisions:

PERMIT
The access is approved.
DENY
The access is denied.
INDETERMINATE
There is an error at the PDP.
NOTAPPLICABLE
There is some attribute missing in the request or there is no policy match.

XAMCL also has the following features:

  • Oasis XACML v2.0 library
  • JAXB v2.0 based object model
  • ExistDB Integration for storing/retrieving XACML Policies and Attributes

2.3.4.4. SSO

JBoss EAP 6 provides out of the box support for both clustered and non-clustered SSO via the web and Infinispan subsystems. This requires the following:

  • A configured security domain which handles authentication and authorization.
  • The SSO infinispan replication cache. It is present in the ha and full-ha profiles for a managed domain, or by using the standalone-ha or standalone-full-ha profile for a standalone server.
  • The web cache-container and SSO replication cache within it must each be present.
  • The web subsystem needs to be configured to use SSO.
  • Each application which will share the SSO information must be configured to use the same security domain.