Problems with Postfix/sasl

Discussion in 'Server Operation' started by cmp_, Jun 4, 2008.

  1. cmp_

    cmp_ New Member

    Hi all.
    Firstly sorry for my english. (I'm from Spain)
    I followed the tutorial : Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (Ubuntu 8.04 LTS) by falko. (http://www.howtoforge.com/virtual-users-domains-postfix-courier-mysql-squirrelmail-ubuntu8.04)
    Some comments first:
    - My SO is Ubuntu 7.10 (but I think that's no problem)
    - I skipped :
    9 Install amavisd-new, SpamAssassin, And ClamAV and​
    10 Install Razor, Pyzor And DCC And Configure SpamAssassin​
    11 Quota Exceedance Notifications​
    - My DB has different tables and fields names (buy this is not the problem. I have installed postfixadmin):
    Code:
    mysql> show tables;
    +-----------------------+
    | Tables_in_postfix     |
    +-----------------------+
    | admin                 | 
    | alias                 | 
    | config                | 
    | domain                | 
    | domain_admins         | 
    | domains               | 
    | fetchmail             | 
    | forwardings           | 
    | log                   | 
    | mailbox               | 
    | transport             | 
    | vacation              | 
    | vacation_notification | 
    +-----------------------+
    
    Code:
    mysql> select * from mailbox;
    +----------------------------+---------------+------------------------+-----------------------------+-------+-----------------+---------------------+---------------------+--------+
    | username                   | password      | name                   | maildir                     | quota | domain          | created             | modified            | active |
    +----------------------------+---------------+------------------------+-----------------------------+-------+-----------------+---------------------+---------------------+--------+
    | user1@mydomain.com         | c5tEtb1XoJaRg |    user 1              | user1@mydomain.com/         |     0 | mydomain.com    | 2008-05-28 11:06:21 | 2008-05-28 11:06:21 |      1 |


    The mail system appears to work fine but the "problem" is a message in /etc/log/auth.log :
    Code:
    Jun  3 18:13:42 Ub7 postfix/smtpd[18413]: sql_select option missing
    Jun  3 18:13:42 Ub7 postfix/smtpd[18413]: auxpropfunc error no mechanism available 
    Jun  3 18:13:42 Ub7 postfix/smtpd[18413]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sql 
    
    This messages appears every time I send an email or when I connect to localhost 25 via telnet (telnet localhost 25).

    I try to do this:
    Testing SASL authentication in the Postfix SMTP server (http://www.postfix.org/SASL_README.html)
    $ perl -MMIME::Base64 -e 'print encode_base64("\0'user1@mydomain.com'\0mypass");'
    AHVzZXIxLmNvbQBteXBhc3M=

    $ telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    220 mail.panell.org ESMTP Postfix (Ubuntu)
    ehlo client
    250-mail.panell.org
    250-PIPELINING
    250-SIZE 10240000
    250-VRFY
    250-ETRN
    250-STARTTLS
    250-AUTH CRAM-MD5 DIGEST-MD5 NTLM LOGIN PLAIN
    250-AUTH=CRAM-MD5 DIGEST-MD5 NTLM LOGIN PLAIN
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    AUTH PLAIN AHVzZXIxLmNvbQBteXBhc3M=
    535 5.7.0 Error: authentication failed: authentication failure
    quit
    221 2.0.0 Bye

    LOGS:
    /var/log/mail.log :
    Code:
    Jun  3 18:47:03 Ub7 postfix/smtpd[18667]: connect from localhost[127.0.0.1]
    Jun  3 18:47:54 Ub7 postfix/smtpd[18667]: warning: SASL authentication failure: Password verification failed
    Jun  3 18:47:54 Ub7 postfix/smtpd[18667]: warning: localhost[127.0.0.1]: SASL PLAIN authentication failed: authentication failure
    Jun  3 18:47:57 Ub7 postfix/smtpd[18667]: disconnect from localhost[127.0.0.1]
    
    /var/log/auth.log (If I send an email, the log is identical)
    Code:
    Jun  3 18:45:06 Ub7 postfix/smtpd[18667]: sql_select option missing
    Jun  3 18:45:06 Ub7 postfix/smtpd[18667]: auxpropfunc error no mechanism available 
    Jun  3 18:45:06 Ub7 postfix/smtpd[18667]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sql
    After many hours I have arrived at the conclusion that smtpd.conf is ignored. I can write anything inside and the "error" is the same.
    _________________
    Copy-paste important files:
    /etc/postfix/main.cf
    Code:
    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
    
    # 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:${queue_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${queue_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.
    
    myorigin = /etc/mailname
    myhostname = mail.panell.org
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    mydestination =
    relayhost = 
    mynetworks = all
    mailbox_command = procmail -a "$EXTENSION"
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    inet_protocols = all
    unknown_local_recipient_reject_code = 450
    
    # Virtual Mailbox Domain Settings
    virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
    virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
    virtual_mailbox_limit = 51200000
    virtual_minimum_uid = 5000
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    virtual_mailbox_base = /home/vmail
    virtual_transport = virtual
    
    # Additional for quota support
    virtual_create_maildirsize = yes
    virtual_mailbox_extended = yes
    virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = Sorry, the your maildir has overdrawn your diskspace quota, please free up some of spaces of your mailbox try again.
    virtual_overquota_bounce = yes
    
    virtual_alias_domains = 
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    #If I insert "check_policy_service inet" it doesn't work
    smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated,  reject_non_fqdn_recipient, reject_unauth_destination
    smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
    # Added:
    smtpd_sasl_path = /etc/postfix/sasl:/usr/lib/sasl2
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_local_domain =
    
    #smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    #transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    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
    /etc/pam.d/smtp
    Code:
    auth    required   pam_mysql.so user=postfix passwd=mypass host=127.0.0.1 db=postfix table=mailbox usercolumn=username passwdcolumn=password crypt=1
    account sufficient pam_mysql.so user=postfix passwd=mypass host=127.0.0.1 db=postfix table=mailbox usercolumn=username passwdcolumn=password crypt=1
    /etc/postfix/sasl/smtpd.conf and /var/spool/postfix/etc/postfix/sasl/smtpd.conf
    Code:
    pwcheck_method: saslauthd
    mech_list: plain login
    allow_plaintext: true
    auxprop_plugin: mysql
    sql_hostnames: 127.0.0.1
    sql_user: postfix
    sql_passwd: mypass
    sql_database: postfix
    sql_select: select password from mailbox where username='%u@%r' and active = 1
    /etc/courier/authmysqlrc
    Code:
    MYSQL_SERVER		localhost
    MYSQL_USERNAME		postfix
    MYSQL_PASSWORD		mypass
    
    MYSQL_PORT		0
    
    MYSQL_OPT		0
    
    MYSQL_DATABASE		postfix
    
    MYSQL_USER_TABLE	mailbox
    
    MYSQL_CRYPT_PWFIELD	password
    
    MYSQL_UID_FIELD		5000
    
    MYSQL_GID_FIELD		5000
    
    MYSQL_LOGIN_FIELD	username
    
    MYSQL_HOME_FIELD	"/home/vmail"
    
    MYSQL_NAME_FIELD	name
    
    MYSQL_MAILDIR_FIELD	maildir
    
    MYSQL_QUOTA_FIELD	concat(quota,'S')
    
    /etc/default/saslauth
    Code:
    START=yes
    
    MECHANISMS="pam"
    
    MECH_OPTIONS=""
    
    THREADS=5
    
    OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"
    I don't find the solution...
    Any suggestions?
    Thanks and sorry for my poor english
     
    Last edited: Jun 4, 2008
  2. kazimkaradas

    kazimkaradas New Member

    Hello,

    you should check if there is postfix-mysql if not install it.
     
  3. cmp_

    cmp_ New Member

    I have all the needed packets installed.
     
  4. falko

    falko Super Moderator ISPConfig Developer

  5. cmp_

    cmp_ New Member

    I've checked this thread and the other threads mentioned in this, but I can't find the solution.
    My configuration files seems to be correct. There are no errors in the /var/log/mail.* but the "errors" in /var/log/auth.log persists:
    Code:
    Jun  6 11:52:19 Ub7 postfix/smtpd[22886]: sql_select option missing
    Jun  6 11:52:19 Ub7 postfix/smtpd[22886]: auxpropfunc error no mechanism available 
    Jun  6 11:52:19 Ub7 postfix/smtpd[22886]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sql 
    
    The result of $postfix check:
    Code:
    postfix/postfix-script: warning: /var/spool/postfix/etc/postfix/sasl/smtpd.conf~ and /etc/postfix/sasl/smtpd.conf~ differ
    
    Is this warning relevant?

    I think that this messages doesn't affect to the mail server.

    Another question:
    I can use secure TLS and SSL connections. Can someone explain (or post a link) what is the difference between the two?

    I can't "use secure authentication", it's normal?

    Sorry again for my english. I would like to explain these better but I don't find the words.
     
  6. falko

    falko Super Moderator ISPConfig Developer

    What's in /etc/postfix/sasl/smtpd.conf and /var/spool/postfix/etc/postfix/sasl/smtpd.conf?
     
  7. cmp_

    cmp_ New Member

    But I've tried changing this file without effect.
    Thank you for any indication.
     
  8. falko

    falko Super Moderator ISPConfig Developer

    What's in /etc/pam.d/smtp?
     
  9. cmp_

    cmp_ New Member

    In the first post there are copy/paste of some important files.

    Thanks
     
  10. falko

    falko Super Moderator ISPConfig Developer

    Hm... What's in /etc/postfix/master.cf?
     
  11. cmp_

    cmp_ New Member

    cat /etc/postfix/master.cf :
    Code:
    #
    # Postfix master process configuration file.  For details on the format
    # of the file, see the master(5) manual page (command: "man 5 master").
    #
    # ==========================================================================
    # service type  private unpriv  chroot  wakeup  maxproc command + args
    #               (yes)   (yes)   (yes)   (never) (100)
    # ==========================================================================
    smtp      inet  n       -       -       -       -       smtpd
    #submission inet n       -       -       -       -       smtpd -v
    #  -o smtpd_enforce_tls=yes
    #  -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
    #628      inet  n       -       -       -       -       qmqpd
    pickup    fifo  n       -       -       60      1       pickup
    cleanup   unix  n       -       -       -       0       cleanup
    qmgr      fifo  n       -       n       300     1       qmgr
    #qmgr     fifo  n       -       -       300     1       oqmgr
    tlsmgr    unix  -       -       -       1000?   1       tlsmgr
    rewrite   unix  -       -       -       -       -       trivial-rewrite
    bounce    unix  -       -       -       -       0       bounce
    defer     unix  -       -       -       -       0       bounce
    trace     unix  -       -       -       -       0       bounce
    verify    unix  -       -       -       -       1       verify
    flush     unix  n       -       -       1000?   0       flush
    proxymap  unix  -       -       n       -       -       proxymap
    smtp      unix  -       -       -       -       -       smtp
    # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
    relay     unix  -       -       -       -       -       smtp
    	-o smtp_fallback_relay=
    #       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
    showq     unix  n       -       -       -       -       showq
    error     unix  -       -       -       -       -       error
    retry     unix  -       -       -       -       -       error
    discard   unix  -       -       -       -       -       discard
    local     unix  -       n       n       -       -       local
    virtual   unix  -       n       n       -       -       virtual
    lmtp      unix  -       -       -       -       -       lmtp
    anvil     unix  -       -       -       -       1       anvil
    scache	  unix	-	-	-	-	1	scache
    #
    # ====================================================================
    # Interfaces to non-Postfix software. Be sure to examine the manual
    # pages of the non-Postfix software to find out what options it wants.
    #
    # Many of the following services use the Postfix pipe(8) delivery
    # agent.  See the pipe(8) man page for information about ${recipient}
    # and other message envelope options.
    # ====================================================================
    #
    # maildrop. See the Postfix MAILDROP_README file for details.
    # Also specify in main.cf: maildrop_destination_recipient_limit=1
    #
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
    #
    # See the Postfix UUCP_README file for configuration details.
    #
    uucp      unix  -       n       n       -       -       pipe
      flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
    #
    # Other external delivery methods.
    #
    ifmail    unix  -       n       n       -       -       pipe
      flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
    bsmtp     unix  -       n       n       -       -       pipe
      flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
    scalemail-backend unix	-	n	n	-	2	pipe
      flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
    mailman   unix  -       n       n       -       -       pipe
      flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
      ${nexthop} ${user}
    Thanks
     
    Last edited: Jun 10, 2008
  12. cmp_

    cmp_ New Member

    no ideas ?
    Any help is welcome
     
  13. falko

    falko Super Moderator ISPConfig Developer

    I have no idea... :(
     
  14. cmp_

    cmp_ New Member

    Ok.Tthank you anyway

    I've been making some tests, and in main.cf if I delete the line:
    Code:
    smtpd_sasl_path = /etc/postfix/sasl:/usr/lib/sasl2
    The "error" messages disappear but appear this message:
    Code:
    Jun 17 18:46:02 Ub7 postfix/smtpd[23858]: sql auxprop plugin using mysql engine 
    
    But I'm not using auxprop...

    I'm confused, because if I write something like this:
    Code:
    smtpd_sasl_path = /invalid/path/
    The "error" messages appear again...

    Tanks for read this.
     
  15. cmp_

    cmp_ New Member

    Hi again.
    Ok, I think the problem is solved.

    In main.cf I change the smtpd_sasl_path:
    Code:
    smtpd_sasl_path = smtpd
    In the log appears:
    Code:
    Jun 17 18:46:02 Ub7 postfix/smtpd[23858]: sql auxprop plugin using mysql engine
    I don't understand why shows "auxprop" if I using "saslauthd"... but it works. XD

    Just a question:
    In the HowTo (http://www.howtoforge.com/virtual-users-domains-postfix-courier-mysql-squirrelmail-ubuntu8.04-p2) says:

    But I have noticed that only "pwcheck_method" and "mech_list" are used. The other parameters can be modified or deleted without consequences.
    Why?

    Thanks!
     

Share This Page