Preparing for TLS
Page last updated:
This topic provides an overview of how to prepare for using Transport Layer Security (TLS)
with Redis for Pivotal Platform to secure communication between apps and service instances.
Warning: This procedure involves restarting all of the VMs in your deployment to apply a CA certificate. The operation can take a long time to complete.
Note:
This certificate is shared by multiple tiles.
If you have already done this procedure, you do not need to repeat it.
However, an operator must rotate the this
certificate if it expires or if it becomes compromised.
For instructions about how to rotate your CA certificate follow the steps in
Rotating CA Certificates.
Overview
When you use TLS, a new port is co-located with Redis for Pivotal Platform service instances. Apps and clients can use this secure port to establish encrypted connections with the service.
Through BOSH CredHub, Ops Manager generates a server certificate using a Certificate Authority (CA) certificate.
If you do not want to use the CA certificate generated, you can provide your own CA certificate and add it through the CredHub CLI. For an overview of the purpose and functionality of the CredHub component, see CredHub.
Apps and clients use this CA certificate to check that the server certificate is trustworthy. A trustworthy server certificate allows apps and clients to securely communicate with the Redis for Pivotal Platform server.
Pivotal Application Service (PAS) shares the CA certificate public component in the following ways:
PAS provisions a copy of the CA certificate in the trusted store of each container’s operating system. Apps written in Java and Spring, or C# and Steeltoe, automatically discover the CA certificate in the trusted store.
PAS supplies the public CA certificate in an environment variable called
VCAP_SERVICES
that exists in every container. Apps not written in Java and Spring, or C# and Steeltoe, can retrieve the public component of the CA certificate fromVCAP_SERVICES
and use it to establish an encrypted connection with the data service.
Generated or Provided CA Certificate
Ops Manager can generate a CA certificate for TLS to use.
Alternatively, you can choose to provide your own CA certificate for TLS to use.
Workflow
The workflow you follow to prepare for TLS depends on whether you use the CA certificate generated by Ops Manager or if you bring your own CA certificate.
If Using the Generated CA Certificate
To use the CA certificate that Ops Manager generates through CredHub, follow this workflow to enable TLS for Redis for Pivotal Platform:
An operator adds the CredHub-generated certificate to Ops Manager by performing the procedures:
An operator enables TLS in the tile configuration while installing Redis for Pivotal Platform. See Enable TLS in Redis for Pivotal Platform below.
An app developer modifies their app to communicate securely with the Redis for Pivotal Platform server. See Using TLS.
If Providing Your Own CA Certificate
To provide your own CA certificate instead of using the one that Ops Manager generates, follow this workflow to enable TLS for Redis for Pivotal Platform:
An operator provides a CA certificate to CredHub by performing the procedures:
An operator enables TLS in the tile configuration while installing Redis for Pivotal Platform. See Enable TLS in Redis for Pivotal Platform below.
An app developer modifies their app to communicate securely with the Redis for Pivotal Platform server. See Using TLS.
Find the CredHub Credentials in Ops Manager
To find the BOSH CredHub client name and client secret:
- In the Ops Manager Installation Dashboard, click the BOSH Director tile.
- Click the Credentials tab.
- In the BOSH Director section, click the link to the BOSH Commandline Credentials.
Record the values for
BOSH_CLIENT
andBOSH_CLIENT_SECRET
.Here is an example of the credentials page:
{"credential":"BOSH_CLIENT=ops_manager BOSH_CLIENT_SECRET=abCdE1FgHIjkL2m3n-3PqrsT4EUVwXy5 BOSH_CA_CERT=/var/tempest/workspaces/default/root_ca_certificate BOSH_ENVIRONMENT=10.0.0.5 bosh "}
The
BOSH_CLIENT
is the BOSH CredHub client name and theBOSH_CLIENT_SECRET
is the BOSH CredHub client secret.
Set a Custom CA Certificate
Prerequisite: To complete this procedure, you need to have the Credhub CLI. For installation instructions, see credhub-cli on GitHub.
Do this procedure if you are providing your own custom CA certificate instead of using the one generated by Ops Manager or CredHub.
To add a custom CA Certificate to CredHub:
Record the information needed to log in to the BOSH Director VM by following the procedure in Gather Credential and IP Address Information.
Log in to the Ops Manager VM by following the procedure in Log in to the Ops Manager VM with SSH.
Set the API target of the CredHub CLI as your CredHub server by running:
credhub api \ https://BOSH-DIRECTOR-IP:8844 \ --ca-cert=/var/tempest/workspaces/default/root_ca_certificate
Where
BOSH-DIRECTOR-IP
is the IP address of the BOSH Director VM.
For example:$ credhub api \ https://10.0.0.5:8844 \ --ca-cert=/var/tempest/workspaces/default/root_ca_certificate
Log in to CredHub by running:
credhub login \ --client-name=CREDHUB-CLIENT-NAME \ --client-secret=CREDHUB-CLIENT-SECRET
Where
CREDHUB-CLIENT-NAME
is the value you recorded forBOSH_CLIENT
in Find the CredHub Credentials in Ops Manager above.CREDHUB-CLIENT-SECRET
is the value you recorded forBOSH_CLIENT_SECRET
in Find the CredHub Credentials in Ops Manager above.
For example:
$ credhub login \ --client-name=credhub \ --client-secret=abcdefghijklm123456789
Use the CredHub CLI to provide a CA certificate.
Note: Your deployment can have multiple CA certificates. VMware recommends a dedicated CA certificate for services.
Create a new file calledroot.pem
with the contents of the certificate. Then, run the following command, specifying the path toroot.pem
and the private key for the certificate. For example:$ credhub set \ --name="/services/tls_ca" \ --type="certificate" \ --certificate=./root.pem \ --private=ERKSOSMFF...
Add the CA Certificate
Prerequisite: To complete this procedure, you need to have the Credhub CLI. For installation instructions, see credhub-cli on GitHub.
To add the CA Certificate to Ops Manager:
Record the CA certificate by running:
credhub get \ --name=/services/tls_ca \ -k ca
Navigate to the Ops Manager Installation Dashboard > BOSH Director > Security.
Append the contents of the CA certificate you recorded in the previous step into Trusted Certificates.
Click Save.
Ensure relevant app security groups are open for port 16379. This can be done through the Cloud Foundry Command Line Interface (cf CLI). For more information, see Managing ASGs with the cf CLI.
Enable TLS in Redis for Pivotal Platform
To enable TLS in the Redis for Pivotal Platform tile:
- Enable TLS by doing one of the following:
- If you are configuring TLS for an existing installation: Follow the procedure in Upgrade Redis for Pivotal Platform.
- If you are configuring TLS for a new installation: Follow the procedures in Configure On-Demand Service Settings, including enabling TLS in the On-Demand Service Settings tab.
- Navigate to Ops Manager Installation Dashboard > Review Pending Changes.
- Ensure that the CA certificate is deployed to all VMs by selecting:
- Pivotal Application Service
- Redis for Pivotal Platform
- The Upgrade All On-Demand Service Instances errand
- Click Apply Changes. This restarts all the VMs in your deployment and applies your CA certificate.