Blindfold your TLS Certificates
Objective
This document provides instructions on how to encrypt your TLS certificates using F5® Distributed Cloud Blindfold. This ensures additional security measures for the certificates stored in F5 Distributed Cloud Platform. To know more about Blindfold and secrets management, see Blindfold.
Note: Distributed Cloud Platform supports blindfolding the secrets directly in Console. Use the instructions provided in this document only in the case you want to apply Blindfold to your certificates Offline.
The following image illustrates the sequence of actions performed in securing the certificates.
Figure: F5 Distributed Cloud Blindfold
Using the instructions provided in this guide, you can encrypt TLS certificate with Blindfold and apply it to a virtual host.
Prerequisites
The following prerequisites apply:
Note: If you do not have an account, see Create an Account.
- A virtual host with a signed TLS certificate
Note: If you do not have a virtual host, see Create a Virtual Host.
-
The vesctl tool. Download vesctl on your local machine as it is used to apply Blindfold to the TLS certificate.
-
Optionally, one or more cloud or edge locations with a Distributed Cloud site
Note: Install the Distributed Cloud node or cluster image in your cloud or edge location. See Site Management for more information.
- A minimum of monitor role in the Shared namespace is required.
Configuration
The following image shows the configuration sequence of applying Blindfold encryption to your TLS certificate.
Figure: Encrypting TLS-Key using Blindfold
Configuration Sequence
Applying Blindfold to the certificates of your WebApp includes performing the following sequence of actions:
Phase | Description |
---|---|
Create a Secret Policy | Create a policy to permit F5 Distributed Cloud Wingman and data plane to access the TLS certificate. |
Prepare Credentials and Policy | Retrieve API credentials from Console, derive certificates, derive keys, and obtain policy. |
Encrypt TLS Certificate | Perform the encryption on a local computer. It is recommended to use an air-gapped computer. |
Enable TLS on the Virtual Host | Update the Virtual Host configuration with the TLS certificate and key encrypted with Blindfold. |
Note: The API credentials are required to be downloaded in PKCS #12 file format.
Create a Secret Policy
The secret policy allows Wingman and Distributed Cloud data plane access to the TLS certificate.
Note: You can also use the inbuilt
ves-io-allow-volterra
policy.
Step 1: Log into Console and start creating new secret policy.
-
From the Home screen, click
Multi-Cloud Network Connect
underAll Services
. -
In the
Manage
section of the configuration menu, selectSecrets
from the options pane, and then selectSecret Policies
to see a list of existing policies. Then clickAdd secret policy
to see the new secret policy form. -
In the
Metadata
section, -
Enter a unique name for the secret policy.
-
Optionally, set labels and description, as necessary.
-
Check
Allow F5XC
to allow the data plane to decrypt an encrypted TLS private key. -
Enter
Decrypt Cache Timeout
to limit the time a decrypted secret is cached in Wingman.
Figure: Secret Policy Metadata
Step 2: Configure the Secret Policy Rules.
The Secret Policy Rules
section lists all the rules for this policy.
To add a new rule, Select Policy Rules
> choose Configure
link > click + Add item
button and fill out the secret policy rule form as outlined below.
Figure: Secret Policy Metadata
In the Metadata
section,
-
Enter a unique name for the new rule.
-
Optionally, set labels and description, as necessary.
In the Action
section, selecting Allow
or Deny
determines how to react to a request if all the predicates evaluate to true.
In the Client Selection
section, specify the client(s) that will be affected by this rule.
-
Group of Clients by Name
- List of client names for which the rule will apply. You can specify them usingExact Values
and/orRegex Values
. ClickAdd item
and enter exact values or regular expressions for server names. Continue to click eitherAdd item
button to build your list. -
Group of Clients by Label Selector
- Specifies the labels associated with the clients to which the rule will apply. To add labels, click in theSelector Expression
field, and then for each label you want to add:- Select a key from the displayed options or type a key and click
Assign Custom Key
, - Select a displayed operator,
- Select a displayed value or enter a custom value,
- Click
Apply
. If this is the last label, click outside theSelector Expression
area or press thetab
key.
- Select a key from the displayed options or type a key and click
-
Client Name
: Enter a single client name.
When finished entering clients for this rule, click the Apply
button.
Figure: Secret Policy Action
Click Apply
to save the custom rule list.
Step 3: Complete the policy.
-
Click
Save and Exit
button to complete the secret policy.Figure: Secret Policy Metadata
Prepare Credentials and Policy
Step 1: Create an API Certificate.
- Log into F5 Distributed Cloud Platform
- Create an API certificate using the instructions in the Generate API Certificate chapter of the Credentials document.
- Download the certificate in the PKCS #12 (P12) format.
Step 2: Create a config file and add P12 bundle and server URLs to that file
Create a file named .vesconfig
and add the P12 certificate bundle and the tenant server URLs to that file.
Step 3: Set the environment for P12 password.
Enter the following command:
export VES_P12_PASSWORD=<p12 password>
Note: The password for the P12 file is set during the generation of API certificate.
Step 4: Obtain a public-key using vesctl and store the output to a file.
This example stores the output to a file named demo-api-pubkey
.
vesctl request secrets get-public-key > demo-api-pubkey
Step 5: Obtain a policy-document using vesctl and store the output to a file.
This example stores the output to a file named demo-api-policy
. You can use the inbuilt policy or the policy created in the previous chapter. This example uses the inbuilt ves-io-allow-volterra
policy.
vesctl request secrets get-policy-document --namespace shared --name ves-io-allow-volterra > demo-api-policy
Encrypt TLS Key Using Blindfold
Step 1: Encrypt TLS Key using vesctl and Blindfold.
This example stores the output to a file named bl-enckey
.
vesctl request secrets encrypt --policy-document demo-api-policy --public-key demo-api-pubkey key.pem > bl-enckey
Note: Provide the public key and policy document obtained in the Prepare Credentials and Policy chapter. The
key.pem
is the TLS key to be encrypted.
Step 2: Save the encrypted TLS Key for future use.
You will need the encrypted key in the Enable TLS on the Virtual Host chapter when adding your TLS key.
Enable TLS on the Virtual Host
This capability has been deprecated.
Enable TLS on a Load Balancer
Follow these steps to cut and paste a blindfolded (or non-blindfolded) TLS certificate to your load balancer.
Step 1: Log into Console and edit your load balancer configuration.
-
Log into Console.
-
Click
Web App & API Protection
.
Figure: Console Homepage
-
Select your namespace from the
Namespace
drop-down menu. -
Select
Manage
>Load Balancers
>HTTP Load Balancers
. -
Select
...
>Manage Configuration
for your load balancer, and then selectEdit Configuration
in the top right to edit the load balancer's configuration.
Step 2: Configure your load balancer for a custom certificate.
Figure: Custom TLS
-
Select
HTTPS with Custom Certificate
from theLoad Balancer Type
drop-down menu in theDomains and LB Type
section. -
Optionally select
HTTP Redirect to HTTPS
andAdd HSTS Header
checkboxes. -
Use the
HTTP Listen Port Choice
to select between using a single port or a range of ports, and then enter the port number(s). For a range of ports, enter a list of non-overlapping port ranges with a maximum of 64 ports in the list, e.g.443,100-120,8080,9080-9089
. -
Select
TLS Certificates
from theTLS Configuration
drop-down menu, and then clickConfigure
.
Step 3: Insert one or more certificates.
-
From the
TLS Security Level
drop-down menu, select the desired level. -
From the
Certificates
drop-down menu, selectAdd Item
. This brings up theTLS Certificate
form allowing you to add import a certificate. Typically you would useImport from File
, but this example will show how to paste a certificate instead.
Figure: import TLS Certificate
- Click the
JSON
tab above the form. This will show your TLS certificate and associated information in a JSON editor. It will be empty, except for any meta data you may have entered in the form.
Figure: Empty TLS Certificate JSON
- Add your certificate and private key to the JSON using one of the following instruction sets based on the type of certificate/key you want to enter.
Non-Blindfolded certificate and private key Instructions
-
If you have a non-blindfolded certificate and private key, paste the following JSON template into the JSON editor.
Note: Using this method, you will paste your private key in the clear, and it will not be blindfolded (encrypted). Base64 encoding is not encryption.
{
"metadata": {
"name": "certificate-name",
"namespace": "my-namespace"
},
"spec": {
"disable_ocsp_stapling": {},
"certificate_url": "string:///<base64 encoded certificate>",
"private_key": {
"clear_secret_info": {
"url": "string:///<base64 encoded private key>"
}
}
}
}
-
Encode your certificate and private key using https://www.base64encode.org/ or equivalent.
-
Paste your encoded certificate text into the
certificate_url
key following the three slashes. That is to say, replace<base64 encoded certificate>
with your encoded certificate text. -
Repeat the process for the private key. You will be replacing
<base64 encoded private key>
with your encoded private key text.
Blindfolded certificate and private key Instructions
- If you have a blindfolded certificate and private key, paste the following JSON template into the JSON editor.
{
"metadata": {
"name": "certificate-name",
"namespace": "my-namespace"
},
"spec": {
"disable_ocsp_stapling": {},
"certificate_url": "string:///<blindfolded certificate>",
"private_key": {
"blindfold_secret_info": {
"location": "string:///<blindfolded private key>"
}
}
}
}
-
Paste your blindfolded certificate into the
certificate_url
key following the three slashes. That is to say, replace<blindfolded certificate>
with your blindfolded certificate text. -
Repeat the process for the private key. You will be replacing
<blindfolded private key>
with your blindfolded private key text.
-
Once your certificate and key are in the
spec
section, ensure that thename
andnamespace
values are correct in themetadata
section. Thenamespace
value must match your selected namespace. -
Click the
Form
tab to return to theTLS Certificate
form.
Figure: TLS Certificate Added
-
Select an
OCSP Stapling
option. Then clickContinue
to save the certificate. -
Click
Save and Exit
to create your certificate. -
Your new certificate will now be in your certificates list. Make sure it is selected in the
Certificates
drop-down menu and then clickApply
to save your TLS parameters.
Step 4: Complete the modifications to your HTTP Load Balancer.
-
In the
TLS Parameters
form, you can use the+ Add Item
button to add more TLS certificates, if required. -
Click
Apply
to save your TLS parameters. -
Click
Save and Exit
to complete the modifications to your HTTP load balancer.