File tree Expand file tree Collapse file tree 8 files changed +25
-20
lines changed
server_install_os/controls Expand file tree Collapse file tree 8 files changed +25
-20
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ postgresql_access 'local_foo_user' do
60
60
database ' all'
61
61
user ' foo'
62
62
address ' 127.0.0.1/32'
63
- auth_method ' md5 '
63
+ auth_method ' scram-sha-256 '
64
64
end
65
65
```
66
66
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ def default_yum_gpg_key_uri
152
152
if platform_family? ( 'rhel' ) && node [ 'platform_version' ] . to_i == 7
153
153
'https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG-KEY-RHEL7'
154
154
elsif platform_family? ( 'fedora' )
155
- 'https://download.postgresql.org/pub/repos/yum/keys/PGDG-KEY-fedora '
155
+ 'https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG- KEY-Fedora '
156
156
else
157
157
'https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG-KEY-RHEL'
158
158
end
@@ -173,6 +173,10 @@ def rhel_init_db_command(new_resource)
173
173
cmd << " -D '#{ data_dir } '"
174
174
end
175
175
176
+ def fedora_init_db_command
177
+ 'usr/bin/postgresql-setup --initdb'
178
+ end
179
+
176
180
# Given the base URL build the complete URL string for a yum repo
177
181
def yum_repo_url ( base_url )
178
182
"#{ base_url } /#{ new_resource . version } /#{ yum_repo_platform_family_string } /#{ yum_repo_platform_string } "
Original file line number Diff line number Diff line change @@ -98,9 +98,10 @@ def install_method_repo?
98
98
def do_repository_action ( repo_action )
99
99
case node [ 'platform_family' ]
100
100
when 'rhel' , 'fedora' , 'amazon'
101
+ # Disable the PostgreSQL module if we're on RHEL 8 not on fedora
101
102
dnf_module 'postgresql' do
102
103
action :disable
103
- end if dnf_module_platform?
104
+ end if dnf_module_platform? && ! platform_family? ( 'fedora' )
104
105
105
106
remote_file '/etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY' do
106
107
source new_resource . yum_gpg_key_uri
@@ -272,7 +273,7 @@ def do_server_package_action(package_action)
272
273
273
274
converge_by ( 'Init PostgreSQL' ) do
274
275
execute 'init_db' do
275
- command rhel_init_db_command ( new_resource )
276
+ command platform_family? ( 'fedora' ) ? fedora_init_db_command : rhel_init_db_command ( new_resource )
276
277
user new_resource . initdb_user
277
278
end
278
279
end
Original file line number Diff line number Diff line change 9
9
database 'all'
10
10
user 'postgres'
11
11
address '127.0.0.1/32'
12
- auth_method 'md5 '
12
+ auth_method 'scram-sha-256 '
13
13
end
14
14
15
15
postgresql_service 'postgresql' do
45
45
type 'host'
46
46
database 'all'
47
47
user 'sous_chef'
48
- auth_method 'md5 '
48
+ auth_method 'scram-sha-256 '
49
49
address '127.0.0.1/32'
50
50
position 5
51
51
74
74
type 'host'
75
75
database 'all'
76
76
user 'hostname_user'
77
- auth_method 'md5 '
77
+ auth_method 'scram-sha-256 '
78
78
address 'host.domain'
79
79
80
80
notifies :restart , 'postgresql_service[postgresql]' , :delayed
84
84
type 'host'
85
85
database 'all'
86
86
user 'hostname.user'
87
- auth_method 'md5 '
87
+ auth_method 'scram-sha-256 '
88
88
address 'host.domain'
89
89
90
90
notifies :restart , 'postgresql_service[postgresql]' , :delayed
94
94
type 'host'
95
95
database 'my_database'
96
96
user 'hostname.user'
97
- auth_method 'md5 '
97
+ auth_method 'scram-sha-256 '
98
98
address 'host.domain'
99
99
100
100
notifies :restart , 'postgresql_service[postgresql]' , :delayed
104
104
type 'host'
105
105
database 'my_database'
106
106
user 'hostname.user'
107
- auth_method 'md5 '
107
+ auth_method 'scram-sha-256 '
108
108
address 'a.very.long.host.domain.that.exceeds.the.max.of.24.characters'
109
109
110
110
notifies :restart , 'postgresql_service[postgresql]' , :delayed
135
135
database 'foo,bar'
136
136
user 'john,doe'
137
137
address '127.0.0.1/32'
138
- auth_method 'md5 '
138
+ auth_method 'scram-sha-256 '
139
139
end
Original file line number Diff line number Diff line change 50
50
database 'all'
51
51
user 'postgres'
52
52
address '127.0.0.1/32'
53
- auth_method 'md5 '
53
+ auth_method 'scram-sha-256 '
54
54
55
55
notifies :reload , 'postgresql_service[postgresql]' , :delayed
56
56
end
Original file line number Diff line number Diff line change 41
41
database 'all'
42
42
user 'postgres'
43
43
address '127.0.0.1/32'
44
- auth_method 'md5 '
44
+ auth_method 'scram-sha-256 '
45
45
end
46
46
47
47
postgresql_user 'postgres' do
77
77
type 'host'
78
78
database 'all'
79
79
user 'sous_chef'
80
- auth_method 'md5 '
80
+ auth_method 'scram-sha-256 '
81
81
address '127.0.0.1/32'
82
82
83
83
notifies :restart , 'postgresql_service[postgresql]' , :delayed
Original file line number Diff line number Diff line change 5
5
describe postgres_hba_conf . where { type == 'host' && user == 'postgres' } do
6
6
its ( 'database' ) { should cmp 'all' }
7
7
its ( 'user' ) { should cmp 'postgres' }
8
- its ( 'auth_method' ) { should cmp 'md5 ' }
8
+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
9
9
its ( 'address' ) { should cmp '127.0.0.1/32' }
10
10
end
11
11
23
23
describe postgres_hba_conf . where { user == 'sous_chef' } do
24
24
its ( 'database' ) { should cmp 'all' }
25
25
its ( 'type' ) { should cmp 'host' }
26
- its ( 'auth_method' ) { should cmp 'md5 ' }
26
+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
27
27
its ( 'address' ) { should cmp '127.0.0.1/32' }
28
28
end
29
29
41
41
describe postgres_hba_conf . where { user == 'hostname_user' } do
42
42
its ( 'database' ) { should cmp 'all' }
43
43
its ( 'type' ) { should cmp 'host' }
44
- its ( 'auth_method' ) { should cmp 'md5 ' }
44
+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
45
45
its ( 'address' ) { should cmp 'host.domain' }
46
46
end
47
47
end
53
53
describe postgres_hba_conf . where { address == 'a.very.long.host.domain.that.exceeds.the.max.of.24.characters' } do
54
54
its ( 'database' ) { should cmp 'my_database' }
55
55
its ( 'type' ) { should cmp 'host' }
56
- its ( 'auth_method' ) { should cmp 'md5 ' }
56
+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
57
57
its ( 'address' ) { should cmp 'a.very.long.host.domain.that.exceeds.the.max.of.24.characters' }
58
58
end
59
59
end
Original file line number Diff line number Diff line change 5
5
describe postgres_hba_conf . where { type == 'host' && user == 'postgres' } do
6
6
its ( 'database' ) { should cmp 'all' }
7
7
its ( 'user' ) { should cmp 'postgres' }
8
- its ( 'auth_method' ) { should cmp 'md5 ' }
8
+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
9
9
its ( 'address' ) { should cmp '127.0.0.1/32' }
10
10
end
11
11
23
23
describe postgres_hba_conf . where { user == 'sous_chef' } do
24
24
its ( 'database' ) { should cmp 'all' }
25
25
its ( 'type' ) { should cmp 'host' }
26
- its ( 'auth_method' ) { should cmp 'md5 ' }
26
+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
27
27
its ( 'address' ) { should cmp '127.0.0.1/32' }
28
28
end
29
29
You can’t perform that action at this time.
0 commit comments