postfix trying to use root to log onto mysql

Discussion in 'HOWTO-Related Questions' started by mattgrannary, Mar 12, 2012.

  1. mattgrannary

    mattgrannary New Member

    I've been trying to set up a mail server on a rackspace CentOS 6 cloud server for the past couple days. I've followed your tutorial to a tee with the exception that I didn't compile a new postfix with quota as I don't need a quota system.

    Everything seemed to install perfectly, I did have to install some extra packages that weren't listed. But everything seemed to go well.

    The issue I'm having is that I'm not able to send any mail (I haven't even tried receiving yet..). After looking at the maillog I can see that postfix gives me the error:

    postfix/cleanup[31896]: warning: connect to mysql server 127.0.0.1: Access denied for user 'root'@'localhost' (using password: YES)

    So, I'm guessing that postfix isn't using the .cf files I created with the proper user and password. I've triple checked all the files. The permissions are set properly, the vmail user is correct, mysql lets me log in with the mailadmin user and password, the aliases are set as you've listed, I can telnet to the smtp post and the pop3 port...

    Any ideas?
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Are you sure you use the correct username in your mysql*.cf files?
     
  3. mattgrannary

    mattgrannary New Member

    Yes.

    I've created a user called mailadmin and granted the proper privileges to the mail database. Just did a full check on the users privileges and logged in as that user and performed some basic SELECT queries and was successful.
     
  4. falko

    falko Super Moderator Howtoforge Staff

    The MySQL errors that you get in your mail log - are these current errors or old ones?
     
  5. mattgrannary

    mattgrannary New Member

    These are new ones. I've emptied the file and started fresh. The error is reported after I initiate a call to mailx. The log then is appended with these errors:

    Code:
    Mar 14 20:50:21 mgcloud postfix/pickup[24159]: 320547EA2C: uid=0 from=<root>
    Mar 14 20:50:21 mgcloud postfix/cleanup[24333]: 320547EA2C: message-id=<[email protected]>
    Mar 14 20:50:21 mgcloud postfix/qmgr[24160]: 320547EA2C: from=<[email protected]>, size=465, nrcpt=1 (queue active)
    Mar 14 20:50:22 mgcloud postfix/smtpd[24166]: 0ED037E9A3: client=unknown[127.0.0.1]
    Mar 14 20:50:22 mgcloud postfix/cleanup[24333]: warning: connect to mysql server 127.0.0.1: Access denied for user 'root'@'localhost' (using password: YES)
    Mar 14 20:50:22 mgcloud postfix/cleanup[24333]: warning: 0ED037E9A3: virtual_alias_maps map lookup problem for [email protected]
    Mar 14 20:50:22 mgcloud amavis[22713]: (22713-02) Negative SMTP response to data-dot (<[email protected]>): 451 4.3.0 Error: queue file write error
    Mar 14 20:50:22 mgcloud amavis[22713]: (22713-02) (!)FWD via SMTP: <[email protected]> -> <[email protected]>,BODY=7BIT 451 4.3.0 TempFailed, id=22713-02, from MTA([127.0.0.1]:10025): 451 4.3.0 Error: queue file write error
    Mar 14 20:50:22 mgcloud postfix/cleanup[24333]: warning: 109FF7E9A3: virtual_alias_maps map lookup problem for [email protected]
    Mar 14 20:50:22 mgcloud postfix/smtpd[24166]: disconnect from unknown[127.0.0.1]
    Mar 14 20:50:22 mgcloud amavis[22713]: (22713-02) Blocked MTA-BLOCKED, <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: h1+zXapomosw, Hits: -0.001, size: 465, 841 ms
    Mar 14 20:50:22 mgcloud postfix/smtp[24335]: 320547EA2C: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.89, delays=0.04/0.01/0/0.84, dsn=4.3.0, status=deferred (host 127.0.0.1[127.0.0.1] said: 451 4.3.0 TempFailed, id=22713-02, from MTA([127.0.0.1]:10025): 451 4.3.0 Error: queue file write error (in reply to end of DATA command))
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Did you disable SELinux?
     
  7. mattgrannary

    mattgrannary New Member

    I don't think so, I'm not even sure this was enabled. Is there a way to check?
     
  8. TiTex

    TiTex Member

    try one of these
    Code:
    getenforce
    sestatus
     
  9. mattgrannary

    mattgrannary New Member

    Ya, just tried that out and it says that it's disabled. Do I need to enable Selinux to use postfix, courier-imap with mysql?
     
  10. mattgrannary

    mattgrannary New Member

    ok, I just enabled Selinux and rebooted. I tried the mailx command again and this time postfix tried to log on as a different user (postfix)

    Here is the new error:

    Code:
    postfix/cleanup[1848]: warning: connect to mysql server 127.0.0.1: Access denied for user 'postfix'@'localhost' (using password: YES)
     
  11. mattgrannary

    mattgrannary New Member

    I decided to revisit the section about aliases and noticed that I had set the two recommended settings to something else when I was trying to figure out the original problem. I've re-edited the aliases file setting the mailer-daemon to postfix and the postmaster to root and root to my user. I ran newaliases and restarted postfix and now I'm seeing the original error where postfix is trying to log in to mysql with my root user....:mad:
     
  12. TiTex

    TiTex Member

    the only thing i can think of is that you messed up one of the /etc/postfix/mysql-* files
    you should double/triple check and see if in all your files you've setted up the correct mysql credentials/database
     
  13. TiTex

    TiTex Member

    by the way falko should update the howto , he forgot to add a package to the 3rd step , at least for me yum install cyrus-sasl-devel did not install cyrus-sasl-plain and i was getting an error
    Code:
    Mar 16 17:02:29 mail postfix/master[1943]: daemon started -- version 2.6.6, configuration /etc/postfix
    Mar 16 17:02:57 mail postfix/smtpd[1949]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
    Mar 16 17:02:57 mail postfix/smtpd[1949]: connect from localhost[127.0.0.1]
    Mar 16 17:02:57 mail postfix/smtpd[1949]: warning: xsasl_cyrus_server_get_mechanism_list: no applicable SASL mechanisms
    Mar 16 17:02:57 mail postfix/smtpd[1949]: fatal: no SASL authentication mechanisms
    Mar 16 17:02:58 mail postfix/master[1943]: warning: process /usr/libexec/postfix/smtpd pid 1949 exit status 1
    Mar 16 17:02:58 mail postfix/master[1943]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
    Mar 16 17:04:54 mail postfix/postfix-script[2010]: stopping the Postfix mail system
    
     
  14. falko

    falko Super Moderator Howtoforge Staff

    Thanks, will have to check. :) Maybe that package got already installed during the basic system installation. Fact is, the tutorial works for me.
     
  15. TiTex

    TiTex Member

    my mistake ... i allways use the minimal install iso as i did with the postfix testing instalation :)

    P.S. if your postfix server is on the same box as your MX record you should not add this in your database
    Code:
    INSERT INTO `transport` (`domain`, `transport`) VALUES ('example.com', 'smtp:mail.example.com');
    it will create a loop and mail that your are sending to the localdomain (domain hosted on the box) won't be sent and as a result using mailx to send a wellcome message and create the maildir for the user will not work and you'll get an error on the webmail login
    Code:
    ERROR:
    ERROR: Connection dropped by IMAP server.
    and maillog

    Code:
    Mar 20 09:11:54 server imapd: chdir example.lan/test/: No such file or directory
    Mar 20 09:11:54 server imapd: [email protected]: No such file or directory
     
    Last edited: Mar 20, 2012

Share This Page