Chapter 3. Configuring Authentication and Encryption
You need to configure authentication and encryption only if you are using a custom template or want to use your own keystores with the Data Grid deployment configuration templates.
3.1. Adding Keystores to Secrets
To configure authentication and encryption:
Create a keystore (
.jks
) with a trusted certificate.Both HTTPS and Hot Rod services can use the same keystore or you can create separate keystores.
Add the keystore as an OpenShift secret.
Create a secret. For example, to create a secret named
rhdg-https-secret
from a keystore namedrhdg-https.jks
:$ oc create secret generic rhdg-https-secret \ --from-file=rhdg-https.jks
Link the secret to the default service account.
$ oc secrets link default rhdg-https-secret
3.2. Configuring Deployments
Instantiate one of the secure templates with following parameters:
Set up HTTP and HTTPS hostnames:
HOSTNAME_HTTP=my.example.hostname
HOSTNAME_HTTPS=secure-my.example.hostname
-
Specify the name of the keystore:
HTTPS_KEYSTORE=keystore.jks
-
Specify the path to the keystore:
HTTPS_KEYSTORE_DIR=/etc/datagrid-secret-volume
-
Specify the name of the secret:
HTTPS_SECRET=rhdg-https-secret
Specify credentials for the keystore:
HTTPS_NAME=${USERNAME}
HTTPS_PASSWORD=${PASSWORD}
-
Set the HTTP security domain for the user:
REST_SECURITY_DOMAIN=SecurityRealm
-
Enforce client certificate authentication:
ENCRYPTION_REQUIRE_SSL_CLIENT_AUTH=true
Enable authentication and encryption for the Hot Rod protocol:
HOTROD_AUTHENTICATION=true
NoteThe template automatically sets
HOTROD_ENCRYPTION=true
if you set a value forHOSTNAME_HTTPS
.
3.3. Setting Unique Keystores for the Hot Rod Protocol
To use a unique keystore for the Hot Rod protocol:
-
Specify the path to the keystore:
SSL_KEYSTORE_PATH=hr_keystore.jks
-
Specify the keystore password:
SSL_KEYSTORE_PASSWORD=${PASSWORD}
If necessary, do the following:
-
Set a relative path to the keystore:
SSL_KEYSTORE_RELATIVE_TO=path/to/keystore/
-
Specify the private key password, if different to the keystore password:
SSL_KEY_PASSWORD=${PASSWORD}
-
Set the correct alias in the keystore if it contains multiple entries:
SSL_KEYSTORE_ALIAS=cert_alias
-
Set a relative path to the keystore:
Specify authorization credentials if you have not already:
USERNAME=${USERNAME}
PASSWORD=${PASSWORD}
NoteThe Hot Rod endpoint always uses the
ApplicationRealm
to authorize users. If you want to use separate keystores for the Hot Rod and REST endpoints, you must set credentials with theUSERNAME
andPASSWORD
parameters. Templates then configure the REST endpoint to use thejdg-openshift
security realm. In this case theREST_SECURITY_DOMAIN
environment variable does not take effect.