diff --git a/templates/pg_hba.conf.erb b/templates/pg_hba.conf.erb index 855b1f220b..b7a288f1e0 100644 --- a/templates/pg_hba.conf.erb +++ b/templates/pg_hba.conf.erb @@ -83,12 +83,20 @@ local all all ident <%= "sameuser" if sc # IPv4 local connections: host all postgres <%= @ip_mask_deny_postgres_user + "\t" %> reject <% @ipv4acls.each do |acl|; parts = acl.split -%> +<% if parts.length <= 4 -%> +<%= parts[0] + "\t" + parts[1] + "\t" + parts[2] + "\t\t\t\t" + parts[3] %> +<% else -%> <%= parts[0] + "\t" + parts[1] + "\t" + parts[2] + "\t\t" + parts[3] + "\t\t" + parts[4] + "\t" + parts.last(parts.length - 5).join(" ") %> <% end -%> +<% end -%> host all all <%= @ip_mask_allow_all_users + "\t" %> md5 # IPv6 local connections: host all all ::1/128 md5 <% @ipv6acls.each do |acl|; parts = acl.split -%> +<% if parts.length <= 4 -%> +<%= parts[0] + "\t" + parts[1] + "\t" + parts[2] + "\t\t\t\t" + parts[3] %> +<% else -%> <%= parts[0] + "\t" + parts[1] + "\t" + parts[2] + "\t\t" + parts[3] + "\t\t" + parts[4] + "\t" + parts.last(parts.length - 5).join(" ") %> <% end -%> +<% end -%>