Postfix dovecot mysql auth issues

Discussion in 'Server Operation' started by gabx, Sep 18, 2014.

  1. gabx

    gabx New Member

    Hi everybody,
    i have postfix dovecot mysql on my VPS for a mail provider project using roundcube as web interface .
    Postfix looks well connected with mysql ,all postmap queries returns "1" as result and the virtual_alias_map returns the alias expected. Tests from local are positive too:

    Code:
    :~$ echo test | mail [email protected]
    LOGS:
    Code:
    Sep 18 09:14:55 host postfix/pickup[27668]: BB5AE1BE: uid=1000 from=<admin>
    Sep 18 09:14:55 host postfix/cleanup[27695]: BB5AE1BE: message-id=<[email protected]>
    Sep 18 09:14:55 host postfix/qmgr[24851]: BB5AE1BE: from=<[email protected]>, size=417, nrcpt=1 (queue active)
    Sep 18 09:14:55 host dovecot: auth-worker(27705): mysql(127.0.0.1): Connected to database mailserver
    Sep 18 09:14:55 frozenstar dovecot: lda([email protected]): sieve: msgid=<[email protected]>: stored mail into mailbox 'INBOX'
    Sep 18 09:14:55 host postfix/pipe[27699]: BB5AE1BE: to=<[email protected]>, relay=dovecot, delay=0.06, delays=0.02/0/0/0.04, dsn=2.0.0, status=sent (delivered via dovecot service)
    Sep 18 09:14:55 host postfix/qmgr[24851]: BB5AE1BE: removed
    
    Connecting from abroad my VPS logs are:
    Code:
    Sep 18 09:15:45 host dovecot: auth-worker(27705): sql(admin,7.24.18.16): unknown user
    Sep 18 09:15:52 host dovecot: auth-worker(27705): sql(admin,7.24.18.16): unknown user
    Sep 18 09:15:58 host dovecot: auth-worker(27705): sql(admin,7.24.18.16): unknown user
    Sep 18 09:16:00 host dovecot: imap-login: Disconnected (auth failed, 3 attempts in 15 secs): user=<admin>, method=PLAIN, rip=7.24.18.16, lip=1.2.3.4, TLS, session=<WZjGwFED6QBN97Wi>
    That's how i have populated mailserver db in mysql:
    Code:
    
        INSERT INTO `mailserver`.`virtual_domains` (
          `id` ,
          `name`
        )
        VALUES (
          '1', 'mydomain'
        );
    
        INSERT INTO `mailserver`.`virtual_users` (
          `id` ,
          `domain_id` ,
          `password` ,
          `email`
        )
        VALUES (
          '1', '1', MD5( 'summersun' ) , [email protected]'
        );
    
        INSERT INTO `mailserver`.`virtual_aliases` (
          `id`,
          `domain_id`,
          `source`,
          `destination`
        )
        VALUES (
          '1', '1', [email protected]', [email protected]'
        );
    
    Another log issue is this:

    Code:
    Sep 18 09:48:34 host postfix/smtp[27758]: 7F2911B2: to=<[email protected]>, relay=none, delay=97720, delays=97720/0.02/0/0, dsn=4.4.4, status=deferred (unable to find primary relay for mail.mydomain)
    and at this stage this is my postconf -n output:
    Code:
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    append_dot_mydomain = no
    biff = no
    config_directory = /etc/postfix
    dovecot_destination_recipient_limit = 1
    inet_interfaces = all
    inet_protocols = all
    mailbox_size_limit = 0
    mydestination = localhost.localdomain, localhost
    mydomain = mydomain
    myhostname = mail.mydomain
    mynetworks = 1.2.3.4 ,127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    myorigin = $mydomain
    readme_directory = no
    recipient_delimiter = +
    relayhost =
    smtp_tls_cert_file = /etc/postfix/ssl/cert.pem
    smtp_tls_key_file = /etc/postfix/ssl/key.pem
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    smtp_use_tls = yes
    smtpd_banner = $myhostname ESMTP $mail_name
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, permit
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_path = private/auth
    smtpd_sasl_type = dovecot
    smtpd_tls_auth_only = yes
    smtpd_tls_cert_file = /etc/postfix/ssl/cert.pem
    smtpd_tls_key_file = /etc/postfix/ssl/key.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_security_level = may
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtpd_use_tls = yes
    tls_random_source = dev:/dev/urandom
    virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
    virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
    virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
    virtual_transport = dovecot
    and dovecot -n:
    Code:
    # 2.1.7: /etc/dovecot/dovecot.conf
    # OS: Linux 3.2.0-4-686-pae i686 Debian 7.6 ext3
    auth_debug_passwords = yes
    auth_mechanisms = plain login
    debug_log_path = /var/log/dovecot-debug.log
    listen = *
    login_greeting = Pop/Imap ready.
    mail_debug = yes
    mail_location = maildir:/var/vmail/%d/%n/Maildir
    managesieve_notify_capability = mailto
    managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
    namespace inbox {
      inbox = yes
      location = 
      mailbox Drafts {
        special_use = \Drafts
      }
      mailbox Junk {
        special_use = \Junk
      }
      mailbox Sent {
        special_use = \Sent
      }
      mailbox "Sent Messages" {
        special_use = \Sent
      }
      mailbox Trash {
        special_use = \Trash
      }
      prefix = 
      separator = 
    }
    passdb {
      args = /etc/dovecot/dovecot-sql.conf.ext
      driver = sql
    }
    plugin {
      sieve = ~/.dovecot.sieve
      sieve_dir = ~/sieve
      sieve_global_path = /var/vmail/globalsieverc
    }
    protocols = " imap sieve pop3"
    service auth {
      unix_listener /var/spool/postfix/private/auth {
        group = postfix
        mode = 0660
        user = postfix
      }
    }
    service imap-login {
      inet_listener imap {
        port = 143
      }
      inet_listener imaps {
        port = 993
        ssl = yes
      }
    }
    service pop3-login {
      inet_listener pop3 {
        port = 110
      }
      inet_listener pop3s {
        port = 995
        ssl = yes
      }
    }
    ssl_cert = </etc/dovecot/ssl/cert.pem
    ssl_key = </etc/dovecot/ssl/key.pem
    userdb {
      args = uid=vmail gid=vmail home=/var/vmail/%d/%n
      driver = static
    }
    protocol lda {
      mail_plugins = " sieve"
    }
    
    I will apprecciate any help ...
    Regards
     
  2. gabx

    gabx New Member

    i was using just the username 'admin' while trying to login opposite to what there is in virtual_users table which has [email protected] as username and i there isn't anymore that admin unknown user but:

    To login i use the user admin password has in /etc/passwd ,i wonder what password mysql might store in its database , or maybe permissions in:

    file which i made own to vmail but with same results.
     
    Last edited: Sep 18, 2014
  3. gabx

    gabx New Member

    Sorry for the debugging on devocot logs auth_debug_passwords=yes and auth_verbose_passwords=plain are activated:

     

Share This Page