On 1/28/2017 12:16 PM, Wietse Venema wrote:
> Sorry about that, I should have written 'import_environment'. That
> setting controls what Postfix uses internally, including in its
> pgsql client.
>
>       Wietse

    Okay so am I doing something wrong here... I've got the following in
my main.cf:

import_environment = PGPASSFILE=/etc/postfix/pgsql/.pgpass
virtual_alias_maps = proxy:pgsql:/etc/postfix/pgsql/virtual_alias.cf,
    proxy:pgsql:/etc/postfix/pgsql/virtual_alias_domainaliases.cf
virtual_mailbox_maps = proxy:pgsql:/etc/postfix/pgsql/virtual_mailbox.cf,
    proxy:pgsql:/etc/postfix/pgsql/virtual_mailbox_domainaliases.cf
virtual_mailbox_domains = proxy:pgsql:/etc/postfix/pgsql/virtual_domains.cf

    With the /etc/postfix/pgsql/*.cf files all following the format:

user = DB_USER
password = DB_PASSWD
hosts = psqldb.undergrid.net
dbname = postfixadmin
query = <SQL QUERY>

    Everything is working fine... So with the PGPASSFILE set in
import_environment and I've confirmed through procfs that it is in the
environ file for the postfix processes I comment out the 'user' and
'password' lines in each of the .cf files and restart postfix. I then
tried to run 'sendmail -bv jbo...@undergrid.net' and I get the following:

Jan 28 22:25:53 mail02 postfix/pickup[20576]: 99FFD5FB82: uid=0 from=<root>
Jan 28 22:25:53 mail02 postfix/cleanup[20633]: 99FFD5FB82:
message-id=<20170128222553.99ffd5f...@smtp.undergrid.net>
Jan 28 22:25:53 mail02 postfix/qmgr[20577]: 99FFD5FB82:
from=<r...@smtp.undergrid.net>, size=291, nrcpt=1 (queue active)
Jan 28 22:25:53 mail02 postfix/proxymap[20634]: warning: connect to
pgsql server psqldb.undergrid.net: fe_sendauth: no password supplied?
Jan 28 22:25:53 mail02 postfix/trivial-rewrite[20635]: warning:
proxy:pgsql:/etc/postfix/pgsql/virtual_alias.cf: table lookup problem
Jan 28 22:25:53 mail02 postfix/trivial-rewrite[20635]: warning:
virtual_alias_domains lookup failure
Jan 28 22:25:53 mail02 postfix/error[20636]: 99FFD5FB82:
to=<jbo...@undergrid.net>, relay=none, delay=0.22,
delays=0.02/0.2/0/0.01, dsn=4.3.0, status=undeliverable (address
resolver failure)
Jan 28 22:25:53 mail02 postfix/cleanup[20633]: warning:
proxy:pgsql:/etc/postfix/pgsql/virtual_alias.cf lookup error for
"r...@undergrid.net"
Jan 28 22:25:53 mail02 postfix/cleanup[20633]: warning: CDBC05FC95:
virtual_alias_maps map lookup problem for r...@undergrid.net -- message
not accepted, try again later
Jan 28 22:25:53 mail02 postfix/qmgr[20577]: 99FFD5FB82: status=deferred
(trace failed)

    My /etc/postfix/psql/.pgpass file has
"psqldb.undergrid.net:5432:postfixadmin:DB_USER:DB_PASSWD" and it's
chmod 0600 and chown postfix:root. I know the .pgpass file itself is
valid as if I set the PGPASSFILE environment variable on my shell and
run 'psql -h psqldb.undergrid.net -U DB_USER postfixadmin' I am able to
log into the database and query it when ran from a user that doesn't
otherwise have access to the database.

    Am I missing something?

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to