More Info:
In Microsoft Azure Key Vault, check for any certificates that are generated with minimum key size allowed within your organization, for security and compliance purposes.Risk Level
MediumAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
To remediate this issue in Azure using Azure Console, follow the below steps:
- Login to Azure portal (https://portal.azure.com/)
- Navigate to the Azure Key Vault where the certificate is stored.
- Click on the certificate that needs to be updated.
- Click on the “Versions” tab and then click on the latest version of the certificate.
- Click on the “Download” button to download the certificate.
- Use OpenSSL or any other certificate management tool to update the certificate key size to the recommended key size.
- Once the certificate is updated, upload the updated certificate to Azure Key Vault.
- Navigate to the Azure Virtual Machine where the certificate is used.
- Click on the “Networking” tab and then click on the “Network interface” associated with the virtual machine.
- Click on the “IP configurations” tab and then click on the “Public IP address” associated with the virtual machine.
- Click on the “Configuration” tab and then click on the “SSL certificates” tab.
- Click on the “Add” button and then select the updated certificate from the Azure Key Vault.
- Click on the “Save” button to save the changes.
- Verify that the updated certificate is now being used by the virtual machine.
Using CLI
Using CLI
To remediate the certificate key size misconfiguration in Azure using Azure CLI, you can follow the below steps:Step 1: Log in to the Azure portal and open the Azure CLI.Step 2: Run the following command to list all the certificates in your subscription:Note: Replace Note: Replace Note: Replace
<vault-name> with the name of your key vault.Step 3: Choose the certificate that has a key size less than the recommended key size.Step 4: Run the following command to update the certificate with a new key size:<vault-name> with the name of your key vault, <certificate-name> with the name of the certificate you want to update, and <new-key-size> with the recommended key size.Step 5: Verify that the certificate has been updated successfully by running the following command:<vault-name> with the name of your key vault and <certificate-name> with the name of the certificate you updated.Step 6: Repeat the above steps for all the certificates that have a key size less than the recommended key size.By following the above steps, you can remediate the certificate key size misconfiguration in Azure using Azure CLI.Using Python
Using Python
To remediate the issue of certificate key size being less than the recommended key size in Azure using Python, you can follow the below steps:By following these steps, you can remediate the issue of certificate key size being less than the recommended key size in Azure using Python.
- Import the necessary libraries:
- Instantiate the
WebSiteManagementClientclass:
- Get the current certificate properties:
- Check if the key size is less than the recommended key size:
- Update the certificate key size if it is less than the recommended key size:
Using Terraform
Using Terraform
key_size on an existing azurerm_key_vault_certificate forces replacement of the certificate (new key pair and cert are generated), which may cause an outage if relying services are not prepared for the new certificate; plan and coordinate rotation accordingly.To verify, run terraform plan and ensure it shows a change on this certificate resource with key_size changing to 2048 (or higher) and that the resource will be replaced (-/+ in the plan).
