The log_connections setting is disabled on Postgresql DB Affecting Cloud SQL service in Google


Severity

0.0
high
0
10
Severity Framework
Snyk CCSS
Rule category
Logging/ Configuration

Is your environment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
Frameworks
CIS-ControlsCIS-GoogleHIPAAISO-27001NIST-800-53SOC-2
  • Snyk IDSNYK-CC-00360
  • creditSnyk Research Team

Description

The PostgreSQL database instance flag 'log_connections' causes successful and unsuccessful connections to be logged. This data can be used to identify, troubleshoot, and repair configuration errors and denial of service attacks. This flag and the 'log_disconnections' flag are typically used together.

How to fix?

Set settings.database_flags.name attribute to "log_connections", and settings.database_flags.value attribute to "on".

Example Configuration

resource "google_sql_database_instance" "allowed" {
  name             = "master-instance"
  database_version = "POSTGRES_11"
  region           = "us-central1"

  settings {
    tier = "db-f1-micro"
    database_flags {
      name  = "log_connections"
      value = "on"
    }
  }
}