Postfix forwards in mysql db no longer work

Discussion in 'HOWTO-Related Questions' started by Moten, May 17, 2010.

  1. Moten

    Moten New Member

  2. Mark_NL

    Mark_NL New Member

    You should start with sending an email to a forwarded mail address, and while doing that, tail the log files for any errors.
     
  3. Moten

    Moten New Member

    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]")
     
  4. Mark_NL

    Mark_NL New Member

    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?
     
  5. Moten

    Moten New Member

    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.
     
  6. Moten

    Moten New Member

    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.
     
  7. Mark_NL

    Mark_NL New Member

    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 [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)
     
  8. Moten

    Moten New Member

    Looks good.


    [email protected]:/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] |
    +--------------------------+
     
  9. Mark_NL

    Mark_NL New Member

    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)
     
  10. Moten

    Moten New Member

    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=<[email protected]>
    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.
     
    Last edited: May 20, 2010
  11. herbie

    herbie New Member

    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.
     
  12. Mark_NL

    Mark_NL New Member

    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.
     
  13. herbie

    herbie New Member

    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.....
     
  14. Moten

    Moten New Member

    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?
     
  15. falko

    falko Super Moderator ISPConfig Developer

    Did you double-check all your configuration files?
     
  16. Moten

    Moten New Member

    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?
     
  17. falko

    falko Super Moderator ISPConfig Developer

    Ok, I think you need to rebuild Postfix as shown in the tutorial. Hopefully that fixes the problem.
     
  18. Moten

    Moten New Member

    Sounds like a plan. I'll be trying that tomorrow evening and will report back
     
  19. Moten

    Moten New Member

    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?
     
  20. falko

    falko Super Moderator ISPConfig Developer

    I've written one for 10.04 and will publish it soon. :)
     

Share This Page