Chapter 3. Security Realms
Security realms define identity, encryption, authentication, and authorization configuration for Data Grid Server endpoints.
3.1. Property Realms Copy linkLink copied to clipboard!
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.
myuser=supervisor,reader,writer user2=supervisor
myuser=supervisor,reader,writer
user2=supervisor
Endpoint authentication mechanisms
When you configure Data Grid Server to use a property realm, you can configure endpoints to use the following authentication mechanisms:
-
Hot Rod (SASL):
PLAIN
,DIGEST-*
, andSCRAM-*
-
REST (HTTP):
Basic
andDigest
Property realm configuration
3.1.1. Creating and Modifying Users Copy linkLink copied to clipboard!
Add Data Grid user credentials and assign permissions to control access to data.
Data Grid server installations use a property realm to authenticate users for the Hot Rod and REST endpoints. This means you need to create at least one user before you can access Data Grid.
By default, users also need roles with permissions to access caches and interact with Data Grid resources. You can assign roles to users individually or add users to groups that have role permissions.
You create users and assign roles with the user
command in the Data Grid command line interface (CLI).
Run help user
from a CLI session to get complete command details.
3.1.1.1. Adding Credentials Copy linkLink copied to clipboard!
You need an admin
user for the Data Grid Console and full control over your Data Grid environment. For this reason you should create a user with admin
permissions the first time you add credentials.
Procedure
-
Open a terminal in
$RHDG_HOME
. Create an
admin
user with theuser create
command in the CLI.bin/cli.sh user create myuser -p changeme -g admin
$ bin/cli.sh user create myuser -p changeme -g admin
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, the username "admin" automatically gets
admin
permissions.bin/cli.sh user create admin -p changeme
$ bin/cli.sh user create admin -p changeme
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Open
user.properties
andgroups.properties
with any text editor to verify users and groups.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1.1.2. Assigning Roles to Users Copy linkLink copied to clipboard!
Assign roles to users so they have the correct permissions to access data and modify Data Grid resources.
Procedure
Start a CLI session with an
admin
user.bin/cli.sh
$ bin/cli.sh
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Assign the
deployer
role to "katie".[//containers/default]> user roles grant --roles=deployer katie
[//containers/default]> user roles grant --roles=deployer katie
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List roles for "katie".
[//containers/default]> user roles ls katie ["deployer"]
[//containers/default]> user roles ls katie ["deployer"]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1.1.3. Adding Users to Groups Copy linkLink copied to clipboard!
Groups let you change permissions for multiple users. You assign a role to a group and then add users to that group. Users inherit permissions from the group role.
Procedure
-
Start a CLI session with an
admin
user. Use the
user create
command to create a group.-
Specify "developers" as the group name with the
--groups
argument. Set a username and password for the group.
In a property realm, a group is a special type of user that also requires a username and password.
[//containers/default]> user create --groups=developers developers -p changeme
[//containers/default]> user create --groups=developers developers -p changeme
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Specify "developers" as the group name with the
List groups.
[//containers/default]> user ls --groups ["developers"]
[//containers/default]> user ls --groups ["developers"]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Assign the
application
role to the "developers" group.[//containers/default]> user roles grant --roles=application developers
[//containers/default]> user roles grant --roles=application developers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List roles for the "developers" group.
[//containers/default]> user roles ls developers ["application"]
[//containers/default]> user roles ls developers ["application"]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add existing users, one at a time, to the group as required.
[//containers/default]> user groups john --groups=developers
[//containers/default]> user groups john --groups=developers
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2. 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.
Endpoint authentication mechanisms
When you configure Data Grid Server to use an LDAP realm, you can configure endpoints to use the following authentication mechanisms:
-
Hot Rod (SASL):
PLAIN
,DIGEST-*
, andSCRAM-*
-
REST (HTTP):
Basic
andDigest
LDAP realm configuration
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 password with the user-password-mapper
element.
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
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
.
3.2.1. LDAP Realm Principal Rewriting Copy linkLink copied to clipboard!
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.
3.3. 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.
Endpoint authentication mechanisms
When you configure Data Grid Server to use a token realm, you must configure endpoints to use the following authentication mechanisms:
-
Hot Rod (SASL):
OAUTHBEARER
-
REST (HTTP):
Bearer
Token realm configuration
3.4. 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.
Endpoint authentication mechanisms
If you configure Data Grid Server with a keystore only, you can use encryption in combination with any authentication mechanism.
When you configure Data Grid Server to use a client trust store, you must configure endpoints to use the following authentication mechanisms:
-
Hot Rod (SASL):
EXTERNAL
-
REST (HTTP):
CLIENT_CERT
Trust store realm configuration