Hello

Using psql I can connect to postgresql's socket with a database user/role
that does not have a password set. This is achieved by using "peer"
authentication method and maps set in "pg_ident.conf" file:
mailserver_map  postfix  mailserver

"pg_hba.conf" file:
local    mailserver    all    peer map=mailserver_map

Issuing following command works and doesn't require password:
sudo -u postfix psql -U mailserver -d mailserver -h /var/run/postgresql

Additionally, all queries using "postmap -q" succeed with correct results.

But none of the look ups defined in "virtual_mailbox_maps.cf" or "
virtual_alias_maps.cf" work when the postfix server tries them, and in fact
they report that connection to postgresql fails because it can't find it!:

postfix/trivial-rewrite[8119]: warning: connect to pgsql server
/var/run/postgresql: could not connect to server: No such file or
directory??Is the server running locally and accepting??connections on Unix
domain socket "/var/run/postgresql/.s.PGSQL.5432"??

My virtual maps look like this:
user = mailserver
dbname = mailserver
query = SELECT destination FROM virtual_aliases WHERE source = '%s'
hosts = /var/run/postgresql

My questions are:
1- Why Postfix reports that it can't connect to server instead of a message
like "authentication failed for user"? Can this be considered a bug since
it seems not providing "password" field breaks the command Postifx uses to
establish communication to Postgres (hence the incorrect error message)?

2- Is there a way of achieving this authentication method that I am
missing? I can make it work if I add a password for the database user and
provide that in "virtual_alias_maps.cf" files but I was wondering if this
can be done without password since I am using local/socket-based connection?

Thanks in advance for your time,
Hamid

Reply via email to