Skip to main content

lacework-global-549

Disable 'Allow access to Azure services' for PostgreSQL Database Server (Automated)

note

This rule has been changed to automated, see Automated Policies for CIS Azure 1.5.0 for details.

Profile Applicability

• Level 1

Description

Disable access from Azure services to PostgreSQL Database Server.

Rationale

If access from Azure services is enabled, the server's firewall will accept connections from all Azure resources, including resources not in your subscription. This is usually not a desired configuration. Instead, set up firewall rules to allow access from specific network ranges or VNET rules to allow access from specific virtual networks.

Audit

From Azure Portal

  1. Login to Azure Portal using https://portal.azure.com
  2. Go to Azure Database for PostgreSQL server
  3. For each database, click on Connection security
  4. In Firewall rules
  5. Ensure Allow access to Azure services is set to OFF.

From Azure CLI

Ensure the output of the below command does not include a rule with the name AllowAllAzureIps or "startIpAddress": "0.0.0.0" & "endIpAddress": "0.0.0.0",

az postgres server firewall-rule list --resource-group <resourceGroupName> --server <serverName>

Remediation

From Azure Portal

  1. Login to Azure Portal using https://portal.azure.com.
  2. Go to Azure Database for PostgreSQL servers.
  3. For each database, click Connection security.
  4. Under Firewall rules, set Allow access to Azure services to No.
  5. Click Save.

From Azure CLI

Use the below command to delete the AllowAllWindowsAzureIps rule for PostgreSQL Database:

az postgres server firewall-rule delete --name AllowAllWindowsAzureIps --resource-group <resourceGroupName> --server-name <serverName>

References

https://docs.microsoft.com/en-us/azure/postgresql/concepts-firewall-rules
https://docs.microsoft.com/en-us/azure/postgresql/howto-manage-firewall-using-cli
https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-network-security#ns-1-establish-network-segmentation-boundaries
https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-network-security#ns-6-deploy-web-application-firewall