1

My goal is to get a mailserver that is capable of sending and receiving emails from several different domains. Therefore I want to use virtual users.

I followed this manual step by step: https://www.digitalocean.com/community/tutorials/how-to-configure-a-mail-server-using-postfix-dovecot-mysql-and-spamassassin.

Afterwards I tried to connect to the mailserver by using port 993, a user from the database and the password. I was not able to troubleshoot this issue by myself.

telnet localhost 993 and telnet domain 993 is possible. 'login user password' is not possible. 'doveadm user email1@example.com' responses a good answer.

My configuration file:

# OS: Linux 3.13.0-62-generic x86_64 Ubuntu 14.04.3 LTS ext4
auth_mechanisms = plain login
login_greeting = Hello.
mail_location = maildir:/var/mail/vhosts/%d/%n
mail_privileged_group = mail
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 = 
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocols = imap lmtp
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    mode = 0600
    user = vmail
  }
  user = dovecot
}
service imap-login {
  inet_listener imap {
    port = 0
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
ssl_cert = </etc/dovecot/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.pem
userdb {
  args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
  driver = static
}

/var/log/mail.log

Aug 31 18:41:05 abc dovecot: imap-login: Disconnected (no auth attempts in 0 secs): user=<>, rip=178.25.11.19, lip=5.45.99.46, TLS handshaking: Disconnected, session=<iS6LGZ4edACyGQsT>
  • Log message for the failed login? Enable debug logging? – sebix Aug 31 '15 at 19:22
  • Further debugging revealed a mistake in the query to get the users password. In password_query = SELECT email as user, password FROM virtual_users WHERE email='%u'; the field email in the where-clausel becomes 'user1'. But I need it to be 'user1@domain.com' instead. How do I achieve that? I have no idea. Thought the %u inserts a user@domain format. – user1255102 Aug 31 '15 at 21:16
  • Use %u@%d. See the documentation on mysql_table – sebix Sep 1 '15 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.