Ido Segal
Ido Segal

Reputation: 422

Postgres configuration using windows authentication

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?

Upvotes: 0

Views: 571

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246013

You can use wildcards in pg_ident.conf:

MapForSSPI     /^user@        postgres

That will match everything that starts with user@. If the “system user name” starts with a /, the rest of the string will be treated as a regular expression.

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

Upvotes: 1

Related Questions