|
1 | 1 | # encoding: utf-8 |
2 | 2 |
|
3 | 3 | # Copyright 2016, Patrick Muench |
| 4 | +# Copyright 2016-2019 DevSec Hardening Framework Team |
4 | 5 | # |
5 | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 7 | # you may not use this file except in compliance with the License. |
|
155 | 156 |
|
156 | 157 | control 'postgres-06' do |
157 | 158 | impact 1.0 |
158 | | - title 'Use salted MD5 to store postgresql passwords' |
| 159 | + title 'Use salted hash to store postgresql passwords' |
159 | 160 | desc 'Store postgresql passwords in salted hash format (e.g. salted MD5).' |
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 |
| 161 | + case postgres.version |
| 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' } |
177 | 175 | end |
178 | 176 | end |
179 | 177 | end |
|
0 commit comments