-
Notifications
You must be signed in to change notification settings - Fork 282
Enable replication connections by default in pg_hba.conf
#222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Upstream commit: - postgres/postgres@be37c21 - 9 Mar 2017 - master REL_11_BETA1 REL_10_4 ... REL_10_BETA1
@noelmcloughlin I've just added another commit, to separate the v10+ Test output for version [
[u'local', u'all', u'all', u'peer'],
[u'host', u'all', u'all', u'127.0.0.1/32', u'md5'],
[u'host', u'all', u'all', u'::1/128', u'md5']
] Test output for version [
[u'local', u'all', u'all', u'peer'],
[u'host', u'all', u'all', u'127.0.0.1/32', u'md5'],
[u'host', u'all', u'all', u'::1/128', u'md5'],
[u'local', u'replication', u'all', u'peer'],
[u'host', u'replication', u'all', u'127.0.0.1/32', u'md5'],
[u'host', u'replication', u'all', u'::1/128', u'md5']
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @myii for the valuable PR. I just have some minor comments which are easy to resolve.
@@ -2,7 +2,7 @@ | |||
|
|||
postgres: | |||
use_upstream_repo: True | |||
version: '9.5' | |||
version: '10' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting10
as "default" should be okay. Debian stretch ships with version 9.6
but the version
parameter is paired with use_upstream_repo: True
and version 10
seems to be widely available upstream, and for Debian stretch too. Approved.
postgres/defaults.yaml
Outdated
@@ -47,6 +47,12 @@ postgres: | |||
- ['host', 'all', 'all', '127.0.0.1/32', 'md5'] | |||
# IPv6 local connections: | |||
- ['host', 'all', 'all', '::1/128', 'md5'] | |||
acls_v10: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax and content looks fine. Consider changing identifier name from acls_v10
to acls_replication
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that having multiple settings for ACL is really that good idea.
I have checked PostgreSQL docs, and it seams the replication settings are supported starting at least from PG release 9.0.
So I think it would be no harm to include these ACL rules by default for any PG version.
postgres/server/init.sls
Outdated
@@ -107,6 +107,10 @@ postgresql-conf: | |||
{%- endif %} | |||
|
|||
{%- set pg_hba_path = salt['file.join'](postgres.conf_dir, 'pg_hba.conf') %} | |||
{%- set acls = postgres.acls %} | |||
{%- if postgres.version|to_num >= 10 %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use int
instead of to_num
(salt v2018), or even str_to_num
(salt v2017). In this case the Jinja builtin filters are more portable. Not everybody uses latest Salt versions in production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@noelmcloughlin @myii
I doubt about adding additional Pillar key for the replication case. Please see my comment below.
postgres/defaults.yaml
Outdated
@@ -47,6 +47,12 @@ postgres: | |||
- ['host', 'all', 'all', '127.0.0.1/32', 'md5'] | |||
# IPv6 local connections: | |||
- ['host', 'all', 'all', '::1/128', 'md5'] | |||
acls_v10: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that having multiple settings for ACL is really that good idea.
I have checked PostgreSQL docs, and it seams the replication settings are supported starting at least from PG release 9.0.
So I think it would be no harm to include these ACL rules by default for any PG version.
Good catch @vutny. The purpose of the upstream commit was to "Enable replication connections by default in pg_hba.conf" so feature already existed. I too would prefer one |
Thanks for all of the feedback. When I get a chance, I'll rebase and let you know.
------------------
Sent from my BlackBerry
…________________________________
From: N <[email protected]>
Date: Sun, 17 Jun 2018 05:14:27 -0700
To: saltstack-formulas/postgres-formula<[email protected]>
ReplyTo: saltstack-formulas/postgres-formula <[email protected]>
Cc: Imran Iqbal<[email protected]>; Mention<[email protected]>
Subject: Re: [saltstack-formulas/postgres-formula] Enable replication connections by default in `pg_hba.conf` (#222)
Good catch @vutny<https://github.com/vutny>. The purpose of the upstream commit <postgres/postgres@be37c21> was to "Enable replication connections by default in pg_hba.conf" so feature already existed. I too would prefer one [acls] block.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#222 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AJwewS72t1qnlwvMQJREA_S1RxFJcLqXks5t9kgjgaJpZM4UlYZl>.
|
@noelmcloughlin @vutny Rebased to remove the superfluous commit. Ready for final checks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work, thanks!!
Merged ! @myii @noelmcloughlin @vutny thanks for the work |
You're welcome. |
Upstream commit:
When installing version
10
, defaultpg_hba.conf
additionally contains: