PostgreSQL Log Disconnections Not Set
- Query id: 07f7134f-9f37-476e-8664-670c218e4702
- Query name: PostgreSQL Log Disconnections Not Set
- Platform: Terraform
- Severity: Medium
- Category: Observability
- CWE: 778
- URL: Github
Description¶
Make sure that for PostgreSQL Database, server parameter 'log_disconnections' is set to 'ON'
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Positive test num. 1 - tf file
resource "azurerm_postgresql_configuration" "positive1" {
name = "log_disconnections"
resource_group_name = data.azurerm_resource_group.example.name
server_name = azurerm_postgresql_server.example.name
value = "off"
}
resource "azurerm_postgresql_configuration" "positive2" {
name = "log_disconnections"
resource_group_name = data.azurerm_resource_group.example.name
server_name = azurerm_postgresql_server.example.name
value = "Off"
}
resource "azurerm_postgresql_configuration" "positive3" {
name = "log_disconnections"
resource_group_name = data.azurerm_resource_group.example.name
server_name = azurerm_postgresql_server.example.name
value = "OFF"
}
Code samples without security vulnerabilities¶
Negative test num. 1 - tf file
resource "azurerm_postgresql_configuration" "negative1" {
name = "log_disconnections"
resource_group_name = data.azurerm_resource_group.example.name
server_name = azurerm_postgresql_server.example.name
value = "on"
}
resource "azurerm_postgresql_configuration" "negative2" {
name = "log_disconnections"
resource_group_name = data.azurerm_resource_group.example.name
server_name = azurerm_postgresql_server.example.name
value = "On"
}
resource "azurerm_postgresql_configuration" "negative3" {
name = "log_disconnections"
resource_group_name = data.azurerm_resource_group.example.name
server_name = azurerm_postgresql_server.example.name
value = "ON"
}