Hello, I followed this guide: http://www.howtoforge.com/virtual-users-domains-postfix-courier-mysql-squirrelmail-ubuntu8.10 Everything was great for quite some time. Unfortunately some packages were upgraded a month or so ago. We recently found that the forwards in the mysql db were no longer working. Is there a know thing that changed we can adjust to resolve?
You should start with sending an email to a forwarded mail address, and while doing that, tail the log files for any errors.
Unfortunately the log didn't reveal too much other than it can't find the user. May 17 10:57:26 AlbPostfix02 postfix/virtual[11702]: 21068128053: to=<[email protected]>, relay=virtual, delay=0.04, delays=0.02/0/0/0.02, dsn=5.1.1, status=bounced (unknown user: "[email protected]")
Well, at least you now know that postfix can't find the user .. next step is to check and see, where postfix would get the user data from, and if that user "test" is actually there. according to the how-to, it should be in the database "mail", table "forwardings". does postfix throw any error when you start it?
No errors when starting Postfix. Restarting has no errors. Here is what is in the mysql-virtual_forwardings.cf user = mail_admin password = SQL4maiL!3412 dbname = mail query = SELECT destination FROM forwardings WHERE source='%s' hosts = 127.0.0.1 All the user info is correct. I created a mysql query using the above, replacing the %s with the forward address, and it returns the destination without any issues. It seems the query it sends is not formed properly, or it does not send one. The normal mailboxes are functioning properly as well. I am trying to get logging on now to see if it submits the query.
Query goes through just as expected. Running the identical query returns the row properly. So that part is all working, but postfix still says the user does not exist and send the NDR. I am not sure where the processing goes after this to look next.
On the machine that runs postfix, try this: Code: mysql -h 127.0.0.1 -u mail_admin -p mail -e "SELECT destination FROM forwardings WHERE source='[email protected]'" enter your password and check if yo get output. (this way we query the db with the credentials postfix uses, to see if those are correct)
Looks good. root@AlbPostfix02:/home/dat# mysql -h 127.0.0.1 -u mail_admin -p mail -e "SELECT destination FROM forwardings WHERE source='[email protected]'" Enter password: +--------------------------+ | destination | +--------------------------+ | [email protected] | +--------------------------+
hmm strange, isn't there any other error in the postfix log, just above the Code: May 17 10:57:26 AlbPostfix02 postfix/virtual[11702]: 21068128053: to=<[email protected]>, relay=virtual, delay=0.04, delays=0.02/0/0/0.02, dsn=5.1.1, status=bounced (unknown user: "[email protected]") Line, maybe some error about not being able to use mysql or smth? because if this is the only error, postfix can't find the user, but can query the database (although, we ASSUME postfix can talk with mysql, we don't know for sure)
Nothing I see, but here is the stuff round it so you can have a look. Code: May 17 10:57:26 AlbPostfix02 postfix/smtpd[11699]: connect from quarantine.CompanyX.com[192.168.5.67] May 17 10:57:26 AlbPostfix02 postfix/smtpd[11699]: 21068128053: client=quarantine.CompanyX.com[192.168.5.67] May 17 10:57:26 AlbPostfix02 postfix/cleanup[11701]: 21068128053: message-id=<[email protected]> May 17 10:57:26 AlbPostfix02 postfix/qmgr[4786]: 21068128053: from=<[email protected]>, size=3555, nrcpt=1 (queue active) May 17 10:57:26 AlbPostfix02 postfix/smtpd[11699]: disconnect from quarantine.CompanyX.com[192.168.5.67] May 17 10:57:26 AlbPostfix02 postfix/smtpd[11546]: warning: 192.168.5.67: address not listed for hostname quarantine.CompanyX.com May 17 10:57:26 AlbPostfix02 postfix/smtpd[11546]: connect from unknown[192.168.5.67] May 17 10:57:26 AlbPostfix02 postfix/virtual[11702]: 21068128053: to=<[email protected]>, relay=virtual, delay=0.04, delays=0.02/0/0/0.02, dsn=5.1.1, status=bounced (unknown $ May 17 10:57:26 AlbPostfix02 postfix/cleanup[11548]: 2B48C128085: message-id=<[email protected]> May 17 10:57:26 AlbPostfix02 postfix/smtpd[11546]: 2DE61128088: client=unknown[192.168.5.67] May 17 10:57:26 AlbPostfix02 postfix/cleanup[11701]: 2DE61128088: message-id=<00c201caf5d1$44378660$cca69320$@net> May 17 10:57:26 AlbPostfix02 postfix/qmgr[4786]: 2B48C128085: from=<>, size=5439, nrcpt=1 (queue active) May 17 10:57:26 AlbPostfix02 postfix/bounce[11844]: 21068128053: sender non-delivery notification: 2B48C128085 May 17 10:57:26 AlbPostfix02 postfix/qmgr[4786]: 2DE61128088: from=<[email protected]>, size=183360, nrcpt=1 (queue active) May 17 10:57:26 AlbPostfix02 postfix/qmgr[4786]: 21068128053: removed May 17 10:57:26 AlbPostfix02 postfix/smtpd[11546]: disconnect from unknown[192.168.5.67] May 17 10:57:26 AlbPostfix02 postfix/virtual[11702]: 2DE61128088: to=<[email protected]>, relay=virtual, delay=0.07, delays=0.04/0/0/0.03, dsn=2.0.0, status=sent (delivered to m$ May 17 10:57:26 AlbPostfix02 postfix/qmgr[4786]: 2DE61128088: removed May 17 10:57:27 AlbPostfix02 postfix/smtp[11796]: 2B48C128085: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[209.85.221.38]:25, delay=1.6, delays=0.05/0/0.2$ May 17 10:57:27 AlbPostfix02 postfix/qmgr[4786]: 2B48C128085: removed Let me know if you see anything there. Postfix can communicate as everything else works. Here are a few of the other configs: mysql-virtual_mailboxes.cf user = mail_admin password = SQL4maiL!3412 dbname = mail query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM users WHERE email='%s' hosts = 127.0.0.1 mysql-virtual_domains.cf user = mail_admin password = SQL4maiL!3412 dbname = mail query = SELECT domain AS virtual FROM domains WHERE domain='%s' hosts = 127.0.0.1 I thought this went without saying, but I should mention as well that the passwords posted here are in no way real. Apparently someone thinks we would be posting them on the web. Thanks anyway for the warning.
Using the setup for 9.10 I have the same problem. If I setup [email protected] (no user set up) to [email protected] in forwardings, the mail is bounced no such user. If [email protected] is an existing user, the mail is delivered to the mailbox for [email protected]. The first mail to iggy will even create the iggy mailbox.
I've ran out of idea's .. for me to have any other idea's i'd have to take a look at your server and see what's going on. Only thing i can think about is running through to How-To again and double check everything.
I made a slight mistake, it was on a 9.04 server that forwarding doesn't work. I just moved a domain onto a 9.10 server I built a few weeks back and tested it. Forwarding does work on that one. I will have to find the time to go thru the config line by line.....
I too am not sure where to even look next. Have been away on holiday for the last 11 days. I thought perhaps fresh eyes may help, but so far nay. Anyone else able to help here? Falko perhaps?
I did double check the config files, and everything appears to be fine. Nothing in the config changed from when it worked, but packages were updated. For some reason it just isn't recognizing that the forward user exists. The SQL query goes through (we saw from monitoring) and returns the proper value for the forward (tested the exact query sent). I am wondering if perhaps the format changed slightly in how mysql is returning the values. If you run the query on a machine does it look like this- +--------------------------+ | destination | +--------------------------+ | [email protected] | +--------------------------+ Falco, Is there a config file you wanted to see to troubleshoot further?
Luckily I had taken a snapshot of the server before the packages were updated. I took a backup of the mysql data, reverted to the snapshot and then restored the mysql data. Everything looking good now. Thanks to everyone who helped. Moral of the story is don't let others run updates on your server. I was also wondering if anyone else has updated this HowTo to the latest LTS version?