More Info:

Ensure that the “log_disconnections” server parameter is enabled for all PostgreSQL database servers provisioned in your Microsoft Azure cloud account. The “log_disconnections” parameter enables the logging of session termination. The log output provides information similar to the one generated by the “log_connections” parameter, plus the duration of the session. Only Azure account admins can change this parameter at the session start, and it cannot be changed at all during a session.

Risk Level

Medium

Address

Security

Compliance Standards

CISAZURE, CBP, HITRUST, SOC2, NISTCSF, PCIDSS

Triage and Remediation

Remediation

To remediate the misconfiguration “Enable ‘LOG_DISCONNECTIONS’ Parameter for PostgreSQL Servers” in Azure using the Azure console, follow the below steps:

  1. Login to Azure Portal (https://portal.azure.com/).
  2. Go to the Azure Database for PostgreSQL servers.
  3. Select the PostgreSQL server for which you want to enable “LOG_DISCONNECTIONS” parameter.
  4. Click on the “Connection security” option in the left-hand side menu.
  5. Scroll down to the “Firewall and virtual networks” section and click on the “Configure firewall” button.
  6. In the “Firewall rules” section, click on the “Add client IP” button to add your IP address to the firewall rules.
  7. Click on the “Save” button to save the changes.
  8. Go back to the PostgreSQL server overview page and click on the “Connection strings” option in the left-hand side menu.
  9. Copy the connection string for the PostgreSQL server.
  10. Open the PostgreSQL client tool (e.g. pgAdmin) and connect to the PostgreSQL server using the connection string.
  11. Once connected, execute the following SQL command to enable “LOG_DISCONNECTIONS” parameter:

ALTER SYSTEM SET log_disconnections = on;

  1. Restart the PostgreSQL server to apply the changes.

With these steps, you have successfully remediated the misconfiguration “Enable ‘LOG_DISCONNECTIONS’ Parameter for PostgreSQL Servers” in Azure using the Azure console.