Skip to content

Commit fe32154

Browse files
DPE-5512: Switch md5 to scram-sha-256 by default in postgresql
Keep pgbouncer_auth_relation_% users in md5, enforce scram-sha-256 for all other users.
1 parent 1609fa2 commit fe32154

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

templates/patroni.yml.j2

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,28 +181,33 @@ postgresql:
181181
- {{ 'hostssl' if enable_tls else 'host' }} all +charmed_admin 0.0.0.0/0 scram-sha-256
182182
- {{ 'hostssl' if enable_tls else 'host' }} all +charmed_databases_owner 0.0.0.0/0 scram-sha-256
183183
{%- if not connectivity %}
184-
- {{ 'hostssl' if enable_tls else 'host' }} all all {{ self_ip }} md5
184+
- {{ 'hostssl' if enable_tls else 'host' }} all all {{ self_ip }} scram-sha-256
185185
- {{ 'hostssl' if enable_tls else 'host' }} all all 0.0.0.0/0 reject
186186
{%- elif enable_ldap %}
187187
- {{ 'hostssl' if enable_tls else 'host' }} all +identity_access 0.0.0.0/0 ldap {{ ldap_parameters }}
188-
- {{ 'hostssl' if enable_tls else 'host' }} all +internal_access 0.0.0.0/0 md5
189-
{%- for user, databases in user_databases_map.items() %}
190-
- {{ 'hostssl' if enable_tls else 'host' }} {{ databases }} {{ user }} 0.0.0.0/0 md5
191-
{%- endfor %}
188+
- {{ 'hostssl' if enable_tls else 'host' }} all +internal_access 0.0.0.0/0 scram-sha-256
189+
{%- for user, databases in user_databases_map.items() %}
190+
- {{ 'hostssl' if enable_tls else 'host' }} {{ databases }} {{ user }} 0.0.0.0/0 scram-sha-256
191+
{%- endfor %}
192192
{%- else %}
193-
- {{ 'hostssl' if enable_tls else 'host' }} all +internal_access 0.0.0.0/0 md5
194-
{%- for user, databases in user_databases_map.items() %}
193+
- {{ 'hostssl' if enable_tls else 'host' }} all +internal_access 0.0.0.0/0 scram-sha-256
194+
{%- for user, databases in user_databases_map.items() %}
195+
{%- if 'pgbouncer_auth_relation_' in user %}
195196
- {{ 'hostssl' if enable_tls else 'host' }} {{ databases }} {{ user }} 0.0.0.0/0 md5
196-
{%- endfor %}
197+
{%- else %}
198+
- {{ 'hostssl' if enable_tls else 'host' }} {{ databases }} {{ user }} 0.0.0.0/0 scram-sha-256
199+
{%- endif %}
200+
{%- endfor %}
197201
{%- endif %}
198-
- {{ 'hostssl' if enable_tls else 'host' }} replication replication 127.0.0.1/32 md5
202+
- {{ 'hostssl' if enable_tls else 'host' }} replication replication 127.0.0.1/32 scram-sha-256
199203
# Allow replications connections from other cluster members.
200204
{%- for endpoint in extra_replication_endpoints %}
201-
- {{ 'hostssl' if enable_tls else 'host' }} replication replication {{ endpoint }}/32 md5
205+
- {{ 'hostssl' if enable_tls else 'host' }} replication replication {{ endpoint }}/32 scram-sha-256
202206
{%- endfor %}
203207
{%- for peer_ip in peers_ips %}
204-
- {{ 'hostssl' if enable_tls else 'host' }} replication replication {{ peer_ip }}/0 md5
205-
{% endfor %}
208+
- {{ 'hostssl' if enable_tls else 'host' }} replication replication {{ peer_ip }}/0 scram-sha-256
209+
{%- endfor %}
210+
206211
pg_ident:
207212
- operator _daemon_ backup
208213
authentication:

0 commit comments

Comments
 (0)