Postgres Configuration Connection Throttling

MEDIUM
Source
Trivy
ID
AVD-AZU-0021

Ensure server parameter ‘connection_throttling’ is set to ‘ON’ for PostgreSQL Database Server

Postgresql can generate logs for connection throttling to improve visibility for audit and configuration issue resolution.

Impact

Follow the appropriate remediation steps below to resolve the issue.

Enable connection throttling logging

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 resource "azurerm_resource_group" "example" {
   name     = "example-resources"
   location = "West Europe"
 }
 
 resource "azurerm_postgresql_server" "example" {
   name                = "example-psqlserver"
   location            = azurerm_resource_group.example.location
   resource_group_name = azurerm_resource_group.example.name
 
   administrator_login          = "psqladminun"
   administrator_login_password = "H@Sh1CoR3!"
 
   sku_name   = "GP_Gen5_4"
   version    = "9.6"
   storage_mb = 640000
 }
 
 resource "azurerm_postgresql_configuration" "example" {
 	name                = "connection_throttling"
 	resource_group_name = azurerm_resource_group.example.name
 	server_name         = azurerm_postgresql_server.example.name
 	value               = "on"
   }