Azure PostgreSQL servers not configured with private endpoint misconfiguration detected in code
Rule Details
Cortex AppSec Rule ID
APPSEC2_AZURE_42
Category - Subcategory
Public Exposure - VPC VCN VNet
Provider
AZURE
Severity
MEDIUM
Framework
Terraform, Terraform Plan
Mapped CSPM/KSPM Rule
0a2feecd-80f9-47f8-9cfc-6d54d4463298
Impact
This rule checks whether Azure PostgreSQL database servers are configured with private endpoints. Private endpoint connections are crucial for ensuring secure communication, as they establish exclusive, private connectivity to Azure Database for PostgreSQL. Configuring a private endpoint restricts access to traffic originating from known networks, preventing entry from potentially malicious or unknown IP addresses, including those within Azure. It is recommended to establish a private endpoint to ensure secure communication for your Azure PostgreSQL database.
How to Fix
Resource: azurerm_postgresql_server, azurerm_private_endpoint
Arguments: private_connection_resource_id
To fix this issue and establish secure communication with your network, configure your Azure PostgreSQL Server with a private endpoint.
This code enhances security by establishing a private endpoint for the PostgreSQL server, restricting access to specific networks and eliminating exposure to the public internet, thereby reducing the risk of potential attacks. The private endpoint uses a private IP address from your VNet, integrating the service into your VNet. All traffic to the service is routed through the private endpoint, eliminating the need for gateways, NAT devices, or encrypted Express Route or VPN connections. [source,go]
resource "azurerm_private_endpoint" "example" { name = "postgresqlprivateendpoint" location = azurerm_resource_group.example.location resource_group_name = azurerm_resource_group.example.name subnet_id = azure_subnet.example.id
private_service_connection { name = "postgresqlprivateserviceconnection" private_connection_resource_id = azurerm_postgresql_server.example.id subresource_name = "postgresqlServer" is_manual_connection = false } }
Last updated
Was this helpful?
