Skip to content

Commit 15cb658

Browse files
Pawel Krawczykkravietz
authored andcommitted
Support SCRAM-SHA-256 password hashing on 10+
Signed-off-by: Pawel Krawczyk <pawel.krawczyk@hush.com>
1 parent 1eee3f0 commit 15cb658

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

controls/postgres_spec.rb

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,24 @@
157157
impact 1.0
158158
title 'Use salted MD5 to store postgresql passwords'
159159
desc 'Store postgresql passwords in salted hash format (e.g. salted MD5).'
160-
describe postgres_session(USER, PASSWORD).query('SELECT passwd FROM pg_shadow;') do
161-
its('output') { should match(/^md5\S*$/) }
162-
end
163-
describe postgres_conf(POSTGRES_CONF_PATH) do
164-
its('password_encryption') { should eq 'on' }
160+
describe command('psql -V') do
161+
case its('output')
162+
when /^9/
163+
describe postgres_session(USER, PASSWORD).query('SELECT passwd FROM pg_shadow;') do
164+
its('output') { should match(/^md5\S*$/) }
165+
end
166+
describe postgres_conf(POSTGRES_CONF_PATH) do
167+
its('password_encryption') { should eq 'on' }
168+
end
169+
when /^10/
170+
describe postgres_session(USER, PASSWORD).query('SELECT passwd FROM pg_shadow;') do
171+
its('output') { should match(/^scram-sha-256\S*$/) }
172+
end
173+
describe postgres_conf(POSTGRES_CONF_PATH) do
174+
its('password_encryption') { should eq 'scram-sha-256' }
175+
end
176+
end
177+
end
165178
end
166179
end
167180

0 commit comments

Comments
 (0)