Поднял локальный почтовый сервер dovecot+postfix+postfixadmin почта между клиентами ходит. Через почтовые клиенты типа Outlook и Thunderbird все ок и через IMAP и через POP3. Вот с roundcube засада полная, не хочет авторизировать клиента хоть тресни. Может кто подскажет как победить проблему.
П.С. Отключил использование ssl сертификатов roundcube загрузился без проблем, вопрос в том как заставить его с ним подключаться к dovecot'у.
dovecot.conf
# Мы не используем специализированные файлы из поставки Dovecot из папки /etc/dovecot/conf.d/.
# Основная причина: отсутствие ясного руководства по их использованию. А также сравнительно небольшой
# размер всего конфига (все перед глазами, нет необходимости раскидывать по отдельным файлам).
#!include conf.d/*.conf
# Нет необходимости явно указывать imaps и pop3s - Dovecot 2.* по-умолчанию их включает.
protocols = imap pop3
listen = *
# Завершать все дочерние процессы, если завершен мастер-процесс
shutdown_clients = yes
# Владелец почтовых папок (также см. конфиг Postfix):
mail_uid = vmail
mail_gid = vmail
# Только наш пользователь с uid и gid 5000 (vmail) может быть использован.
first_valid_uid = 5000
last_valid_uid = 5000
# Лог-файлы. Подробнее: http://wiki2.dovecot.org/Logging
log_path = /var/log/dovecot.log
# Отладка. Если все настроено, отключаем (no)
# http://maint.unona.ru/doc/dovecot2.shtml
mail_debug = yes
auth_verbose = yes
auth_debug = yes
auth_debug_passwords = yes
# SSL
# http://wiki2.dovecot.org/SSL/DovecotConfiguration
ssl = required
#ssl_cert = </etc/pki/dovecot/certs/server.crt
#ssl_key = </etc/pki/dovecot/private/server.key
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
ssl_protocols = TLSv1 TLSv1.1 TLSv1.2 !SSLv2 !SSLv3
ssl_cipher_list = ALL:!LOW:!SSLv2:!EXP:!aNULL
# Запрет аутентификации открытым текстом. yes - запретить, no - разрешить.
disable_plaintext_auth = no
# Список разрешенных символов в имене пользователя.
auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@
# Расположение и формат файлов почты (%d - домен, %n - имя пользователя).
mail_location = maildir:/var/vmail/%d/%n
# Если при аутентификации не указан домен, то добавить этот (в данном примере - пустой)
auth_default_realm =
# Доступные варианты аутентификации (PLAIN, DIGEST-MD5, CRAM-MD5...).
# Для того, чтобы иметь меньше головной боли ставьте PLAIN
auth_mechanisms = PLAIN
# Приветственное сообщение
login_greeting = POP3/IMAP server ready.
# Одно из самых важных мест - предоставление сокетов для аутентификации пользователей.
# Если настроено неверно - ничего работать не будет!
service auth {
# http://maint.unona.ru/doc/dovecot2.shtml
# Указывает, что данный сокет будет использовать SMTP сервер для аутентификации.
# Указывается пользователь, группа и права доступа к сокету. В данном случае это postfix
# ("mail_owner = postfix" в файле /etc/postfix/main.cf).
unix_listener /var/spool/postfix/private/auth {
user = postfix
group = postfix
mode = 0660
}
unix_listener auth-master {
user = vmail
group = vmail
mode = 0660
}
unix_listener auth-userdb {
user = vmail
group = vmail
mode = 0660
}
}
# Запрос параметров виртуальных почтовых пользователей
# (логин, пароль, домен, активный/неактивный и др.)
userdb {
args = /etc/dovecot/dovecot-mysql.conf
driver = sql
}
passdb {
args = /etc/dovecot/dovecot-mysql.conf
driver = sql
}
# Plugins
protocol imap {
imap_client_workarounds = tb-extra-mailbox-sep
mail_plugins = autocreate
}
protocol pop3 {
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
pop3_uidl_format = %08Xu%08Xv
}
protocol lda {
# Куда будут перенаправлены недоставленные письма
postmaster_address = postmaster@localhost
auth_socket_path = /var/run/dovecot/auth-master
}
plugin {
auth_socket_path = /var/run/dovecot/auth-master
# Plugin: autocreate. Создаем и подписываемся на папки IMAP.
autocreate = INBOX
autocreate2 = Sent
autocreate3 = Trash
autocreate4 = Drafts
autocreate5 = Junk
autosubscribe = INBOX
autosubscribe2 = Sent
autosubscribe3 = Trash
autosubscribe4 = Drafts
autosubscribe5 = Junk
# Plugin: квоты. Пока отключим.
# http://wiki2.dovecot.org/Quota/Configuration
#quota = maildir:User quota
#quota_rule = *:storage=1GB
#quota_rule2 = Trash:storage=+10%% # 10% of 1GB = 100MB
#quota_rule3 = Junk:storage=+10%% # 10% of 1GB = 100MB
#quota_rule4 = Drafts:storage=+10%% # 10% of 1GB = 100MB
}
postfix maib.cf
### Config
### Common config
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
myhostname = centos6.virtual.local
mydomain = virtual.local
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, localhost.localdomain
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8, 10.10.0.0/24
#in_flow_delay = 1s
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
local_recipient_maps = $virtual_mailbox_maps, $virtual_alias_maps
home_mailbox = Maildir/
mail_spool_directory = /var/spool/mail
smtpd_banner = $myhostname ESMTP $mail_name
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
# The mail_owner parameter specifies the owner of the Postfix queue
# and of most Postfix daemon processes. Specify the name of a user
# account THAT DOES NOT SHARE ITS USER OR GROUP ID WITH OTHER ACCOUNTS
# AND THAT OWNS NO OTHER FILES OR PROCESSES ON THE SYSTEM. In
# particular, don't specify nobody or daemon. PLEASE USE A DEDICATED
# USER.
#
mail_owner = postfix
# setgid_group: The group for mail submission and queue management
# commands. This must be a group name with a numerical group ID that
# is not shared with other accounts, not even with the Postfix account.
#
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
virtual_transport = dovecot
dovecot_destination_recipient_limit=1
### Auth
smtpd_sasl_auth_enable=yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth # см. конфиг Dovecot
### Relay Domains:
#relay_domains = mysql:/etc/postfix/sql/mysql_relay_domains.cf
### Virtual Domains:
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains =
mysql:/etc/postfix/sql/virtual_mailbox_domains.cf
virtual_alias_maps =
mysql:/etc/postfix/sql/virtual_alias_maps.cf
virtual_mailbox_maps =
mysql:/etc/postfix/sql/virtual_mailbox_maps.cf
virtual_minimum_uid = 5000
#virtual_minimum_gid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
### Quotas
# Квоты пока не проверял
#virtual_create_maildirsize = yes
#virtual_mailbox_extended = yes
#virtual_mailbox_limit_maps = mysql:/etc/postfix/sql/mysql_virtual_mailbox_limit_maps.cf
#virtual_mailbox_limit_override = yes
#virtual_maildir_limit_message = "Sorry, the user's maildir has overdrawn his diskspace quota."
#virtual_overquota_bounce = yes
### Restrictions
smtpd_client_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unknown_reverse_client_hostname,
permit
smtpd_helo_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
reject_unknown_helo_hostname,
permit
smtpd_sender_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_sender,
reject_unknown_sender_domain,
reject
smtpd_recipient_restrictions =
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
permit_sasl_authenticated,
reject_unlisted_recipient,
permit_mynetworks,
reject_unauth_destination,
reject
smtpd_data_restrictions =
permit_mynetworks,
reject_unauth_pipelining,
reject_multi_recipient_bounce,
permit
smtpd_etrn_restrictions = reject
smtpd_helo_required = yes
#strict_rfc821_envelopes = yes
smtpd_discard_ehlo_keywords = etrn, silent-discard
smtpd_forbidden_commands = CONNECT GET POST
disable_vrfy_command = yes
### TLS
smtpd_use_tls = yes
#smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
#smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
smtpd_tls_cert_file = /etc/ssl/certs/postfix.pem
smtpd_tls_key_file = /etc/ssl/private/postfix.pem
smtp_tls_security_level=may
smtpd_tls_mandatory_protocols=TLSv1, TLSv1.1, TLSv1.2, !SSLv2, !SSLv3
smtpd_tls_auth_only = yes
smtp_tls_loglevel = 1
smtpd_tls_loglevel = 1
roundcube config.inc.php
<?php
/* Local configuration for Roundcube Webmail */
// ----------------------------------
// SQL DATABASE
// ----------------------------------
// Database connection string (DSN) for read+write operations
// Format (compatible with PEAR MDB2): db_provider://user:password@host/database
// Currently supported db_providers: mysql, pgsql, sqlite, mssql or sqlsrv
// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
// NOTE: for SQLite use absolute path: 'sqlite:////full/path/to/sqlite.db?mode=0646'
$config['db_dsnw'] = 'mysql://roundcube:password1@localhost/roundcube';
// ----------------------------------
// IMAP
// ----------------------------------
// The mail host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
// WARNING: After hostname change update of mail_host column in users table is
// required to match old user data records with the new host.
$config['default_host'] = 'ssl://localhost';
$config['default_port'] = 993;
$config['imap_auth_type'] = PLAIN;
// TCP port used for IMAP connections
// ----------------------------------
// SMTP
// ----------------------------------
// SMTP server host (for sending mails).
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// If left blank, the PHP mail() function is used
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
$config['smtp_server'] = 'localhost';
// provide an URL where a user can get support for this Roundcube installation
// PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
$config['support_url'] = '';
// this key is used to encrypt the users imap password which is stored
// in the session record (and the client cookie if remember password is enabled).
// please provide a string of exactly 24 chars.
$config['des_key'] = '301c742212dab133ed1eafdd';
// ----------------------------------
// PLUGINS
// ----------------------------------
// List of active plugins (in plugins/ directory)
$config['plugins'] = array();
$config['auto_create_user'] = TRUE;
dovecot-mysql.conf
driver = mysql
connect = host=localhost dbname=mail user=postfix password=postfixPassword
default_pass_scheme = CRAM-MD5
password_query = SELECT username AS user,domain,password FROM mailbox WHERE username = '%u' AND active='1'
user_query = SELECT username AS user, '5000' AS uid, '5000' AS gid FROM mailbox WHERE username = '%u' AND domain = '%d' AND active='1'
Вот что в логах при авторизации:
dovecot.log
Jul 05 23:02:05 auth: Debug: auth client connected (pid=7063)
Jul 05 23:02:05 imap-login: Info: Disconnected (no auth attempts in 0 secs): user=<>, rip=127.0.0.1, lip=127.0.0.1, TLS handshaking, session=<Ca1qQyYafgB/AAAB>
roundcube errors
[05-Jul-2015 23:02:05 +0300]: <6l43jts4> IMAP Error: Login failed for ivanov@test.ru from 10.10.0.90. Could not connect to ssl://localhost:993: Unknown reason in /var/www/html/roundcube/program/lib/Roundcube/rcube_imap.php on line 198 (POST /roundcube/?_task=login?_task=login&_action=login)