Skip to content

Commit 567ace8

Browse files
authored
chore: pg_upgrade md5-to-scram migration (#769)
* chore: pg_upgrade md5-to-scram migration * chore: dependant object definition generation * chore: remove dependency detection
1 parent 9035f97 commit 567ace8

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/complete.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ function complete_pg_upgrade {
4545
echo "4. Running generated SQL files"
4646
retry 3 run_generated_sql
4747

48-
echo "4.1. Applying correct authentication scheme"
49-
retry 3 use_corect_auth_scheme
48+
echo "4.1. Applying authentication scheme updates"
49+
retry 3 apply_auth_scheme_updates
5050

5151
sleep 5
5252

@@ -73,12 +73,14 @@ function run_generated_sql {
7373
fi
7474
}
7575

76-
# Projects which had their passwords hashed using md5 need be
77-
# configured to use md5 on upgraded instances as well, as opposed to scram-sha-256
78-
function use_corect_auth_scheme {
76+
# Projects which had their passwords hashed using md5 need to have their passwords reset
77+
# Passwords for managed roles are already present in /etc/postgresql.schema.sql
78+
function apply_auth_scheme_updates {
7979
PASSWORD_ENCRYPTION_SETTING=$(run_sql -A -t -c "SHOW password_encryption;")
8080
if [ "$PASSWORD_ENCRYPTION_SETTING" = "md5" ]; then
81-
sed -i 's/scram-sha-256/md5/g' /etc/postgresql/pg_hba.conf
81+
run_sql -c "ALTER SYSTEM SET password_encryption TO 'scram-sha-256';"
82+
run_sql -c "SELECT pg_reload_conf();"
83+
run_sql -f /etc/postgresql.schema.sql
8284
fi
8385
}
8486

common.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.0.129"
1+
postgres-version = "15.1.0.130"

0 commit comments

Comments
 (0)