Questo contenuto non è disponibile nella lingua selezionata.
Chapter 6. Securing Data Grid Servers
Protect Data Grid servers against network attacks and unauthorized access.
6.1. Cache Authorization Copia collegamentoCollegamento copiato negli appunti!
Data Grid can restrict access to data by authorizing requests to perform cache operations.
Data Grid maps identities, or Principals of type java.security.Principal
, to security roles in your configuration. For example, a Principal named reader
maps to a security role named reader
.
Data Grid lets you assign permissions to the various roles to authorize cache operations. For example, Cache.get()
requires read permission while Cache.put()
requires write permission.
In this case, iff a client with the reader
role attempts to write an entry, Data Grid denies the request and throws a security exception. However, if a client with the writer
role sends a write request, Data Grid validates authorization and issues the client with a token for subsequent operations.
6.1.1. Cache Authorization Configuration Copia collegamentoCollegamento copiato negli appunti!
Data Grid configuration for cache authorization is as follows:
6.2. Defining Data Grid Server Security Realms Copia collegamentoCollegamento copiato negli appunti!
Security realms provide identity, encryption, authentication, and authorization information to Data Grid server endpoints.
6.2.1. Property Realms Copia collegamentoCollegamento copiato negli appunti!
Property realms use property files to define users and groups.
users.properties
maps usernames to passwords in plain-text format. Passwords can also be pre-digested if you use the DIGEST-MD5
SASL mechanism or Digest
HTTP mechanism.
myuser=a_password user2=another_password
myuser=a_password
user2=another_password
groups.properties
maps users to roles.
supervisor=myuser,user2 reader=myuser writer=myuser
supervisor=myuser,user2
reader=myuser
writer=myuser
Property realm configuration
Supported authentication mechanisms
Property realms support the following authentication mechanisms:
-
SASL:
PLAIN
,DIGEST-*
, andSCRAM-*
-
HTTP (REST):
Basic
andDigest
6.2.1.1. Adding Users to Property Realms Copia collegamentoCollegamento copiato negli appunti!
Data Grid server provides a user-tool
script that lets you easily add new user/role mappings to properties files.
Procedure
-
Navigate to your
$ISPN_HOME
directory. -
Run the
user-tool
script in thebin
folder.
For example, create a new user named "myuser" with a password of "qwer1234!" that belongs to the "supervisor", "reader", and "writer" groups:
- Linux
bin/user-tool.sh -u myuser -p "qwer1234!" -g supervisor,reader,writer
$ bin/user-tool.sh -u myuser -p "qwer1234!" -g supervisor,reader,writer
- Microsoft Windows
bin\user-tool.bat -u myuser -p "qwer1234!" -g supervisor,reader,writer
$ bin\user-tool.bat -u myuser -p "qwer1234!" -g supervisor,reader,writer
6.2.2. LDAP Realms Copia collegamentoCollegamento copiato negli appunti!
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. For this reason, LDAP realm configuration is complex. It is beyond the scope of this document to provide examples for all possibile configurations.
LDAP realm configuration
- 1
- Names the LDAP realm.
- 2
- Specifies the LDAP server connection URL.
- 3
- Specifies a principal and credentials to connect to the LDAP server.Important
The principal for LDAP connections must have necessary privileges to perform LDAP queries and access specific attributes.
- 4
- Optionally tunes LDAP server connections by specifying connection timeouts and so on.
- 5
- Verifies user credentials. Data Grid attempts to connect to the LDAP server using the configured credentials. Alternatively, you can use the
user-password-mapper
element that specifies a password. - 6
- Maps LDAP entries to identities. The
rdn-identifier
specifies an LDAP attribute that finds the user entry based on a provided identifier, which is typically a username; for example, theuid
orsAMAccountName
attribute. - 7
- Defines a starting context that limits searches to the LDAP subtree that contains the user entries.
- 8
- 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
groupOfNames
in themember
attribute. 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 amember
attribute 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
memberOf
attribute. 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
memberOf
attributes from the user’s entry, extracts the CN as specified byfrom
, and adds them to the user’sRoles
.
-
Under group entries that usually have class
Supported authentication mechanisms
LDAP realms support the following authentication mechanisms directly:
-
SASL:
PLAIN
,DIGEST-*
, andSCRAM-*
-
HTTP (REST):
Basic
andDigest
6.2.2.1. LDAP Realm Principal Rewriting Copia collegamentoCollegamento copiato negli appunti!
Some SASL authentication mechanisms, such as GSSAPI
, GS2-KRB5
and Negotiate
, supply a username that needs to be cleaned up before you can use it to search LDAP servers.
- 1
- Defines a rewriter that extracts the username from the principal using a regular expression.
6.2.3. Trust Store Realms Copia collegamentoCollegamento copiato negli appunti!
Trust store realms use keystores that contain the public certificates of all clients that are allowed to connect to Data Grid server.
Supported authentication mechanisms
Trust store realms work with client-certificate authentication mechanisms:
-
SASL:
EXTERNAL
-
HTTP (REST):
CLIENT_CERT
6.2.4. Token Realms Copia collegamentoCollegamento copiato negli appunti!
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.
Supported authentication mechanisms
Token realms support the following authentication mechanisms:
-
SASL:
OAUTHBEARER
-
HTTP (REST):
Bearer
6.3. Creating Data Grid Server Identities Copia collegamentoCollegamento copiato negli appunti!
Server identities are defined within security realms and enable Data Grid servers to prove their identity to clients.
6.3.1. Setting Up SSL Identities Copia collegamentoCollegamento copiato negli appunti!
SSL identities use keystores that contain either a certificate or chain of certificates.
If security realms contain SSL identities, Data Grid servers automatically enable encryption for the endpoints that use those security realms.
Procedure
Create a keystore for Data Grid server.
ImportantData Grid server supports the following keystore formats: JKS, JCEKS, PKCS12, BKS, BCFKS and UBER.
In production environments, server certificates should be signed by a trusted Certificate Authority, either Root or Intermediate CA.
-
Add the keystore to the
$ISPN_HOME/server/conf
directory. -
Add a
server-identities
definition to the Data Grid server security realm. - Specify the name of the keystore along with the password and alias.
6.3.1.1. SSL Identity Configuration Copia collegamentoCollegamento copiato negli appunti!
The following example configures an SSL identity for Data Grid server:
- 1
- Defines identities for Data Grid server.
- 2
- Configures an SSL identity for Data Grid server.
- 3
- Names a keystore that contains Data Grid server SSL certificates.
- 4
- Specifies that the keystore is relative to the
server/conf
directory in$ISPN_HOME
. - 5
- Specifies a keystore password.
- 6
- Specifies a keystore alias.
6.3.1.2. Automatically Generating Keystores Copia collegamentoCollegamento copiato negli appunti!
Configure Data Grid servers 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
-
Include the
generate-self-signed-certificate-host
attribute for thekeystore
element in the server configuration. - Specify a hostname for the server certificate as the value.
SSL server identity with a generated keystore
- 1
- generates a keystore using
localhost
6.3.1.3. Tuning SSL Protocols and Cipher Suites Copia collegamentoCollegamento copiato negli appunti!
You can configure the SSL engine, via the Data Grid server SSL identity, to use specific protocols and ciphers.
You must ensure that you set the correct ciphers for the protocol features you want to use; for example HTTP/2 ALPN.
Procedure
-
Add the
engine
element to your Data Grid server SSL identity. -
Configure the SSL engine with the
enabled-protocols
andenabled-ciphersuites
attributes.
SSL engine configuration
6.3.2. Setting Up Kerberos Identities Copia collegamentoCollegamento copiato negli appunti!
Kerberos identities use keytab files that contain service principal names and encrypted keys, derived from Kerberos passwords.
keytab files can contain both user and service account principals. However, Data Grid servers use service account principals only. As a result, Data Grid servers 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 connectors. For example, you have a "datagrid" server in the "INFINISPAN.ORG" domain. In this case you should create the following service principals:
-
hotrod/datagrid@INFINISPAN.ORG
identifies the Hot Rod service. -
HTTP/datagrid@INFINISPAN.ORG
identifies the REST service.
Procedure
Create keytab files for the Hot Rod and REST services.
- Linux
ktutil
$ 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
Copy 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.ORG
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Copy the keytab files to the
$ISPN_HOME/server/conf
directory. -
Add a
server-identities
definition 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.
6.3.2.1. Kerberos Identity Configuration Copia collegamentoCollegamento copiato negli appunti!
The following example configures Kerberos identities for Data Grid server:
- 1
- Defines identities for Data Grid server.
- 2
- Specifies a keytab file that provides a Kerberos identity for the Hot Rod connector.
- 3
- Names the Kerberos service principal for the Hot Rod connector.
- 4
- Specifies that the keytab file must exist when Data Grid server starts.
- 5
- Specifies a keytab file that provides a Kerberos identity for the REST connector.
- 6
- Names the Kerberos service principal for the REST connector.
6.4. Configuring Endpoint Authentication Mechanisms Copia collegamentoCollegamento copiato negli appunti!
Configure Hot Rod and REST connectors with SASL authentication mechanisms to authenticate with clients.
6.4.1. Setting Up Hot Rod Authentication Copia collegamentoCollegamento copiato negli appunti!
Configure Hot Rod connectors to authenticate with clients to Data Grid server security realms using specific SASL authentication mechanisms .
Procedure
-
Add an
authentication
definition to the Hot Rod connector configuration. - Specify which Data Grid security realm the Hot Rod connector uses for authentication.
- Specify the SASL authentication mechanisms for the Hot Rod endpoint to use.
- Configure SASL authentication properties as appropriate.
6.4.1.1. Hot Rod Authentication Configuration Copia collegamentoCollegamento copiato negli appunti!
Hot Rod connector with SCRAM, DIGEST, and PLAIN authentication
Hot Rod connector with Kerberos authentication
6.4.1.2. Hot Rod Endpoint Authentication Mechanisms Copia collegamentoCollegamento copiato negli appunti!
Data Grid supports the following SASL authentications mechanisms with the Hot Rod connector:
Authentication mechanism | Description | Related details |
---|---|---|
|
Uses credentials in plain-text format. You should use |
Similar to the |
|
Uses hashing algorithms and nonce values. Hot Rod connectors support |
Similar to the |
|
Uses salt values in addition to hashing algorithms and nonce values. Hot Rod connectors support |
Similar to the |
|
Uses Kerberos tickets and requires a Kerberos Domain Controller. You must add a corresponding |
Similar to the |
|
Uses Kerberos tickets and requires a Kerberos Domain Controller. You must add a corresponding |
Similar to the |
| Uses client certificates. |
Similar to the |
|
Uses OAuth tokens and requires a |
Similar to the |
6.4.1.3. SASL Quality of Protection (QoP) Copia collegamentoCollegamento copiato negli appunti!
If SASL mechanisms support integrity and privacy protection settings, you can add them to your Hot Rod connector configuration with the qop
attribute.
QoP setting | Description |
---|---|
| Authentication only. |
| Authentication with integrity protection. |
| Authentication with integrity and privacy protection. |
6.4.1.4. SASL Policies Copia collegamentoCollegamento copiato negli appunti!
SASL policies let you control which authentication mechanisms Hot Rod connectors can use.
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 |
Data Grid cache authorization restricts access to caches based on roles and permissions. If you configure cache authorization, you can then set <no-anonymous value=false />
to allow anonymous login and delegate access logic to cache authorization.
Hot Rod connector with SASL policy configuration
As a result of the preceding configuration, the Hot Rod connector uses the GSSAPI
mechanism because it is the only mechanism that complies with all policies.
6.4.2. Setting Up REST Authentication Copia collegamentoCollegamento copiato negli appunti!
Configure REST connectors to authenticate with clients to Data Grid server security realms using specific SASL authentication mechanisms .
Procedure
-
Add an
authentication
definition to the REST connector configuration. - Specify which Data Grid security realm the REST connector uses for authentication.
- Specify the SASL authentication mechanisms for the REST endpoint to use.
- Configure SASL authentication properties as appropriate.
6.4.2.1. REST Authentication Configuration Copia collegamentoCollegamento copiato negli appunti!
REST connector with BASIC and DIGEST authentication
REST connector with Kerberos authentication
6.4.2.2. REST Endpoint Authentication Mechanisms Copia collegamentoCollegamento copiato negli appunti!
Data Grid supports the following authentications mechanisms with the REST connector:
Authentication mechanism | Description | Related details |
---|---|---|
|
Uses credentials in plain-text format. You should use |
Corresponds to the |
|
Uses hashing algorithms and nonce values. REST connectors support |
Corresponds to the |
|
Uses Kerberos tickets and requires a Kerberos Domain Controller. You must add a corresponding |
Corresponds to the |
|
Uses OAuth tokens and requires a |
Corresponds to the |
| Uses client certificates. |
Similar to the |