SASL SMTP authentication

Discussion in 'Server Operation' started by frosig, Dec 15, 2008.

  1. frosig

    frosig New Member

    Hi,

    I have once upon a time followed 'Virtual Users And Domains With Postfix, Courier And MySQL' for Fedora 8, but now I need to use my server to send emails. Unfortunately I am rejected, when I try to log on to the server. Postfix gives me this error:

    Code:
    Dec 15 23:16:10 bilbo postfix/smtpd[16945]: warning: unknown[192.168.0.101]: SASL LOGIN authentication failed: authentication failure
    
    and when I look for the sasl log, I get this:

    Code:
    Dec 15 23:16:58 bilbo saslauthd[14420]: do_auth         : auth failure: [user=xxx] [service=smtp] [realm=xxx.xxx] [mech=pam] [reason=PAM auth error]
    I have tried to take a look at my log file from mysql, but it does not contain any SQL requests regarding this (or any error), so it seems that saslauthd does not check the login information against my server.

    I have double checked the different confoguration files and everything seems to be OK, but I might have missed something. Where should I begin to look?

    Thanks,

    Rasmus
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/pam.d/smtp?
     
  3. frosig

    frosig New Member

    Code:
    #%PAM-2.0
    auth       include      system-auth
    account    include      system-auth
     
  4. falko

    falko Super Moderator Howtoforge Staff

    What's in /usr/lib/sasl2/smtpd.conf? What's the output of
    Code:
    uname -a
    ?
    Did you disable SELinux?
     
  5. frosig

    frosig New Member

    My smtpd.conf looks like this
    Code:
    pwcheck_method: authdaemond
    log_level: 3
    mech_list: PLAIN LOGIN
    authdaemond_path:/var/spool/authdaemon/socket
    
    and the output from uname -a is
    Code:
    Linux bilbo.froesig.dk 2.6.23.1-49.fc8 #1 SMP Thu Nov 8 22:14:09 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
    
    I have also found this in my log, if it helps
    Code:
    Dec 17 19:23:38 bilbo saslauthd[24125]: pam_unix(smtp:auth): check pass; user unknown
    Dec 17 19:23:38 bilbo saslauthd[24125]: pam_unix(smtp:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=
    Dec 17 19:23:38 bilbo saslauthd[24125]: pam_succeed_if(smtp:auth): error retrieving information about user rasmus
    
    It seems that my domain is not appended to my username, which could explain why it does not work.

    Rasmus
     
  6. frosig

    frosig New Member

    Google has helped me to find a solution to the problem. I have told saslauthd to also include my domain when trying to authenticate by running the service with a -r option.

    I still had the problem that pam did not try to look up the users in my database, but I also found a solution to that problem. /etc/pam.d/smtp now looks like this
    Code:
    #%PAM-2.0
    #auth       include      system-auth
    #account    include      system-auth
    auth required pam_mysql.so user=XXX passwd=XXX db=mail table=users usercolumn=email passwdcolumn=password crypt=1 md5=1
    account sufficient pam_mysql.so user=XXX passwd=XXX db=mail table=users usercolumn=email passwdcolumn=password crypt=1 md5=1
    
    Thanks a lot for your help. It brought me closer to the above solution.

    Rasmus
     
  7. falko

    falko Super Moderator Howtoforge Staff

    You're on an x86_64 system, so instead of /usr/lib/sasl2/smtpd.conf you must modify /usr/lib64/sasl2/smtpd.conf.
     

Share This Page