Home > database >  Postgres configuration using windows authentication
Postgres configuration using windows authentication

Time:12-20

I'm starting to use Postgres as a database in my application, and I need to configure an agent that serves as a build server as part of the build we are running unit tests. I need to configure the agent and I'm having trouble as the agent name is different for each machine, and there is a configuration in Postgres that needs to be applied when using windows authentication in the pg_hba.conf and pg_indent.conf.

In the pg_indent.conf I need to use a system user, and I have one, but in the following syntax user@comutername:

# MAPNAME       SYSTEM-USERNAME         PG-USERNAME
MapForSSPI     user@computername        postgres

The issue is when the agent is starting (we have a dynamic pool) the name of the computer is different, and I want to avoid using the computer name, and use something like user@localhost or the equivalent in Postgres.

How I can achieve that?

CodePudding user response:

You can use wildcards in pg_ident.conf:

MapForSSPI     /^user@        postgres

That will match everything that starts with user@.

Pleas promise me that you will not allow your application to connect as a superuser, that is an unnecessary risk.

  • Related