Skip to main content

More Info:

Ensure that log_checkpoints server parameter is enabled for all PostgreSQL flexible database servers available within your Microsoft Azure cloud account. The log_checkpoints parameter allows checkpoints and restart points to be logged in the Azure PostgreSQL server log.

Risk Level

Medium

Address

Security

Compliance Standards

  • Cloudanix Best Practice

Triage and Remediation

Remediation

Using Console

To enable the log_checkpoints parameter for PostgreSQL Flexible Servers in Azure, you can follow the below steps:
  1. Open the Azure portal and go to your PostgreSQL Flexible Server resource.
  2. In the left-hand menu, click on the “Configuration” option.
  3. In the “Configuration” blade, click on the “Edit” button located at the top.
  4. In the “Edit configuration” blade, search for the log_checkpoints parameter in the “Parameters” section.
  5. If the parameter is not present, click on the “Add parameter” button and enter the following details:
    • Name: log_checkpoints
    • Value: on
  6. If the parameter is already present, click on the parameter and change its value to “on”.
  7. Click on the “Save” button to save the changes.
  8. Once the changes are saved, the PostgreSQL Flexible Server will be restarted to apply the new configuration.
  9. After the server is restarted, the log_checkpoints parameter will be enabled and the server will start logging checkpoint activities.
This will remediate the misconfiguration of not having the log_checkpoints parameter enabled for PostgreSQL Flexible Servers in Azure.

To remediate the misconfiguration “Enable log_checkpoints Parameter for PostgreSQL Flexible Servers” for Azure using Azure CLI, you can follow the below steps:Step 1: Open Azure CLI and login to your Azure account using the command:
Step 2: Once you are logged in, select the Azure subscription where your PostgreSQL Flexible Server is running using the command:
Step 3: Now, enable the log_checkpoints parameter for your PostgreSQL Flexible Server using the following command:
Make sure to replace <resource_group_name> and <server_name> with the actual resource group name and server name where your PostgreSQL Flexible Server is running.Step 4: Verify that the parameter has been enabled successfully using the following command:
This will display the current value of the log_checkpoints parameter.That’s it! You have now successfully remediated the misconfiguration “Enable log_checkpoints Parameter for PostgreSQL Flexible Servers” for Azure using Azure CLI.
To enable the log_checkpoints parameter for PostgreSQL Flexible Servers on Azure using Python, you can follow these steps:
  1. Install the azure-mgmt-postgresql Python package using pip:
  1. Import the necessary modules:
  1. Set up the credentials for authentication:
  1. Create the PostgreSQLManagementClient object:
  1. Get the current server configurations:
  1. Check if the log_checkpoints parameter is already enabled:
  1. If the log_checkpoints parameter is not enabled, create a new configuration object and update the server configuration:
  1. Verify that the log_checkpoints parameter is now enabled:
The complete code snippet to enable the log_checkpoints parameter for PostgreSQL Flexible Servers on Azure using Python is as follows:
This change is an in-place configuration update on the existing PostgreSQL flexible server and does not force replacement of the server.After updating your Terraform, terraform plan should show one new azurerm_postgresql_flexible_server_configuration.log_checkpoints resource to be created (or modified from its previous value to "ON"), with no destroy/create actions for the azurerm_postgresql_flexible_server itself.