I'm following along with the workaround.org tutorial for setting up a mailserver. Previously I'd been running dovecot+postfix+postgres for 3-4 years successfully on Debian, but I thought I'd test drive FreeBSD. I am currently stuck on trying to set up postfix's virtual aliases. I created the following file:
If I attempt this query manually, it works:
So I inserted that line into my postfix config and tried to run a sample query, but it didn't work and I don't know how to debug what's going on. Googling the error message has not produced anything of value:
I'm completely stumped. Can anyone shed some light on what's going on? I get the same query error/application error irrespective of which domain I try to query. Help!
Code:
# cat pgsql-virtual-mailbox-domains.cf
user = mailuser
password = supersecret
hosts = 127.0.0.1
dbname = mailserver
query = SELECT 1 FROM virtual_domains WHERE name='%s'
If I attempt this query manually, it works:
Code:
# psql -U mailuser mailserver
psql (14.1)
Type "help" for help.
mailserver=> select 1 from virtual_domains where name='mydomain.tld';
?column?
----------
1
(1 row)
So I inserted that line into my postfix config and tried to run a sample query, but it didn't work and I don't know how to debug what's going on. Googling the error message has not produced anything of value:
Code:
# postconf virtual_mailbox_domains=proxy:pgsql:/usr/local/etc/postfix/pgsql-virtual-mailbox-domains.cf
# service postfix reload
postfix/postfix-script: refreshing the Postfix mail system
# postmap -v -q example.org proxy:pgsql:/usr/local/etc/postfix/pgsql-virtual-mailbox-domains.cf
postmap: name_mask: ipv4
postmap: name_mask: host
postmap: inet_addr_local: configured 2 IPv4 addresses
postmap: been_here: <scrubbed>/32: 0
postmap: been_here: 127.0.0.1/32: 0
postmap: mynetworks_core: <scrubbed>/32 127.0.0.1/32
postmap: connect to subsystem /var/spool/postfix/private/proxymap
postmap: /var/spool/postfix/private/proxymap socket: wanted attribute: protocol
postmap: input attribute name: protocol
postmap: input attribute value: proxymap_protocol
postmap: /var/spool/postfix/private/proxymap socket: wanted attribute: (list terminator)
postmap: input attribute name: (end)
postmap: send attr request = open
postmap: send attr table = pgsql:/usr/local/etc/postfix/pgsql-virtual-mailbox-domains.cf
postmap: send attr flags = 0
postmap: /var/spool/postfix/private/proxymap socket: wanted attribute: status
postmap: input attribute name: status
postmap: input attribute value: 0
postmap: /var/spool/postfix/private/proxymap socket: wanted attribute: flags
postmap: input attribute name: flags
postmap: input attribute value: 524385
postmap: /var/spool/postfix/private/proxymap socket: wanted attribute: (list terminator)
postmap: input attribute name: (end)
postmap: dict_proxy_open: connect to map=pgsql:/usr/local/etc/postfix/pgsql-virtual-mailbox-domains.cf status=0 server_flags=warn_dup|pattern|lock|utf8_request
postmap: dict_open: proxy:pgsql:/usr/local/etc/postfix/pgsql-virtual-mailbox-domains.cf
postmap: send attr request = lookup
postmap: send attr table = pgsql:/usr/local/etc/postfix/pgsql-virtual-mailbox-domains.cf
postmap: send attr flags = 524353
postmap: send attr key = example.org
postmap: /var/spool/postfix/private/proxymap socket: wanted attribute: status
postmap: input attribute name: status
postmap: input attribute value: 2
postmap: /var/spool/postfix/private/proxymap socket: wanted attribute: value
postmap: input attribute name: value
postmap: input attribute value: (end)
postmap: /var/spool/postfix/private/proxymap socket: wanted attribute: (list terminator)
postmap: input attribute name: (end)
postmap: dict_proxy_lookup: table=pgsql:/usr/local/etc/postfix/pgsql-virtual-mailbox-domains.cf flags=warn_dup|lock|utf8_request key=example.org -> status=2 result=
postmap: fatal: table proxy:pgsql:/usr/local/etc/postfix/pgsql-virtual-mailbox-domains.cf: query error: Application error
I'm completely stumped. Can anyone shed some light on what's going on? I get the same query error/application error irrespective of which domain I try to query. Help!