I'm migrating my mail server from an older instance of postfix (3.2.0) to 3.3.0 on Ubuntu. I'm installing from apt and installation went fine. I'm in the process of trying to set up my MySQL connections, copying them from my old system to this one.
I'm running into a problem when I try to run postmap -q [email protected] mysql:aliases.cf
. The error I get is:
postmap: fatal: bad string length 0 < 1: aliases.cf_dbname =
The file in question (aliases.cf) is simple:
hosts = 127.0.0.1
user = postfix_user
password = hunter2
dbname = postfix_db
query = SELECT `destination`
FROM `mail_aliases`
WHERE
`alias_address` = '%u'
AND `domain` = '%d'
AND `active` = 1
I've done a couple of things to troubleshoot this:
- I've tried adding
options_file
andoptions_group
which didn't help. - Kept
options_file
andoptions_group
and removedhosts
,user
, and `password. Didn't work - Created a hash file (flat file) and that works
- Sent an email to an address in the database (via
sendmail
on the local box) but get this error:Sep 17 01:06:42 ec21234 postfix/cleanup[4230]: warning: mysql:/etc/postfix/virtual/aliases.cf lookup error for "[email protected]"
- Connecting to the database directly with username and password works perfectly.
I've done a bit of google searching and haven't been able to find anything useful. The closest I could find was this result which only loads when viewed with Google Cache.
It looks like the
mysql
argument forpostmap
wants a path. When I run the commandpostmap -q [email protected] mysql:./aliases.cf
, it works. Not sure where the path is relative to. I tried putting the config files in/
and that didn't work.The mail log is still showing that there was a lookup error. I could still use help there.