Cookbooks
postgresql
documentation
Postgresql Ident

postgresql_ident

Back to resource list

This resource generate pg_ident.conf configuration file to manage user mapping between system and PostgreSQL users.

Uses

Actions

  • :create - Creates a mapping line inside of pg_ident.conf
  • :update - Update a mapping line inside of pg_ident.conf
  • :delete - Delete a mapping line inside of pg_ident.conf

Properties

NameName?TypeDefaultDescriptionAllowed Values
config_fileString
sourceString
map_nameStringArbitrary name that will be used to refer to this mapping in pg_hba.conf
system_usernameStringOperating system user name
database_usernameStringDatabase user name
commentStringIdent mapping record comment

Libraries

  • PostgreSQL::Cookbook::IdentHelpers::PgIdentTemplate

Examples

Creates a mymapping mapping that map john system user to user1 PostgreSQL user:

postgresql_ident 'Map john to user1' do
  comment 'John Mapping'
  map_name 'mymapping'
  system_username 'john'
  database_username 'user1'
end

This generates the following line in the pg_ident.conf:

# MAPNAME       SYSTEM-USERNAME         PG-USERNAME

# John Mapping
mymapping       john                    user1               # John Mapping

To grant access to the foo user with password authentication:

postgresql_access 'local_foo_user' do
  comment 'Foo user access'
  type 'host'
  database 'all'
  user 'foo'
  address '127.0.0.1/32'
  auth_method 'md5'
end

This generates the following line in the pg_hba.conf:

# Local postgres superuser access
host   all             foo               127.0.0.1/32           ident           # Foo user access