New Setup help: Postfix/mysql can't find users.
-
Hi Everyone,
I’m using Ubuntu 20.04 with the built in packages and I think I almost have everything working. After spending a few days setting up & reading the docs (and fixing some apparmor profile issues), the last piece I’m missing is postfix can’t seem to look up users. Im using the DB plugin along with mysql/mariadb. I am testing with a single user “rob@po.<mydomain>” and postfix was also installed from packages.
Here is my config I’ve added to postfix:
virtual_transport = lmtp:unix:/var/spool/kopano/dagent.sock virtual_alias_maps = mysql:/etc/postfix/mysql-users.cf
user = kopano-server password = xxxxxxxxxxxxxxxxxxx hosts = 127.0.0.1 dbname = kopanoserver query = select value from objectproperty where objectid=(select objectid from objectproperty where value='%s' limit 1) and propname='loginname';
If I try to send a mail to rob@po.<mydomain> I get a bounce of no such user from postfix:
This is the mail system at host po.mydomain. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. For further assistance, please send mail to postmaster. If you do so, please include this problem report. You can delete your own text from the attached returned message. The mail system <rob@po.mydomain>: unknown user: "rob"
However if I run the query manually:
select objectid from objectproperty where value='rob@po.<mydomain>' limit 1;
I get:
“1” returned.
Then I runI get:
MariaDB [kopanoserver]> select value from objectproperty where objectid=1 and propname='loginname'; +-------+ | value | +-------+ | rob | +-------+ 1 row in set (0.001 sec)
is this the correct output? I’m sure I’m missing something simple but I can’t figure out why
-
@ishouldhavebeenaqatester
I think I have this solved!After reading more on postfix, the logs were showing local delivery, so I changed
virtual_transport = lmtp:127.0.0.1:2003
to
mailbox_transport = lmtp:127.0.0.1:2003
So you my ask next: Why not use:
mailbox_transport = lmtp:unix:/var/spool/kopano/dagent.sock
?
Note: I also had to change /etc/kopano/dagent.cfg to also run on 127.0.0.1:2003
When postfix runs chrooted, it won’t have access to the socket that runs non-chrooted, so 127.0.0.1:2003 is a safer bet.
I hope this can help someone.