SASL not working ""Virtual Users And Domains With Postfix, Courier, MySQL And Squirr"

Discussion in 'HOWTO-Related Questions' started by zeljko, Jun 4, 2010.

  1. zeljko

    zeljko New Member

    Hi all,

    I have setup mail server using this tutorial "Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (Ubuntu 9.10)" but when I set SMTP server in e-mail client to use secure authentication I got "Login to server failed." with those in /var/mail/mail.log :

    Jun 4 10:44:32 zm postfix/smtpd[20951]: warning: SASL authentication failure: no secret in database
    Jun 4 10:44:32 zm postfix/smtpd[20951]: warning: localhost.localdomain[]: SASL CRAM-MD5 authentication failed: authentication failure
    Jun 4 10:44:32 zm postfix/smtpd[20951]: warning: SASL authentication failure: no secret in database
    Jun 4 10:44:32 zm postfix/smtpd[20951]: warning: localhost.localdomain[]: SASL NTLM authentication failed: authentication failure
    Jun 4 10:44:35 zm postfix/smtpd[20951]: disconnect from localhost.localdomain[]

    Please can you help me out with this ?

  2. Mark_NL

    Mark_NL New Member

    is your smtpd running chrooted?

    cat /etc/postfix/sasl/smtpd.conf
    grep smtpd /etc/postfix/
    cat /etc/postfix/
  3. zeljko

    zeljko New Member

    Those are the outputs :

    pwcheck_method: saslauthd
    mech_list: plain login
    allow_plaintext: true
    auxprop_plugin: mysql
    sql_user: *******
    sql_passwd: *******
    sql_database: mail
    sql_select: select password from users where email = '%u'
    smtp inet n - - - - smtpd
    #submission inet n - - - - smtpd
    # -o smtpd_tls_security_level=encrypt
    # -o smtpd_sasl_auth_enable=yes
    # -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    #smtps inet n - - - - smtpd
    # -o smtpd_tls_wrappermode=yes
    # -o smtpd_sasl_auth_enable=yes
    # -o smtpd_client_restrictions=permit_sasl_authenticated,reject inet n - - - - smtpd
    -o smtpd_restriction_classes=
    -o smtpd_client_restrictions=
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_bind_address=
    # See /usr/share/postfix/ for a commented, more complete version

    # Debian specific: Specifying a file name will cause the first
    # line of that file to be used as the name. The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname

    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no

    # appending .domain is the MUA's job.
    append_dot_mydomain = no

    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h

    readme_directory = /usr/share/doc/postfix

    # TLS parameters
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_use_tls = yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.

    myhostname =
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = localhost, localhost.localdomain
    relayhost =
    mynetworks =
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    html_directory = /usr/share/doc/postfix/html
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/, mysql:/etc/postfix/
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/
    virtual_mailbox_base = /home/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_path = /etc/postfix/sasl
    broken_sasl_auth_clients = yes
    smtpd_sasl_authenticated_header = yes
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    transport_maps = proxy:mysql:/etc/postfix/
    virtual_create_maildirsize = yes
    virtual_maildir_extended = yes
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = "The user you are trying to reach is over quota."
    virtual_overquota_bounce = yes
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    content_filter = amavis:[]:10024
    receive_override_options = no_address_mappings
  4. Mark_NL

    Mark_NL New Member

    and how does your /etc/default/saslauthd look like?

    cat /etc/default/saslauthd
  5. zeljko

    zeljko New Member

    # Settings for saslauthd daemon
    # Please read /usr/share/doc/sasl2-bin/README.Debian for details.

    # Should saslauthd run automatically on startup? (default: no)

    # Description of this saslauthd instance. Recommended.
    # (suggestion: SASL Authentication Daemon)
    DESC="SASL Authentication Daemon"

    # Short name of this saslauthd instance. Strongly recommended.
    # (suggestion: saslauthd)

    # Which authentication mechanisms should saslauthd use? (default: pam)
    # Available options in this Debian package:
    # getpwent -- use the getpwent() library function
    # kerberos5 -- use Kerberos 5
    # pam -- use PAM
    # rimap -- use a remote IMAP server
    # shadow -- use the local shadow password file
    # sasldb -- use the local sasldb database file
    # ldap -- use LDAP (configuration is in /etc/saslauthd.conf)
    # Only one option may be used at a time. See the saslauthd man page
    # for more information.
    # Example: MECHANISMS="pam"

    # Additional options for this mechanism. (default: none)
    # See the saslauthd man page for information about mech-specific options.

    # How many saslauthd processes should we run? (default: 5)
    # A value of 0 will fork a new process for each connection.

    # Other options (default: -c -m /var/run/saslauthd)
    # Note: You MUST specify the -m option or saslauthd won't run!
    # The -d option will cause saslauthd to run in the foreground instead of as
    # a daemon. This will PREVENT YOUR SYSTEM FROM BOOTING PROPERLY. If you wish
    # to run saslauthd in debug mode, please run it by hand to be safe.
    # See /usr/share/doc/sasl2-bin/README.Debian for Debian-specific information.
    # See the saslauthd man page and the output of 'saslauthd -h' for general
    # information about these options.
    # Example for postfix users: "-c -m /var/spool/postfix/var/run/saslauthd"
    OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"
  6. zeljko

    zeljko New Member


    Just to be clear what I am trying to do ... I am trying to make mail users who uses my SMTP server to authenticate them selfs when sending mail while using e-mail clients in my local network ( even from my server ), but for some reason this doesn't work ... I'm not an expert but it seems like SASL is not using mysql ( where users and passwords are stored ) to do authentication ...
  7. Mark_NL

    Mark_NL New Member

  8. zeljko

    zeljko New Member


    I did it dozen of times, but just in case did it once again now and it all looks exactly the same like in the tutorial ... I've googled everything but with no result :(
  9. Mark_NL

    Mark_NL New Member

    hehe, that sucks i know how you feel :)

    Only thing i can say about these how-to's .. if you read them from top to bottom and do EXACTLY what they say you should, then the solution works, period. If it's not working, you must've made an error somewhere in the process, changed a value, forgot a step or something.

    maybe some process is not running? maybe some persmissions aren't correct? maybe you missed a package that didn't got installed, i can go on and on like this ;)
  10. zeljko

    zeljko New Member

    Just find out that client side sasl authentication cannot work without smtp_sasl_password_maps parameter in And really I don't have that parameter there. Does anybody know how this parameter should be set to work with mysql virtual users?
  11. Mark_NL

    Mark_NL New Member

    i noticed that
    Code: inet n - - - - smtpd
    -o smtpd_restriction_classes=
    -o smtpd_client_restrictions=
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,rej ect
    -o smtpd_bind_address=
    "re ject" @ smtpd_recipient_restriction=... ???

    and i've compared my working configs with yours and also noticed that i haven't set this variable: smtpd_sasl_path = /etc/postfix/sasl

    /etc/pam.d/smtp contains
    auth    required user=mail_admin passwd=mail_admin_password host= db=mail table=users usercolumn=email passwdcolumn=password crypt=1
    account sufficient user=mail_admin passwd=mail_admin_password host= db=mail table=users usercolumn=email passwdcolumn=password crypt=1
    ?? check if you didn't mistakenly created a "smtpd" instead of "smtp" file :)


    and double check authmysqlrc
    Last edited: Jun 4, 2010
  12. zeljko

    zeljko New Member

    I have added that path parameter just to try if it helps, it's not working either ... and for re ject it must be copy/paste error, I have looked at now ant there is no space there ...
  13. Mark_NL

    Mark_NL New Member

    Well i'm kinda out of idea's .. and it's hard to go all options one by one ..
    i could have a look at your system, if you want, you can privmsg me with login data so i can have a look at your settings.
  14. zeljko

    zeljko New Member

    Dear Mark ,

    first of all thank you for all help! I don't know how and what I did ( I really don't know! ) but sasl seems to be working now in PLAIN and LOGIN when I set in thunderbird username for SMTP server, but when I check the "Use secure authentication" I got this from thunderbird:

    Sending of message failed.
    An error occurred sending mail: Unable to authenticate to SMTP server The server does not support any compatible secure authentication mechanism but you have chosen secure authentication. Try switching off secure authentication or contact your service provider.

    Do you know what "Use secure authentication" means?
    And is it secure enough to use STARTTLS and sasl PLAIN ?
  15. Mark_NL

    Mark_NL New Member

    spica:/etc/postfix# openssl s_client -connect -starttls smtp 
    depth=0 /C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/emailAddress=[email protected]
    verify error:num=18:self signed certificate
    verify return:1
    depth=0 /C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/emailAddress=[email protected]
    verify return:1
    Certificate chain
     0 s:/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/emailAddress=[email protected]
       i:/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/emailAddress=[email protected]
    Server certificate
    -----END CERTIFICATE-----
    subject=/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/emailAddress=[email protected]
    issuer=/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd/emailAddress=[email protected]
    No client certificate CA names sent
    SSL handshake has read 2023 bytes and written 351 bytes
    New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
    Server public key is 2048 bit
    Compression: NONE
    Expansion: NONE
        Protocol  : TLSv1
        Cipher    : DHE-RSA-AES256-SHA
        Session-ID: 25A6617F67E4A2ACC806A9DCF6D0EF68700D05C599308AFA197F92E09FBECF03
        Master-Key: B9D2C5FD0CFC6E6B742221093180936FDF08BE4DEC4FDAEA99C82ED7FB51FD5B12A47D3FF4A64C7645A3153C51692CE7
        Key-Arg   : None
        Start Time: 1275659460
        Timeout   : 300 (sec)
        Verify return code: 18 (self signed certificate)
    250 DSN
    EHLO mark
    250-SIZE 10240000
    250 DSN
    looks like TLS is working just fine, i think your client settings aren't correct.
    at least, i could make a TLS connection to your MTA .. i just didn't knew any mail accounts to send an email to ;)

Share This Page