Store Certificates in Azure

Follow the steps described in this page to store your certificate and private keys in Azure that can be used by CloudGuard WAF to process HTTPS traffic

Note About Certificate Renewal

When a certificate is renewed, you must update the key vault according to the instructions below, then enforce policy again (even if configuration has not changed) by clicking on "Enforce" on the top bar of the web administration application for CloudGuard WAF in the portal, or by using management API.

Certificates Usage

In order to use encrypted traffic (HTTPS) a managed reverse proxy must have access to the relevant certificates of the domains and URLs it exposes.

Example - you have two applications and one API endpoint to protect:

  • www.acme.com

  • www.acme.com/sales

  • products.acme.com/catalog

ExamplesCertificates usedRequired action

Case 1

You have one wildcard certificate for *.acme.com

Place the certificate in the desired certificate storage by following the instructions below. CloudGuard WAF will use it for all relevant applications

Case 2

You have two certificates: (1) for www.acme.com and (2) for products.acme.com

Place both certificates in the desired certificate storage by following the instructions below. CloudGuard WAF will automatically use certificate 1 for the first two Applications/APIs and certificate 2 for the last Application

Setting a certificate as part of the CloudGuard WAF Template Wizard

Pre-requisite if you plan to use an existing Azure Key Vault

When using an existing Azure Key Vault you first need to make sure it already contains all relevant PFX certificate/s and their password/s. See the section "Adding a new certificate to an existing Azure Key Vault" for more information.

Only PFX certificates are supported. If you already have certificates in your existing Azure Key Vault, it is not possible in Azure to see if they are in PFX or PEM format until you download them from the Azure Web Console by clicking "Download in PFX/PEM format".

If your existing certificates are in PEM format, it is possible to convert them the PFX format by using the following command in linux:

openssl pkcs12 -inkey <privatekey> -in <input pem file> -export -out <output pfx file>

After this action follow the instructions in the "Adding a new certificate to an existing Azure Key Vault" section.

Step 1: HTTPS settings tab

To store certificates and private Keys in Azure Key Vault, use the HTTPS settings Tab of CloudGuard WAF for Azure ARM Template wizard:

In the wizard HTTPS settings tab, follow these steps:

Step 2: Decide if you use an existing Azure key or creating a new one

Select whether you use HTTPS protocol and whether you have an existing Azure Key vault that already contains your SSL certificates, or want to create a new one.

The ARM template automatically adds appropriate secret and certificate permissions to the Key Vault for the Scale Set resource. The granted permissions are ‘List’ and ‘Get’.

Only certificates that contain Subject Alternative Name (SAN) are supported.

Step 3 option a: If you chose to create a new Azure Key Vault and upload certificates:

  • Azure Key Vault name

  • Number of certificates to upload - Each certificate has two entries in the Key Vault secrets, one for its certificate and one for its password.

  • PFX certificate file - A PKCS#12 archive that contains the Certificate Authority (CA) certificate and private key. The file name extension for PKCS#12 archives is .p12 or .pfx

  • Description - A description of the uploaded certificate. The uploaded certificates content is encoded to base64 format and stored as 'cert[1-5]' in vault's secrets. A description is mandatory to keep track of them.

The template allows up to 5 certificates. However - after initial deployment it is possible to add more certificates to the same location.

  • Certificate password - Password used when exporting the PFX certificate. The password is encoded to base64 format and stored in the vault’s secrets as ‘cert[1-5]-pw’.

Step 3 option b: If you chose to use an existing Azure Key Vault

This option allows you to use a previously created Azure Key Vault that contains PFX certificates for all your applicable HTTPS based assets in the Infinity Portal. The PFX certificate must contain both the certificate and the private key. It is not necessary to have the Key Vault in the same Resource Group as the deployed template, but it must be created in the same region.

Reminder: Read again the Pre-requisite section. When using an existing Azure Key Vault you first need to make sure it already contains PFX certificates and their passwords. See the section "Adding a new certificate to an existing Azure Key Vault" for more information.

To configure the Key Vault’s access policies correctly, under Enable Access to, select the checkbox Azure Virtual Machines for deployment.

Finally, Click Enforce Policy in the Infinity Portal top bar

The certificates are fetched when CloudGuard WAF's AppSec Gateway first loads and checked again for updates every time you Enforce policy.

Notes

  • To attach a different Azure Key Vault to an already deployed Scale Set:

    1. Create your Key Vault in the same region as your Scale Set with the Access Policy as described earlier

    2. Go to the Scale Set resource and change the value field of the Tag named vault to your new Key Vault name.

Adding a new certificate to an existing Azure Key Vault

If you already had an existing Azure Key Vault with certificates, before deploying your CloudGuard WAF's AppSec Gateway, you must make sure all existing certificates in the vault were added using the instructions in this section.

Only PFX certificates are supported. If your certificates are in PEM format, it is possible to convert them the PFX format by using the following command in linux:

openssl pkcs12 -inkey <privatekey> -in <input pem file> -export -out <output pfx file>

Step 1: Import a certificate

Follow the instructions in Azure documentation regarding importing a certificate file. Make sure you only import a supported certificate file (PFX) even if the examples in the documentation show an example for different types.

Make sure you know what is the password of the certificate file for the next step (it is configured during the file's creation).

Step 2: Add the certificate's password to the secrets section

For CloudGuard WAF's AppSec Gateway to associate automatically the PFX's password, you must create a password-type entry in the secrets storage of the Azure Key Vault.

Its name must be <certificate entry name>-pw and its value will be the password of the certificate.

For example, if you imported a certificate entry named "my-website-cert", then the password entry name must be "my-website-cert-pw"

Step 3: Create a new Web asset or add a URL to an existing asset

Navigate to the Infinity Portal and create a new Asset or add an Application URL to an existing Asset, and then click Enforce policy.

Last updated