Access to Azure services for PostgreSQL Database Server should be disabled
Warning: This rule will be deprecated 18 December 2023 as part of the update to Azure CIS version 2.0.0
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.
From the console
- Login to Azure Portal using https://portal.azure.com
- Go to Azure Database for PostgreSQL server
- For each database, click on Connection security
- In Firewall rules, ensure Allow access to Azure services is set to OFF.
- Click Save to apply the changed rule.
Alternatively, use the Azure Command Line Interface and run the below command to delete the AllowAllAzureIps
rule for PostgreSQL Database:
az postgres server firewall-rule delete --name AllowAllAzureIps --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/azure/security/benchmarks/security-controls-v2-network-security#ns-1-implement-security-for-internal-traffic
- https://docs.microsoft.com/en-us/azure/security/benchmarks/security-controls-v2-network-security#ns-4-protect-applications-and-services-from-external-network-attacks
- https://docs.microsoft.com/en-us/azure/security/benchmarks/security-controls-v2-network-security#ns-1-implement-security-for-internal-traffic
CIS Controls
Version 7
9.4 Apply Host-based Firewalls or Port Filtering: Apply host-based firewalls or port filtering tools on end systems, with a default-deny rule that drops all traffic except those services and ports that are explicitly allowed.
9.5 Implement Application Firewalls: Place application firewalls in front of any critical servers to verify and validate the traffic going to the server. Any unauthorized traffic should be blocked and logged.
14.2 Enable Firewall Filtering Between VLANs: Enable firewall filtering between VLANs to ensure that only authorized systems are able to communicate with other systems necessary to fulfill their specific responsibilities.