Open trust in pg_hba.conf during bootstrap to localhost (#1075)

previously it was open by mistake to unix_socket only

Fixes https://github.com/zalando/patroni/issues/1072
This commit is contained in:
Alexander Kukushkin
2019-06-11 15:14:57 +02:00
committed by GitHub
parent 3b90cc1931
commit 75926b442e
+4 -4
View File
@@ -152,10 +152,10 @@ class ConfigHandler(object):
# and in order to be able to change it, we are opening trust access from a certain address
if self._postgresql.bootstrap.running_custom_bootstrap:
addresses = {'': 'local'}
if 'host' in self._local_address and not self._local_address['host'].startswith('/'):
for _, _, _, _, sa in socket.getaddrinfo(self._local_address['host'], self._local_address['port'],
0, socket.SOCK_STREAM, socket.IPPROTO_TCP):
addresses[sa[0] + '/32'] = 'host'
if 'host' in self.local_replication_address and not self.local_replication_address['host'].startswith('/'):
addresses.update({sa[0] + '/32': 'host' for _, _, _, _, sa in socket.getaddrinfo(
self.local_replication_address['host'], self.local_replication_address['port'],
0, socket.SOCK_STREAM, socket.IPPROTO_TCP)})
with open(self._pg_hba_conf, 'w') as f:
f.write(self._CONFIG_WARNING_HEADER)