Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Server hba_configuration not overwritable #49

Description

@j15e

The README states :

Server attributes are starting from ["postgresql"]["defaults"] and used as default attributes for postgresql provider. You should not override this defaults, you can pass your settings to provider instead.

Okay fine for config flags - but I think there is a problem with the hba configurations if we follow that thinking. We can't overwrite defaults hba permissions the recipe provide.

The hba_configuration configuration is merged with the defaults, not overwritten :

hba_configuration = node['postgresql']['defaults']['server']['hba_configuration'] | new_resource.hba_configuration
ident_configuration = node['postgresql']['defaults']['server']['ident_configuration'] | new_resource.ident_configuration

So you can't actually remove or replace any of the defaults entries from pg_hba.conf. I think theses configurations setup should be a || not | with the resource specific config.

In the examples where it looks to me like the provided hba_configuration inside the postgresql 'main' do block should be the ending result :

  hba_configuration(
    [
      { type: 'host', database: 'all', user: 'all', address: '192.168.0.0/24', method: 'md5' },
      { type: 'host', database: 'replication', user: 'postgres', address: '192.168.0.2/32', method: 'trust' }
    ]
  )

But I end up with that config plus all the defaults :

default['postgresql']['defaults']['server']['hba_configuration'] = [
{ type: 'local', database: 'all', user: 'postgres', address: '', method: 'peer' },
{ type: 'local', database: 'all', user: 'all', address: '', method: 'peer' },
{ type: 'host', database: 'all', user: 'all', address: '127.0.0.1/32', method: 'md5' },
{ type: 'host', database: 'all', user: 'all', address: '::1/128', method: 'md5' },
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions