Skip to content

Commit 29b4385

Browse files
Require SCRAM authentication of the monitoring user
The PostgreSQL STIG requires that password authentication be done using scram-sha-256. Co-authored-by: Scott Zelenka <szelenka@cisco.com> Issue: #3424 See: https://www.stigviewer.com/stig/crunchy_data_postgresql/2022-06-13/finding/V-233519
1 parent ac4d9a4 commit 29b4385

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

internal/pgmonitor/postgres.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ func PostgreSQLHBAs(inCluster *v1beta1.PostgresCluster, outHBAs *postgres.HBAs)
3939
// https://kubernetes.io/docs/concepts/cluster-administration/networking/
4040
// https://releases.k8s.io/v1.21.0/pkg/kubelet/kubelet_pods.go#L343
4141
outHBAs.Mandatory = append(outHBAs.Mandatory, *postgres.NewHBA().TCP().
42-
User(MonitoringUser).Network("127.0.0.0/8").Method("md5"))
42+
User(MonitoringUser).Network("127.0.0.0/8").Method("scram-sha-256"))
4343
outHBAs.Mandatory = append(outHBAs.Mandatory, *postgres.NewHBA().TCP().
44-
User(MonitoringUser).Network("::1/128").Method("md5"))
44+
User(MonitoringUser).Network("::1/128").Method("scram-sha-256"))
4545
}
4646
}
4747

internal/pgmonitor/postgres_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ func TestPostgreSQLHBA(t *testing.T) {
4646
outHBAs := postgres.HBAs{}
4747
PostgreSQLHBAs(inCluster, &outHBAs)
4848

49-
assert.Equal(t, outHBAs.Mandatory[0].String(), `host all "ccp_monitoring" "127.0.0.0/8" md5`)
50-
assert.Equal(t, outHBAs.Mandatory[1].String(), `host all "ccp_monitoring" "::1/128" md5`)
49+
assert.Equal(t, outHBAs.Mandatory[0].String(), `host all "ccp_monitoring" "127.0.0.0/8" scram-sha-256`)
50+
assert.Equal(t, outHBAs.Mandatory[1].String(), `host all "ccp_monitoring" "::1/128" scram-sha-256`)
5151
})
5252
}
5353

0 commit comments

Comments
 (0)