From: Brian Neu on
After updating postfix & postgresql (still 8.3 though), postmap lookups to postgres aren't working anymore. I HAVE recompiled postfix rpm to include the postgresql libraries.

# rpm -q postfix postgresql-server
postfix-2.6.5-2.fc11.i586 (This is actually from a fedora12 SRPM)
postgresql-server-8.3.8-2.fc11.i586


The contents of pgsql-v-alias-maps.cf:
hosts=192.168.186.128
user=dbmail
password=*password*
dbname=allmail
query = select U.userid from dbmail_users U
join dbmail_aliases A2
on A2.deliver_to = CAST( U.user_idnr AS varchar(250) )
join dbmail_aliases A1
on A1.deliver_to = A2.deliver_to
where
A1.alias = '%s'
group by userid;



I get:

]# postmap -q testuser4(a)advancedopen.com pgsql:pgsql-v-alias-maps.cf
postmap: fatal: bad string length 0 < 1: pgsql-v-alias-maps.cf_dbname =


if I add a -v, I get:
postmap: dict_eval: const mail
postmap: dict_eval: const ipv4
postmap: dict_eval: const
postmap: dict_eval: const
postmap: dict_eval: const
postmap: dict_eval: const
postmap: name_mask: ipv4
postmap: dict_eval: const mail.advancedopen.net
postmap: dict_eval: const advancedopen.net
postmap: dict_eval: const Postfix
postmap: dict_eval: expand ${multi_instance_name:postfix}${multi_instance_name?$multi_instance_name} -> postfix
postmap: dict_eval: const postfix
postmap: dict_eval: const postdrop
postmap: dict_eval: const
postmap: dict_eval: const mail.advancedopen.net
postmap: dict_eval: const
postmap: dict_eval: const /usr/libexec/postfix
postmap: dict_eval: const /var/lib/postfix
postmap: dict_eval: const /usr/sbin
postmap: dict_eval: const /var/spool/postfix
postmap: dict_eval: const pid
postmap: dict_eval: const all
postmap: dict_eval: const
postmap: dict_eval: const double-bounce
postmap: dict_eval: const nobody
postmap: dict_eval: const hash:/etc/aliases
postmap: dict_eval: const 20090828
postmap: dict_eval: const 2.6.5
postmap: dict_eval: const hash
postmap: dict_eval: const deferred, defer
postmap: dict_eval: const
postmap: dict_eval: expand $mydestination ->
postmap: dict_eval: expand $relay_domains ->
postmap: dict_eval: const TZ MAIL_CONFIG LANG
postmap: dict_eval: const MAIL_CONFIG MAIL_DEBUG MAIL_LOGTAG TZ XAUTHORITY DISPLAY LANG=C
postmap: dict_eval: const subnet
postmap: dict_eval: const
postmap: dict_eval: const +=
postmap: dict_eval: const -=+
postmap: dict_eval: const debug_peer_list,fast_flush_domains,mynetworks,permit_mx_backup_networks,qmqpd_authorized_clients,relay_domains,smtpd_access_maps
postmap: dict_eval: const
postmap: dict_eval: const bounce
postmap: dict_eval: const cleanup
postmap: dict_eval: const defer
postmap: dict_eval: const pickup
postmap: dict_eval: const qmgr
postmap: dict_eval: const rewrite
postmap: dict_eval: const showq
postmap: dict_eval: const error
postmap: dict_eval: const flush
postmap: dict_eval: const verify
postmap: dict_eval: const trace
postmap: dict_eval: const proxymap
postmap: dict_eval: const proxywrite
postmap: dict_eval: const
postmap: dict_eval: const 20480000
postmap: dict_eval: const 204800
postmap: dict_eval: const 100s
postmap: dict_eval: const 100s
postmap: dict_eval: const 100s
postmap: dict_eval: const 100s
postmap: dict_eval: const 3600s
postmap: dict_eval: const 3600s
postmap: dict_eval: const 5s
postmap: dict_eval: const 5s
postmap: dict_eval: const 1000s
postmap: dict_eval: const 1000s
postmap: dict_eval: const 10s
postmap: dict_eval: const 10s
postmap: dict_eval: const 1s
postmap: dict_eval: const 1s
postmap: dict_eval: const 1s
postmap: dict_eval: const 1s
postmap: dict_eval: const 500s
postmap: dict_eval: const 500s
postmap: dict_eval: const 18000s
postmap: dict_eval: const 18000s
postmap: dict_eval: const 1s
postmap: dict_eval: const 1s
postmap: dict_eval: const 1s
postmap: dict_eval: const 127.0.0.0/8, 192.168.185.0/24, 192.168.186.0/24
postmap: inet_addr_local: configured 7 IPv4 addresses
postmap: dict_eval: const
postmap: cfg_get_str: pgsql-v-alias-maps.cf: user =
postmap: dict_eval: const
postmap: cfg_get_str: pgsql-v-alias-maps.cf: password =
postmap: dict_eval: const
postmap: fatal: bad string length 0 < 1: pgsql-v-alias-maps.cf_dbname =



I can't seem to figure out why the dbname & other values are empty.

Thanks!

From: Devdas Bhagat on
On Thu, Dec 10, 2009 at 05:42:13AM -0800, Brian Neu wrote:
> After updating postfix & postgresql (still 8.3 though), postmap lookups
> to postgres aren't working anymore. I HAVE recompiled postfix rpm to
> include the postgresql libraries.
>
<snip>
>
> I get:
>
> ]# postmap -q testuser4(a)advancedopen.com pgsql:pgsql-v-alias-maps.cf
> postmap: fatal: bad string length 0 < 1: pgsql-v-alias-maps.cf_dbname =
>
Use the full path to the map. Relative paths end up looking for the
map_name_variable inside main.cf for historical reasons.

Devdas Bhagat

From: Brian Neu on
Devdas, that worked! Sorta.

At least now it reveals another message:
postmap: warning: connect to pgsql server localhost: FATAL: Ident authentication failed for user "dbmail"?

but I can psql into the db just fine with those settings.

Got it.

had to s/localhost/127.0.0.1/ for everything. I have yet to find out why, but sqlgrey & amavis had the same issue. pg_hba.conf remained the same though.


muchas gracias





----- Original Message ----
From: Devdas Bhagat <devdas(a)dvb.homelinux.org>
To: postfix-users(a)cloud9.net
Sent: Thu, December 10, 2009 8:51:08 AM
Subject: Re: up'd Fedora from 10->11, now postmap won't query pgsql db

On Thu, Dec 10, 2009 at 05:42:13AM -0800, Brian Neu wrote:
> After updating postfix & postgresql (still 8.3 though), postmap lookups
> to postgres aren't working anymore. I HAVE recompiled postfix rpm to
> include the postgresql libraries.
>
<snip>
>
> I get:
>
> ]# postmap -q testuser4(a)advancedopen.com pgsql:pgsql-v-alias-maps.cf
> postmap: fatal: bad string length 0 < 1: pgsql-v-alias-maps.cf_dbname =
>
Use the full path to the map. Relative paths end up looking for the
map_name_variable inside main.cf for historical reasons.

Devdas Bhagat

From: Devdas Bhagat on
On Thu, Dec 10, 2009 at 06:33:42AM -0800, Brian Neu wrote:
> Devdas, that worked! Sorta.
>
> At least now it reveals another message:
> postmap: warning: connect to pgsql server localhost: FATAL: Ident
> authentication failed for user "dbmail"?

I bet Postfix is not running as user dbmail and you have ident authentication
on in pg_hba.conf.

Devdas Bhagat