PostgreSQLHBAs provides the Postgres HBA rules for allowing the monitoring exporter to be accessible
(ctx context.Context, inCluster *v1beta1.PostgresCluster, outHBAs *postgres.HBAs)
| 24 | // PostgreSQLHBAs provides the Postgres HBA rules for allowing the monitoring |
| 25 | // exporter to be accessible |
| 26 | func PostgreSQLHBAs(ctx context.Context, inCluster *v1beta1.PostgresCluster, outHBAs *postgres.HBAs) { |
| 27 | if ExporterEnabled(ctx, inCluster) || |
| 28 | collector.OpenTelemetryMetricsEnabled(ctx, inCluster) { |
| 29 | // Limit the monitoring user to local connections using SCRAM. |
| 30 | outHBAs.Mandatory = append(outHBAs.Mandatory, |
| 31 | postgres.NewHBA().TCP().Users(MonitoringUser).Method("scram-sha-256").Network("127.0.0.0/8"), |
| 32 | postgres.NewHBA().TCP().Users(MonitoringUser).Method("scram-sha-256").Network("::1/128"), |
| 33 | postgres.NewHBA().TCP().Users(MonitoringUser).Method("reject")) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // PostgreSQLParameters provides additional required configuration parameters |
| 38 | // that Postgres needs to support monitoring for both pgMonitor and OTel |