0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks a lot! and of course, I will take it in attention.
Thanks for the edit. There should be no brackets around the regular expression, that would change the meaning.
But it doesn't worked without it.
Then the system user name does not start with user@. [^user@] would mean "any string that contains a letter other than u, s, e, r, and @".
You're right. There is a Capital Letter in the orig user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.