Data Grid Security Guide
Enable and configure Data Grid security
Abstract
Red Hat Data Grid Copy linkLink copied to clipboard!
Data Grid is a high-performance, distributed in-memory data store.
- Schemaless data structure
- Flexibility to store different objects as key-value pairs.
- Grid-based data storage
- Designed to distribute and replicate data across clusters.
- Elastic scaling
- Dynamically adjust the number of nodes to meet demand without service disruption.
- Data interoperability
- Store, retrieve, and query data in the grid from different endpoints.
Data Grid documentation Copy linkLink copied to clipboard!
Documentation for Data Grid is available on the Red Hat customer portal.
Data Grid downloads Copy linkLink copied to clipboard!
Access the Data Grid Software Downloads on the Red Hat customer portal.
You must have a Red Hat account to access and download Data Grid software.
Making open source more inclusive Copy linkLink copied to clipboard!
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.
Chapter 1. Configuring user roles and permissions Copy linkLink copied to clipboard!
Authorization is a security feature that requires users to have certain permissions before they can access caches or interact with Data Grid resources. You assign roles to users that provide different levels of permissions, from read-only access to full, super user privileges.
1.1. Security authorization Copy linkLink copied to clipboard!
Data Grid authorization secures your deployment by restricting user access.
User applications or clients must belong to a role that is assigned with sufficient permissions before they can perform operations on Cache Managers or caches.
For example, you configure authorization on a specific cache instance so that invoking Cache.get() requires an identity to be assigned a role with read permission while Cache.put() requires a role with write permission.
In this scenario, if a user application or client with the io role attempts to write an entry, Data Grid denies the request and throws a security exception. If a user application or client with the writer role sends a write request, Data Grid validates authorization and issues a token for subsequent operations.
Identities
Identities are security Principals of type java.security.Principal. Subjects, implemented with the javax.security.auth.Subject class, represent a group of security Principals. In other words, a Subject represents a user and all groups to which it belongs.
Identities to roles
Data Grid uses role mappers so that security principals correspond to roles, which you assign one or more permissions.
The following image illustrates how security principals correspond to roles:
1.1.1. User roles and permissions Copy linkLink copied to clipboard!
Data Grid includes a default set of roles that grant users with permissions to access data and interact with Data Grid resources.
ClusterRoleMapper is the default mechanism that Data Grid uses to associate security principals to authorization roles.
ClusterRoleMapper matches principal names to role names. A user named admin gets admin permissions automatically, a user named deployer gets deployer permissions, and so on.
| Role | Permissions | Description |
|---|---|---|
|
| ALL | Superuser with all permissions including control of the Cache Manager lifecycle. |
|
| ALL_READ, ALL_WRITE, LISTEN, EXEC, MONITOR, CREATE |
Can create and delete Data Grid resources in addition to |
|
| ALL_READ, ALL_WRITE, LISTEN, EXEC, MONITOR |
Has read and write access to Data Grid resources in addition to |
|
| ALL_READ, MONITOR |
Has read access to Data Grid resources in addition to |
|
| MONITOR |
Can view statistics via JMX and the |
1.1.2. Permissions Copy linkLink copied to clipboard!
Authorization roles have different permissions with varying levels of access to Data Grid. Permissions let you restrict user access to both Cache Managers and caches.
1.1.2.1. Cache Manager permissions Copy linkLink copied to clipboard!
| Permission | Function | Description |
|---|---|---|
| CONFIGURATION |
| Defines new cache configurations. |
| LISTEN |
| Registers listeners against a Cache Manager. |
| LIFECYCLE |
| Stops the Cache Manager. |
| CREATE |
| Create and remove container resources such as caches, counters, schemas, and scripts. |
| MONITOR |
|
Allows access to JMX statistics and the |
| ALL | - | Includes all Cache Manager permissions. |
1.1.2.2. Cache permissions Copy linkLink copied to clipboard!
| Permission | Function | Description |
|---|---|---|
| READ |
| Retrieves entries from a cache. |
| WRITE |
| Writes, replaces, removes, evicts data in a cache. |
| EXEC |
| Allows code execution against a cache. |
| LISTEN |
| Registers listeners against a cache. |
| BULK_READ |
| Executes bulk retrieve operations. |
| BULK_WRITE |
| Executes bulk write operations. |
| LIFECYCLE |
| Starts and stops a cache. |
| ADMIN |
| Allows access to underlying components and internal structures. |
| MONITOR |
|
Allows access to JMX statistics and the |
| ALL | - | Includes all cache permissions. |
| ALL_READ | - | Combines the READ and BULK_READ permissions. |
| ALL_WRITE | - | Combines the WRITE and BULK_WRITE permissions. |
1.1.3. Role mappers Copy linkLink copied to clipboard!
Data Grid includes a PrincipalRoleMapper API that maps security Principals in a Subject to authorization roles that you can assign to users.
1.1.3.1. Cluster role mappers Copy linkLink copied to clipboard!
ClusterRoleMapper uses a persistent replicated cache to dynamically store principal-to-role mappings for the default roles and permissions.
By default uses the Principal name as the role name and implements org.infinispan.security.MutableRoleMapper which exposes methods to change role mappings at runtime.
-
Java class:
org.infinispan.security.mappers.ClusterRoleMapper -
Declarative configuration:
<cluster-role-mapper />
1.1.3.2. Identity role mappers Copy linkLink copied to clipboard!
IdentityRoleMapper uses the Principal name as the role name.
-
Java class:
org.infinispan.security.mappers.IdentityRoleMapper -
Declarative configuration:
<identity-role-mapper />
1.1.3.3. CommonName role mappers Copy linkLink copied to clipboard!
CommonNameRoleMapper uses the Common Name (CN) as the role name if the Principal name is a Distinguished Name (DN).
For example this DN, cn=managers,ou=people,dc=example,dc=com, maps to the managers role.
-
Java class:
org.infinispan.security.mappers.CommonRoleMapper -
Declarative configuration:
<common-name-role-mapper />
1.1.3.4. Custom role mappers Copy linkLink copied to clipboard!
Custom role mappers are implementations of org.infinispan.security.PrincipalRoleMapper.
-
Declarative configuration:
<custom-role-mapper class="my.custom.RoleMapper" />
1.2. Access control list (ACL) cache Copy linkLink copied to clipboard!
Data Grid caches roles that you grant to users internally for optimal performance. Whenever you grant or deny roles to users, Data Grid flushes the ACL cache to ensure user permissions are applied correctly.
If necessary, you can disable the ACL cache or configure it with the cache-size and cache-timeout attributes.
XML
JSON
YAML
1.3. Customizing roles and permissions Copy linkLink copied to clipboard!
You can customize authorization settings in your Data Grid configuration to use role mappers with different combinations of roles and permissions.
Procedure
- Declare a role mapper and a set of custom roles and permissions in the Cache Manager configuration.
- Configure authorization for caches to restrict access based on user roles.
Custom roles and permissions configuration
XML
JSON
YAML
1.4. Configuring caches with security authorization Copy linkLink copied to clipboard!
Use authorization in your cache configuration to restrict user access. Before they can read or write cache entries, or create and delete caches, users must have a role with a sufficient level of permission.
Prerequisites
Ensure the
authorizationelement is included in thesecuritysection of thecache-containerconfiguration.Data Grid enables security authorization in the Cache Manager by default and provides a global set of roles and permissions for caches.
- If necessary, declare custom roles and permissions in the Cache Manager configuration.
Procedure
- Open your cache configuration for editing.
-
Add the
authorizationelement to caches to restrict user access based on their roles and permissions. - Save the changes to your configuration.
Authorization configuration
The following configuration shows how to use implicit authorization configuration with default roles and permissions:
XML
<distributed-cache>
<security>
<!-- Inherit authorization settings from the cache-container. --> <authorization/>
</security>
</distributed-cache>
<distributed-cache>
<security>
<!-- Inherit authorization settings from the cache-container. --> <authorization/>
</security>
</distributed-cache>
JSON
YAML
distributedCache:
security:
authorization:
enabled: true
distributedCache:
security:
authorization:
enabled: true
Custom roles and permissions
XML
<distributed-cache>
<security>
<authorization roles="admin supervisor"/>
</security>
</distributed-cache>
<distributed-cache>
<security>
<authorization roles="admin supervisor"/>
</security>
</distributed-cache>
JSON
YAML
distributedCache:
security:
authorization:
enabled: true
roles: ["admin","supervisor"]
distributedCache:
security:
authorization:
enabled: true
roles: ["admin","supervisor"]
1.5. Disabling security authorization Copy linkLink copied to clipboard!
In local development environments you can disable authorization so that users do not need roles and permissions. Disabling security authorization means that any user can access data and interact with Data Grid resources.
Procedure
- Open your Data Grid configuration for editing.
-
Remove any
authorizationelements from thesecurityconfiguration for the Cache Manager. -
Remove any
authorizationconfiguration from your caches. - Save the changes to your configuration.
1.6. Programmatically configuring authorization Copy linkLink copied to clipboard!
When using embedded caches, you can configure authorization with the GlobalSecurityConfigurationBuilder and ConfigurationBuilder classes.
Procedure
Construct a
GlobalConfigurationBuilderthat enables authorization, specifies a role mapper, and defines a set of roles and permissions.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable authorization in the
ConfigurationBuilderfor caches to restrict access based on user roles.ConfigurationBuilder config = new ConfigurationBuilder(); config .security() .authorization() .enable();ConfigurationBuilder config = new ConfigurationBuilder(); config .security() .authorization() .enable();1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Implicitly adds all roles from the global configuration.
If you do not want to apply all roles to a cache, explicitly define the roles that are authorized for caches as follows:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Defines authorized roles for the cache. In this example, users who have the
writerrole only are not authorized for the "secured" cache. Data Grid denies any access requests from those users.
1.7. Code execution with security authorization Copy linkLink copied to clipboard!
When you configure security authorization for embedded caches and then construct a DefaultCacheManager, it returns a SecureCache that checks the security context before invoking any operations. A SecureCache also ensures that applications cannot retrieve lower-level insecure objects such as DataContainer. For this reason, you must execute code with an identity that has the required authorization.
In Java, executing code with a specific identity usually means wrapping the code to be executed within a PrivilegedAction as follows:
With Java 8, you can simplify the preceding call as follows:
Security.doAs(mySubject, PrivilegedAction<String>() -> cache.put("key", "value"));
Security.doAs(mySubject, PrivilegedAction<String>() -> cache.put("key", "value"));
The preceding call uses the Security.doAs() method instead of Subject.doAs(). You can use either method with Data Grid, however Security.doAs() provides better performance.
If you need the current Subject, use the following call to retrieve it from the Data Grid context or from the AccessControlContext:
Security.getSubject();
Security.getSubject();
Chapter 2. Security realms Copy linkLink copied to clipboard!
Security realms integrate Data Grid Server deployments with the network protocols and infrastructure in your environment that control access and verify user identities.
2.1. Creating security realms Copy linkLink copied to clipboard!
Add security realms to Data Grid Server configuration to control access to deployments. You can add one or more security realm to your configuration.
When you add security realms to your configuration, Data Grid Server automatically enables the matching authentication mechanisms for the Hot Rod and REST endpoints.
Prerequisites
- Add socket bindings to your Data Grid Server configuration as required.
Create keystores, or have a PEM file, to configure the security realm with TLS/SSL encryption.
Data Grid Server can also generate keystores at startup.
-
Provision the resources or services that the security realm configuration relies on.
For example, if you add a token realm, you need to provision OAuth services.
This procedure demonstrates how to configure multiple property realms. Before you begin, you need to create properties files that add users and assign permissions with the Command Line Interface (CLI). Use the user create commands as follows:
Run user create --help for examples and more information.
Adding credentials to a properties realm with the CLI creates the user only on the server instance to which you are connected. You must manually synchronize credentials in a properties realm to each node in the cluster.
Procedure
- Open your Data Grid Server configuration for editing.
-
Use the
security-realmselement in thesecurityconfiguration to contain create multiple security realms. Add a security realm with the
security-realmelement and give it a unique name with thenameattribute.ImportantDo not add special characters, such as hyphens (
-) or ampersands (&), to security realm names. Data Grid Server endpoints can become unreachable if security realm names contain special characters.To follow the example, create one security realm named
ApplicationRealmand another namedManagementRealm.-
Provide the TLS/SSL identify for Data Grid Server with the
server-identitieselement and configure a keystore as required. Specify the type of security realm by adding one the following elements or fields:
-
properties-realm -
ldap-realm -
token-realm -
truststore-realm
-
Specify properties for the type of security realm you are configuring as appropriate.
To follow the example, specify the
*.propertiesfiles you created with the CLI using thepathattribute on theuser-propertiesandgroup-propertieselements or fields.-
If you add multiple different types of security realm to your configuration, include the
distributed-realmelement or field so that Data Grid Server uses the realms in combination with each other. -
Configure Data Grid Server endpoints to use the security realm with the with the
security-realmattribute. - Save the changes to your configuration.
Multiple property realms
The following configuration shows how you can configure multiple security realms in XML, JSON, or YAML format:
XML
JSON
YAML
2.2. Setting up Kerberos identities Copy linkLink copied to clipboard!
Add Kerberos identities to a security realm in your Data Grid Server configuration to use keytab files that contain service principal names and encrypted keys, derived from Kerberos passwords.
Prerequisites
- Have Kerberos service account principals.
keytab files can contain both user and service account principals. However, Data Grid Server uses service account principals only which means it can provide identity to clients and allow clients to authenticate with Kerberos servers.
In most cases, you create unique principals for the Hot Rod and REST endpoints. For example, if you have a "datagrid" server in the "INFINISPAN.ORG" domain you should create the following service principals:
-
hotrod/datagrid@INFINISPAN.ORGidentifies the Hot Rod service. -
HTTP/datagrid@INFINISPAN.ORGidentifies the REST service.
Procedure
Create keytab files for the Hot Rod and REST services.
- Linux
ktutil ktutil: addent -password -p datagrid@INFINISPAN.ORG -k 1 -e aes256-cts Password for datagrid@INFINISPAN.ORG: [enter your password] ktutil: wkt http.keytab ktutil: quit
ktutil ktutil: addent -password -p datagrid@INFINISPAN.ORG -k 1 -e aes256-cts Password for datagrid@INFINISPAN.ORG: [enter your password] ktutil: wkt http.keytab ktutil: quitCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Microsoft Windows
ktpass -princ HTTP/datagrid@INFINISPAN.ORG -pass * -mapuser INFINISPAN\USER_NAME ktab -k http.keytab -a HTTP/datagrid@INFINISPAN.ORG
ktpass -princ HTTP/datagrid@INFINISPAN.ORG -pass * -mapuser INFINISPAN\USER_NAME ktab -k http.keytab -a HTTP/datagrid@INFINISPAN.ORGCopy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Copy the keytab files to the
server/confdirectory of your Data Grid Server installation. - Open your Data Grid Server configuration for editing.
-
Add a
server-identitiesdefinition to the Data Grid server security realm. - Specify the location of keytab files that provide service principals to Hot Rod and REST connectors.
- Name the Kerberos service principals.
- Save the changes to your configuration.
Kerberos identity configuration
XML
JSON
YAML
2.3. Property realms Copy linkLink copied to clipboard!
Property realms use property files to define users and groups.
-
users.propertiescontains Data Grid user credentials. Passwords can be pre-digested with theDIGEST-MD5andDIGESTauthentication mechanisms. -
groups.propertiesassociates users with roles and permissions.
Properties files contain headers that associate them with security realms in Data Grid Server configuration.
users.properties
myuser=a_password user2=another_password
myuser=a_password
user2=another_password
groups.properties
myuser=supervisor,reader,writer user2=supervisor
myuser=supervisor,reader,writer
user2=supervisor
Property realm configuration
XML
JSON
YAML
2.4. LDAP realms Copy linkLink copied to clipboard!
LDAP realms connect to LDAP servers, such as OpenLDAP, Red Hat Directory Server, Apache Directory Server, or Microsoft Active Directory, to authenticate users and obtain membership information.
LDAP servers can have different entry layouts, depending on the type of server and deployment. It is beyond the scope of this document to provide examples for all possible configurations.
The principal for LDAP connections must have necessary privileges to perform LDAP queries and access specific attributes.
As an alternative to verifying user credentials with the direct-verification attribute, you can specify an LDAP attribute that validates passwords with the user-password-mapper element.
You cannot use endpoint authentication mechanisms that perform hashing with the direct-verification attribute.
Because Active Directory does not expose the password attribute you can use the direct-verification attribute only and not the user-password-mapper element. As a result you must use the BASIC authentication mechanism with the REST endpoint and PLAIN with the Hot Rod endpoint to integrate with Active Directory Server. A more secure alternative is to use Kerberos, which allows the SPNEGO, GSSAPI, and GS2-KRB5 authentication mechanisms.
The rdn-identifier attribute specifies an LDAP attribute that finds the user entry based on a provided identifier, which is typically a username; for example, the uid or sAMAccountName attribute. Add search-recursive="true" to the configuration to search the directory recursively. By default, the search for the user entry uses the (rdn_identifier={0}) filter. Specify a different filter with the filter-name attribute.
The attribute-mapping element retrieves all the groups of which the user is a member. There are typically two ways in which membership information is stored:
-
Under group entries that usually have class
groupOfNamesin thememberattribute. In this case, you can use an attribute filter as in the preceding example configuration. This filter searches for entries that match the supplied filter, which locates groups with amemberattribute equal to the user’s DN. The filter then extracts the group entry’s CN as specified byfrom, and adds it to the user’sRoles. In the user entry in the
memberOfattribute. In this case you should use an attribute reference such as the following:<attribute-reference reference="memberOf" from="cn" to="Roles" />This reference gets all
memberOfattributes from the user’s entry, extracts the CN as specified byfrom, and adds them to the user’sRoles.
LDAP realm configuration
XML
JSON
YAML
2.4.1. LDAP realm principal re-writing Copy linkLink copied to clipboard!
SASL authentication mechanisms such as GSSAPI, GS2-KRB5 and Negotiate include a username that needs to be cleaned up before you can use it to search LDAP directories.
XML
JSON
YAML
2.5. Token realms Copy linkLink copied to clipboard!
Token realms use external services to validate tokens and require providers that are compatible with RFC-7662 (OAuth2 Token Introspection), such as Red Hat SSO.
Token realm configuration
XML
JSON
YAML
2.6. Trust store realms Copy linkLink copied to clipboard!
Trust store realms use certificates, or certificates chains, that verify Data Grid Server and client identities when they negotiate connections.
- Keystores
- Contain server certificates that provide a Data Grid Server identity to clients. If you configure a keystore with server certificates, Data Grid Server encrypts traffic using industry standard SSL/TLS protocols.
- Trust stores
- Contain client certificates, or certificate chains, that clients present to Data Grid Server. Client trust stores are optional and allow Data Grid Server to perform client certificate authentication.
Client certificate authentication
You must add the require-ssl-client-auth="true" attribute to the endpoint configuration if you want Data Grid Server to validate or authenticate client certificates.
Trust store realm configuration
XML
JSON
YAML
2.7. Distributed security realms Copy linkLink copied to clipboard!
Distributed realms combine multiple different types of security realms. When users attempt to access the Hot Rod or REST endpoints, Data Grid Server uses each security realm in turn until it finds one that can perform the authentication.
Distributed realm configuration
XML
JSON
YAML
Chapter 3. Endpoint authentication mechanisms Copy linkLink copied to clipboard!
Data Grid Server can use custom SASL and HTTP authentication mechanisms for Hot Rod and REST endpoints.
3.1. Data Grid Server authentication Copy linkLink copied to clipboard!
Authentication restricts user access to endpoints as well as the Data Grid Console and Command Line Interface (CLI).
Data Grid Server includes a "default" security realm that enforces user authentication. Default authentication uses a property realm with user credentials stored in the server/conf/users.properties file. Data Grid Server also enables security authorization by default so you must assign users with permissions stored in the server/conf/groups.properties file.
Use the user create command with the Command Line Interface (CLI) to add users and assign permissions. Run user create --help for examples and more information.
3.2. Configuring Data Grid Server authentication mechanisms Copy linkLink copied to clipboard!
You can explicitly configure Hot Rod and REST endpoints to use specific authentication mechanisms. Configuring authentication mechanisms is required only if you need to explicitly override the default mechanisms for a security realm.
Each endpoint section in your configuration must include hotrod-connector and rest-connector elements or fields. For example, if you explicitly declare a hotrod-connector you must also declare a rest-connector even if it does not configure an authentication mechanism.
Prerequisites
- Add security realms to your Data Grid Server configuration as required.
Procedure
- Open your Data Grid Server configuration for editing.
-
Add an
endpointelement or field and specify the security realm that it uses with thesecurity-realmattribute. Add a
hotrod-connectorelement or field to configure the Hot Rod endpoint.-
Add an
authenticationelement or field. -
Specify SASL authentication mechanisms for the Hot Rod endpoint to use with the
sasl mechanismsattribute. -
If applicable, specify SASL quality of protection settings with the
qopattribute. -
Specify the Data Grid Server identity with the
server-nameattribute if necessary.
-
Add an
Add a
rest-connectorelement or field to configure the REST endpoint.-
Add an
authenticationelement or field. -
Specify HTTP authentication mechanisms for the REST endpoint to use with the
mechanismsattribute.
-
Add an
- Save the changes to your configuration.
Authentication mechanism configuration
The following configuration specifies SASL mechanisms for the Hot Rod endpoint to use for authentication:
XML
JSON
YAML
3.2.1. Disabling authentication Copy linkLink copied to clipboard!
In local development environments or on isolated networks you can configure Data Grid to allow unauthenticated client requests. When you disable user authentication you should also disable authorization in your Data Grid security configuration.
Procedure
- Open your Data Grid Server configuration for editing.
-
Remove the
security-realmattribute from theendpointselement or field. -
Remove any
authorizationelements from thesecurityconfiguration for thecache-containerand each cache configuration. - Save the changes to your configuration.
XML
<server xmlns="urn:infinispan:server:13.0"> <endpoints socket-binding="default"/> </server>
<server xmlns="urn:infinispan:server:13.0">
<endpoints socket-binding="default"/>
</server>
JSON
YAML
server:
endpoints:
endpoint:
socketBinding: "default"
server:
endpoints:
endpoint:
socketBinding: "default"
3.3. Data Grid Server authentication mechanisms Copy linkLink copied to clipboard!
Data Grid Server automatically configures endpoints with authentication mechanisms that match your security realm configuration. For example, if you add a Kerberos security realm then Data Grid Server enables the GSSAPI and GS2-KRB5 authentication mechanisms for the Hot Rod endpoint.
Hot Rod endpoints
Data Grid Server enables the following SASL authentication mechanisms for Hot Rod endpoints when your configuration includes the corresponding security realm:
| Security realm | SASL authentication mechanism |
|---|---|
| Property realms and LDAP realms |
SCRAM-*, DIGEST-*, |
| Token realms | OAUTHBEARER |
| Trust realms | EXTERNAL |
| Kerberos identities | GSSAPI, GS2-KRB5 |
| SSL/TLS identities | PLAIN |
REST endpoints
Data Grid Server enables the following HTTP authentication mechanisms for REST endpoints when your configuration includes the corresponding security realm:
| Security realm | HTTP authentication mechanism |
|---|---|
| Property realms and LDAP realms | DIGEST |
| Token realms | BEARER_TOKEN |
| Trust realms | CLIENT_CERT |
| Kerberos identities | SPNEGO |
| SSL/TLS identities | BASIC |
3.3.1. SASL authentication mechanisms Copy linkLink copied to clipboard!
Data Grid Server supports the following SASL authentications mechanisms with Hot Rod endpoints:
| Authentication mechanism | Description | Security realm type | Related details |
|---|---|---|---|
|
|
Uses credentials in plain-text format. You should use | Property realms and LDAP realms |
Similar to the |
|
|
Uses hashing algorithms and nonce values. Hot Rod connectors support | Property realms and LDAP realms |
Similar to the |
|
|
Uses salt values in addition to hashing algorithms and nonce values. Hot Rod connectors support | Property realms and LDAP realms |
Similar to the |
|
|
Uses Kerberos tickets and requires a Kerberos Domain Controller. You must add a corresponding | Kerberos realms |
Similar to the |
|
|
Uses Kerberos tickets and requires a Kerberos Domain Controller. You must add a corresponding | Kerberos realms |
Similar to the |
|
| Uses client certificates. | Trust store realms |
Similar to the |
|
|
Uses OAuth tokens and requires a | Token realms |
Similar to the |
3.3.2. SASL quality of protection (QoP) Copy linkLink copied to clipboard!
If SASL mechanisms support integrity and privacy protection (QoP) settings, you can add them to your Hot Rod endpoint configuration with the qop attribute.
| QoP setting | Description |
|---|---|
|
| Authentication only. |
|
| Authentication with integrity protection. |
|
| Authentication with integrity and privacy protection. |
3.3.3. SASL policies Copy linkLink copied to clipboard!
SASL policies provide fine-grain control over Hot Rod authentication mechanisms.
Data Grid cache authorization restricts access to caches based on roles and permissions. Configure cache authorization and then set <no-anonymous value=false /> to allow anonymous login and delegate access logic to cache authorization.
| Policy | Description | Default value |
|---|---|---|
|
| Use only SASL mechanisms that support forward secrecy between sessions. This means that breaking into one session does not automatically provide information for breaking into future sessions. | false |
|
| Use only SASL mechanisms that require client credentials. | false |
|
| Do not use SASL mechanisms that are susceptible to simple plain passive attacks. | false |
|
| Do not use SASL mechanisms that are susceptible to active, non-dictionary, attacks. | false |
|
| Do not use SASL mechanisms that are susceptible to passive dictionary attacks. | false |
|
| Do not use SASL mechanisms that accept anonymous logins. | true |
SASL policy configuration
In the following configuration the Hot Rod endpoint uses the GSSAPI mechanism for authentication because it is the only mechanism that complies with all SASL policies:
XML
JSON
YAML
3.3.4. HTTP authentication mechanisms Copy linkLink copied to clipboard!
Data Grid Server supports the following HTTP authentication mechanisms with REST endpoints:
| Authentication mechanism | Description | Security realm type | Related details |
|---|---|---|---|
|
|
Uses credentials in plain-text format. You should use | Property realms and LDAP realms |
Corresponds to the |
|
|
Uses hashing algorithms and nonce values. REST connectors support | Property realms and LDAP realms |
Corresponds to the |
|
|
Uses Kerberos tickets and requires a Kerberos Domain Controller. You must add a corresponding | Kerberos realms |
Corresponds to the |
|
|
Uses OAuth tokens and requires a | Token realms |
Corresponds to the |
|
| Uses client certificates. | Trust store realms |
Similar to the |
Chapter 4. Configuring TLS/SSL encryption Copy linkLink copied to clipboard!
You can secure Data Grid Server connections using SSL/TLS encryption by configuring a keystore that contains public and private keys for Data Grid. You can also configure client certificate authentication if you require mutual TLS.
4.1. Configuring Data Grid Server keystores Copy linkLink copied to clipboard!
Add keystores to Data Grid Server and configure it to present SSL/TLS certificates that verify its identity to clients. If a security realm contains TLS/SSL identities, it encrypts any connections to Data Grid Server endpoints that use that security realm.
Prerequisites
- Create a keystore that contains certificates, or certificate chains, for Data Grid Server.
Data Grid Server supports the following keystore formats: JKS, JCEKS, PKCS12/PFX and PEM. BKS, BCFKS, and UBER are also supported if the Bouncy Castle library is present.
In production environments, server certificates should be signed by a trusted Certificate Authority, either Root or Intermediate CA.
You can use PEM files as keystores if they contain both of the following:
- A private key in PKCS#1 or PKCS#8 format.
- One or more certificates.
You should also configure PEM file keystores with an empty password (password="").
Procedure
- Open your Data Grid Server configuration for editing.
-
Add the keystore that contains SSL/TLS identities for Data Grid Server to the
$RHDG_HOME/server/confdirectory. -
Add a
server-identitiesdefinition to the Data Grid Server security realm. -
Specify the keystore file name with the
pathattribute. -
Provide the keystore password and certificate alias with the
keystore-passwordandaliasattributes. - Save the changes to your configuration.
Next steps
Configure clients with a trust store so they can verify SSL/TLS identities for Data Grid Server.
Keystore configuration
XML
JSON
YAML
4.1.1. Generating Data Grid Server keystores Copy linkLink copied to clipboard!
Configure Data Grid Server to automatically generate keystores at startup.
Automatically generated keystores:
- Should not be used in production environments.
- Are generated whenever necessary; for example, while obtaining the first connection from a client.
- Contain certificates that you can use directly in Hot Rod clients.
Procedure
- Open your Data Grid Server configuration for editing.
-
Include the
generate-self-signed-certificate-hostattribute for thekeystoreelement in the server configuration. - Specify a hostname for the server certificate as the value.
- Save the changes to your configuration.
Generated keystore configuration
XML
JSON
YAML
4.1.2. Configuring TLS versions and cipher suites Copy linkLink copied to clipboard!
When using SSL/TLS encryption to secure your deployment, you can configure Data Grid Server to use specific versions of the TLS protocol as well as specific cipher suites within the protocol.
Procedure
- Open your Data Grid Server configuration for editing.
-
Add the
engineelement to the SSL configuration for Data Grid Server. Configure Data Grid to use one or more TLS versions with the
enabled-protocolsattribute.Data Grid Server supports TLS version 1.2 and 1.3 by default. If appropriate you can set
TLSv1.3only to restrict the security protocol for client connections. Data Grid does not recommend enablingTLSv1.1because it is an older protocol with limited support and provides weak security. You should never enable any version of TLS older than 1.1.WarningIf you modify the SSL
engineconfiguration for Data Grid Server you must explicitly configure TLS versions with theenabled-protocolsattribute. Omitting theenabled-protocolsattribute allows any TLS version.<engine enabled-protocols="TLSv1.3 TLSv1.2" />
<engine enabled-protocols="TLSv1.3 TLSv1.2" />Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure Data Grid to use one or more cipher suites with the
enabled-ciphersuitesattribute (for TLSv1.2 and below) and theenabled-ciphersuites-tls13attribute (for TLSv1.3).You must ensure that you set a cipher suite that supports any protocol features you plan to use; for example
HTTP/2 ALPN.- Save the changes to your configuration.
SSL engine configuration
XML
JSON
YAML
4.2. Configuring Data Grid Server on a system with FIPS 140-2 compliant cryptography Copy linkLink copied to clipboard!
FIPS (Federal Information Processing Standards) are standards and guidelines for US federal computer systems. Although FIPS are developed for use by the US federal government, many in the private sector voluntarily use these standards.
FIPS 140-2 defines security requirements for cryptographic modules. You can configure your Data Grid Server to use encryption ciphers that adhere to the FIPS 140-2 specification by using alternative JDK security providers.
Additional resources
4.2.1. Configuring the PKCS11 cryptographic provider Copy linkLink copied to clipboard!
You can configure the PKCS11 cryptographic provider by specifying the PKCS11 keystore with the SunPKCS11-NSS-FIPS provider.
Prerequisites
-
Configure your system for FIPS mode. You can check if your system has FIPS Mode enabled by issuing the
fips-mode-setup --checkcommand in your Data Grid command-line Interface (CLI) -
Initialize the system-wide NSS database by using the
certutiltool. -
Install the JDK with the
java.securityfile configured to enable theSunPKCS11provider. This provider points to the NSS database and the SSL provider. - Install a certificate in the NSS database.
The OpenSSL provider requires a private key, but you cannot retrieve a private key from the PKCS#11 store. FIPS blocks the export of unencrypted keys from a FIPS-compliant cryptographic module, so you cannot use the OpenSSL provider for TLS when in FIPS mode. You can disable the OpenSSL provider at startup with the -Dorg.infinispan.openssl=false argument.
Procedure
- Open your Data Grid Server configuration for editing.
-
Add a
server-identitiesdefinition to the Data Grid Server security realm. -
Specify the PKCS11 keystore with the
SunPKCS11-NSS-FIPSprovider. - Save the changes to your configuration.
Keystore configuration
XML
JSON
YAML
4.2.2. Configuring the Bouncy Castle FIPS cryptographic provider Copy linkLink copied to clipboard!
You can configure the Bouncy Castle FIPS (Federal Information Processing Standards) cryptographic provider in your Data Grid server’s configuration.
Prerequisites
-
Configure your system for FIPS mode. You can check if your system has FIPS Mode enabled by issuing the
fips-mode-setup --checkcommand in your Data Grid command-line Interface (CLI). - Create a keystore in BCFKS format that contains a certificate.
Procedure
-
Download the Bouncy Castle FIPS JAR file, and add the file to the
server/libdirectory of your Data Grid Server installation. To install Bouncy Castle, issue the
installcommand:[disconnected]> install org.bouncycastle:bc-fips:1.0.2.3
[disconnected]> install org.bouncycastle:bc-fips:1.0.2.3Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Open your Data Grid Server configuration for editing.
-
Add a
server-identitiesdefinition to the Data Grid Server security realm. -
Specify the BCFKS keystore with the
BCFIPSprovider. - Save the changes to your configuration.
Keystore configuration
XML
JSON
YAML
4.3. Configuring client certificate authentication Copy linkLink copied to clipboard!
Configure Data Grid Server to use mutual TLS to secure client connections.
You can configure Data Grid to verify client identities from certificates in a trust store in two ways:
- Require a trust store that contains only the signing certificate, which is typically a Certificate Authority (CA). Any client that presents a certificate signed by the CA can connect to Data Grid.
- Require a trust store that contains all client certificates in addition to the signing certificate. Only clients that present a signed certificate that is present in the trust store can connect to Data Grid.
Alternatively to providing trust stores you can use shared system certificates.
Prerequisites
- Create a client trust store that contains either the CA certificate or all public certificates.
- Create a keystore for Data Grid Server and configure an SSL/TLS identity.
PEM files can be used as trust stores provided they contain one or more certificates. These trust stores should be configured with an empty password: password="".
Procedure
- Open your Data Grid Server configuration for editing.
-
Add the
require-ssl-client-auth="true"parameter to yourendpointsconfiguration. -
Add the client trust store to the
$RHDG_HOME/server/confdirectory. -
Specify the
pathandpasswordattributes for thetruststoreelement in the Data Grid Server security realm configuration. -
Add the
<truststore-realm/>element to the security realm if you want Data Grid Server to authenticate each client certificate. - Save the changes to your configuration.
Next steps
- Set up authorization with client certificates in the Data Grid Server configuration if you control access with security roles and permissions.
- Configure clients to negotiate SSL/TLS connections with Data Grid Server.
Client certificate authentication configuration
XML
JSON
YAML
4.4. Configuring authorization with client certificates Copy linkLink copied to clipboard!
Enabling client certificate authentication means you do not need to specify Data Grid user credentials in client configuration, which means you must associate roles with the Common Name (CN) field in the client certificate(s).
Prerequisites
- Provide clients with a Java keystore that contains either their public certificates or part of the certificate chain, typically a public CA certificate.
- Configure Data Grid Server to perform client certificate authentication.
Procedure
- Open your Data Grid Server configuration for editing.
-
Enable the
common-name-role-mapperin the security authorization configuration. -
Assign the Common Name (
CN) from the client certificate a role with the appropriate permissions. - Save the changes to your configuration.
Client certificate authorization configuration
XML
JSON
YAML
Chapter 5. Storing Data Grid Server credentials in keystores Copy linkLink copied to clipboard!
External services require credentials to authenticate with Data Grid Server. To protect sensitive text strings such as passwords, add them to a credential keystore rather than directly in Data Grid Server configuration files.
You can then configure Data Grid Server to decrypt passwords for establishing connections with services such as databases or LDAP directories.
Plain-text passwords in $RHDG_HOME/server/conf are unencrypted. Any user account with read access to the host filesystem can view plain-text passwords.
While credential keystores are password-protected store encrypted passwords, any user account with write access to the host filesystem can tamper with the keystore itself.
To completely secure Data Grid Server credentials, you should grant read-write access only to user accounts that can configure and run Data Grid Server.
5.1. Setting up credential keystores Copy linkLink copied to clipboard!
Create keystores that encrypt credential for Data Grid Server access.
A credential keystore contains at least one alias that is associated with an encrypted password. After you create a keystore, you specify the alias in a connection configuration such as a database connection pool. Data Grid Server then decrypts the password for that alias from the keystore when the service attempts authentication.
You can create as many credential keystores with as many aliases as required.
Procedure
-
Open a terminal in
$RHDG_HOME. Create a keystore and add credentials to it with the
credentialscommand.TipBy default, keystores are of type PKCS12. Run
help credentialsfor details on changing keystore defaults.The following example shows how to create a keystore that contains an alias of "dbpassword" for the password "changeme". When you create a keystore you also specify a password for the keystore with the
-pargument.- Linux
bin/cli.sh credentials add dbpassword -c changeme -p "secret1234!"
bin/cli.sh credentials add dbpassword -c changeme -p "secret1234!"Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Microsoft Windows
bin\cli.bat credentials add dbpassword -c changeme -p "secret1234!"
bin\cli.bat credentials add dbpassword -c changeme -p "secret1234!"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Check that the alias is added to the keystore.
bin/cli.sh credentials ls -p "secret1234!" dbpassword
bin/cli.sh credentials ls -p "secret1234!" dbpasswordCopy to Clipboard Copied! Toggle word wrap Toggle overflow Configure Data Grid to use the credential keystore.
-
Specify the name and location of the credential keystore in the
credential-storesconfiguration. Provide the credential keystore and alias in the
credential-referenceconfiguration.TipAttributes in the
credential-referenceconfiguration are optional.-
storeis required only if you have multiple keystores. -
aliasis required only if the keystore contains multiple aliases.
-
-
Specify the name and location of the credential keystore in the
5.2. Credential keystore configuration Copy linkLink copied to clipboard!
This topic provides examples of credential keystores in Data Grid Server configuration.
Credential keystores
XML
JSON
YAML
Datasource connections
XML
JSON
YAML
LDAP connections
XML
JSON
YAML
Chapter 6. Encrypting cluster transport Copy linkLink copied to clipboard!
Secure cluster transport so that nodes communicate with encrypted messages. You can also configure Data Grid clusters to perform certificate authentication so that only nodes with valid identities can join.
6.1. Securing cluster transport with TLS identities Copy linkLink copied to clipboard!
Add SSL/TLS identities to a Data Grid Server security realm and use them to secure cluster transport. Nodes in the Data Grid Server cluster then exchange SSL/TLS certificates to encrypt JGroups messages, including RELAY messages if you configure cross-site replication.
Prerequisites
- Install a Data Grid Server cluster.
Procedure
Create a TLS keystore that contains a single certificate to identify Data Grid Server.
You can also use a PEM file if it contains a private key in PKCS#1 or PKCS#8 format, a certificate, and has an empty password:
password="".NoteIf the certificate in the keystore is not signed by a public certificate authority (CA) then you must also create a trust store that contains either the signing certificate or the public key.
-
Add the keystore to the
$RHDG_HOME/server/confdirectory. Add the keystore to a new security realm in your Data Grid Server configuration.
ImportantYou should create dedicated keystores and security realms so that Data Grid Server endpoints do not use the same security realm as cluster transport.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure cluster transport to use the security realm by specifying the name of the security realm with the
server:security-realmattribute.<infinispan> <cache-container> <transport server:security-realm="cluster-transport"/> </cache-container> </infinispan><infinispan> <cache-container> <transport server:security-realm="cluster-transport"/> </cache-container> </infinispan>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
When you start Data Grid Server, the following log message indicates that the cluster is using the security realm for cluster transport:
[org.infinispan.SERVER] ISPN080060: SSL Transport using realm <security_realm_name>
[org.infinispan.SERVER] ISPN080060: SSL Transport using realm <security_realm_name>
6.2. JGroups encryption protocols Copy linkLink copied to clipboard!
To secure cluster traffic, you can configure Data Grid nodes to encrypt JGroups message payloads with secret keys.
Data Grid nodes can obtain secret keys from either:
- The coordinator node (asymmetric encryption).
- A shared keystore (symmetric encryption).
Retrieving secret keys from coordinator nodes
You configure asymmetric encryption by adding the ASYM_ENCRYPT protocol to a JGroups stack in your Data Grid configuration. This allows Data Grid clusters to generate and distribute secret keys.
When using asymmetric encryption, you should also provide keystores so that nodes can perform certificate authentication and securely exchange secret keys. This protects your cluster from man-in-the-middle (MitM) attacks.
Asymmetric encryption secures cluster traffic as follows:
- The first node in the Data Grid cluster, the coordinator node, generates a secret key.
- A joining node performs certificate authentication with the coordinator to mutually verify identity.
- The joining node requests the secret key from the coordinator node. That request includes the public key for the joining node.
- The coordinator node encrypts the secret key with the public key and returns it to the joining node.
- The joining node decrypts and installs the secret key.
- The node joins the cluster, encrypting and decrypting messages with the secret key.
Retrieving secret keys from shared keystores
You configure symmetric encryption by adding the SYM_ENCRYPT protocol to a JGroups stack in your Data Grid configuration. This allows Data Grid clusters to obtain secret keys from keystores that you provide.
- Nodes install the secret key from a keystore on the Data Grid classpath at startup.
- Node join clusters, encrypting and decrypting messages with the secret key.
Comparison of asymmetric and symmetric encryption
ASYM_ENCRYPT with certificate authentication provides an additional layer of encryption in comparison with SYM_ENCRYPT. You provide keystores that encrypt the requests to coordinator nodes for the secret key. Data Grid automatically generates that secret key and handles cluster traffic, while letting you specify when to generate secret keys. For example, you can configure clusters to generate new secret keys when nodes leave. This ensures that nodes cannot bypass certificate authentication and join with old keys.
SYM_ENCRYPT, on the other hand, is faster than ASYM_ENCRYPT because nodes do not need to exchange keys with the cluster coordinator. A potential drawback to SYM_ENCRYPT is that there is no configuration to automatically generate new secret keys when cluster membership changes. Users are responsible for generating and distributing the secret keys that nodes use to encrypt cluster traffic.
6.3. Securing cluster transport with asymmetric encryption Copy linkLink copied to clipboard!
Configure Data Grid clusters to generate and distribute secret keys that encrypt JGroups messages.
Procedure
- Create a keystore with certificate chains that enables Data Grid to verify node identity.
Place the keystore on the classpath for each node in the cluster.
For Data Grid Server, you put the keystore in the $RHDG_HOME directory.
Add the
SSL_KEY_EXCHANGEandASYM_ENCRYPTprotocols to a JGroups stack in your Data Grid configuration, as in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
When you start your Data Grid cluster, the following log message indicates that the cluster is using the secure JGroups stack:
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack <encrypted_stack_name>
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack <encrypted_stack_name>
Data Grid nodes can join the cluster only if they use ASYM_ENCRYPT and can obtain the secret key from the coordinator node. Otherwise the following message is written to Data Grid logs:
[org.jgroups.protocols.ASYM_ENCRYPT] <hostname>: received message without encrypt header from <hostname>; dropping it
[org.jgroups.protocols.ASYM_ENCRYPT] <hostname>: received message without encrypt header from <hostname>; dropping it
6.4. Securing cluster transport with symmetric encryption Copy linkLink copied to clipboard!
Configure Data Grid clusters to encrypt JGroups messages with secret keys from keystores that you provide.
Procedure
- Create a keystore that contains a secret key.
Place the keystore on the classpath for each node in the cluster.
For Data Grid Server, you put the keystore in the $RHDG_HOME directory.
-
Add the
SYM_ENCRYPTprotocol to a JGroups stack in your Data Grid configuration.
Verification
When you start your Data Grid cluster, the following log message indicates that the cluster is using the secure JGroups stack:
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack <encrypted_stack_name>
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack <encrypted_stack_name>
Data Grid nodes can join the cluster only if they use SYM_ENCRYPT and can obtain the secret key from the shared keystore. Otherwise the following message is written to Data Grid logs:
[org.jgroups.protocols.SYM_ENCRYPT] <hostname>: received message without encrypt header from <hostname>; dropping it
[org.jgroups.protocols.SYM_ENCRYPT] <hostname>: received message without encrypt header from <hostname>; dropping it
Chapter 7. Data Grid ports and protocols Copy linkLink copied to clipboard!
As Data Grid distributes data across your network and can establish connections for external client requests, you should be aware of the ports and protocols that Data Grid uses to handle network traffic.
If run Data Grid as a remote server then you might need to allow remote clients through your firewall. Likewise, you should adjust ports that Data Grid nodes use for cluster communication to prevent conflicts or network issues.
7.1. Data Grid Server ports and protocols Copy linkLink copied to clipboard!
Data Grid Server provides network endpoints that allow client access with different protocols.
| Port | Protocol | Description |
|---|---|---|
|
| TCP | Hot Rod and REST |
|
| TCP | Memcached (disabled by default) |
Single port
Data Grid Server exposes multiple protocols through a single TCP port, 11222. Handling multiple protocols with a single port simplifies configuration and reduces management complexity when deploying Data Grid clusters. Using a single port also enhances security by minimizing the attack surface on the network.
Data Grid Server handles HTTP/1.1, HTTP/2, and Hot Rod protocol requests from clients via the single port in different ways.
HTTP/1.1 upgrade headers
Client requests can include the HTTP/1.1 upgrade header field to initiate HTTP/1.1 connections with Data Grid Server. Client applications can then send the Upgrade: protocol header field, where protocol is a server endpoint.
Application-Layer Protocol Negotiation (ALPN)/Transport Layer Security (TLS)
Client requests include Server Name Indication (SNI) mappings for Data Grid Server endpoints to negotiate protocols over a TLS connection.
Applications must use a TLS library that supports the ALPN extension. Data Grid uses WildFly OpenSSL bindings for Java.
Automatic Hot Rod detection
Client requests that include Hot Rod headers automatically route to Hot Rod endpoints.
7.1.1. Configuring network firewalls for Data Grid traffic Copy linkLink copied to clipboard!
Adjust firewall rules to allow traffic between Data Grid Server and client applications.
Procedure
On Red Hat Enterprise Linux (RHEL) workstations, for example, you can allow traffic to port 11222 with firewalld as follows:
firewall-cmd --add-port=11222/tcp --permanent success firewall-cmd --list-ports | grep 11222 11222/tcp
# firewall-cmd --add-port=11222/tcp --permanent
success
# firewall-cmd --list-ports | grep 11222
11222/tcp
To configure firewall rules that apply across a network, you can use the nftables utility.
7.2. TCP and UDP ports for cluster traffic Copy linkLink copied to clipboard!
Data Grid uses the following ports for cluster transport messages:
| Default Port | Protocol | Description |
|---|---|---|
|
| TCP/UDP | JGroups cluster bind port |
|
| UDP | JGroups multicast |
Cross-site replication
Data Grid uses the following ports for the JGroups RELAY2 protocol:
7900- For Data Grid clusters running on OpenShift.
7800- If using UDP for traffic between nodes and TCP for traffic between clusters.
7801- If using TCP for traffic between nodes and TCP for traffic between clusters.