Ошибка «Can't connect to local MySQL...» (Postfix+Dovecot)?

Всем привет,
Настраиваю Postfix, пользователи будут храниться в базе MySQL.
При проверке по telnet, на шаге

# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mail.site.ru ESMTP
HELO site.ru
250 mail.site.ru
MAIL FROM: site@site.ru

таймаут без ответа

в логах var/log/maillog, такая ошибка
Jan 19 18:07:54 site postfix/trivial-rewrite[21988]: fatal: mysql:/etc/postfix/sql/valias.cf(0,lock|fold_fix): table lookup problem
Jan 19 18:07:55 site postfix/smtpd[21791]: warning: problem talking to service rewrite: Success
Jan 19 18:07:55 site postfix/smtpd[21903]: warning: problem talking to service rewrite: Connection reset by peer
...
Jan 19 23:09:18 site postfix/master[21786]: warning: process /usr/libexec/postfix/smtpd pid 23034 exit status 1
Jan 19 23:09:18 site postfix/master[21786]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
Jan 19 23:10:00 site postfix/trivial-rewrite[26149]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Jan 19 23:10:00 site postfix/trivial-rewrite[26149]: fatal: mysql:/etc/postfix/sql/valias.cf(0,lock|fold_fix): table lookup problem
Jan 19 23:10:01 site postfix/master[21786]: warning: process /usr/libexec/postfix/trivial-rewrite pid 26149 exit status 1
Jan 19 23:10:01 site postfix/master[21786]: warning: /usr/libexec/postfix/trivial-rewrite: bad command startup -- throttling


Не могу понять в чем проблема

spoiler
soft_bounce = no
queue_directory = /var/spool/postfix
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
default_privs = nobody
inet_interfaces = all

myhostname = mail.site.ru 
mydomain = site.ru
myorigin = $mydomain

mydestination = $myhostname,localhost.$myhostname,localhost
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8
relay_domains =
#alias_maps = hash:/etc/aliases
#alias_database = hash:/etc/aliases
mail_spool_directory = /var/mail
smtpd_banner = $myhostname ESMTP

debug_peer_level = 2
debug_peer_list = 127.0.0.1
debugger_command = 
    PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
    xxgdb $daemon_directory/$process_name $process_id & sleep 5 
sendmail_path = /usr/sbin/sendmail
mailq_path = /usr/bin/mailq
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/local/man
config_directory = /etc/postfix

virtual_mailbox_domains = mysql:$config_directory/sql/vdomains.cf
virtual_mailbox_base = /var/vmail
virtual_mailbox_maps = mysql:$config_directory/sql/vmailbox.cf
virtual_alias_maps = mysql:$config_directory/sql/valias.cf
virtual_minimum_uid = 1150
virtual_uid_maps = static:1150
virtual_gid_maps = static:12
virtual_transport = dovecot

dovecot_destination_recipient_limit = 1

smtpd_sasl_auth_enable = yes
smtpd_sasl_exceptions_networks = $mynetworks
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = /var/spool/postfix/private/dovecot-auth

smtpd_use_tls = yes
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
smtpd_tls_key_file = /etc/postfix/certs/key.pem
smtpd_tls_cert_file = /etc/postfix/certs/cert.pem
tls_random_source = dev:/dev/urandom

smtpd_recipient_restrictions = permit_mynetworks,
    permit_sasl_authenticated,
    reject_unauth_destination,
    reject_non_fqdn_recipient,
    reject_invalid_hostname,
    reject_unknown_recipient_domain,
    reject_unknown_client,
    reject_unlisted_recipient,
    reject_unverified_recipient,
    reject_unauth_pipelining,
    reject_rbl_client cbl.abuseat.org,
    reject_rbl_client dialups.mail-abuse.org,
    reject_rbl_client bl.spamcop.net,
    reject_rbl_client zen.spamhaus.org,
    reject_rbl_client sbl-xbl.spamhaus.org,
    permit

smtpd_client_restrictions =
    reject_unauth_pipelining,
    permit_sasl_authenticated,
    permit_mynetworks,
    reject_unknown_client_hostname,
    permit
smtpd_helo_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_invalid_hostname,
    reject_invalid_helo_hostname,
    reject_unknown_hostname,
    reject_non_fqdn_helo_hostname,
    reject_unknown_helo_hostname,
    permit
smtpd_sender_restrictions =
    permit_sasl_authenticated,
    permit_mynetworks,
    reject_non_fqdn_sender,
    reject_authenticated_sender_login_mismatch,
    reject_unauthenticated_sender_login_mismatch,
    reject_unknown_sender_domain,
    permit_sasl_authenticated,
    reject_sender_login_mismatch
    permit

#ClamAV
content_filter = scan:127.0.0.1:10025
receive_override_options = no_address_mappings

#DKIM
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891

  • Вопрос задан
  • 1359 просмотров
Решения вопроса 2
Rsa97
@Rsa97
Для правильного вопроса надо знать половину ответа
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

MySQL на компьютере установлен? Запущен? В логах MySQL ошибок нет? Пользователь для postfix'а создан?
Ответ написан
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

Проверьте конфигурацию БД. Вполне вероятно, что подключение к ней осуществляется не через сокет, а через 127.0.0.1. Измените в соответствии с этим либо конфиг mySQL, либо конфиг Postfix/Dovecot.

Сейчас глянул, база пуста, т.е даже без таблиц, я так понял, для начала нужно создать таблицы, добваить туда почтовый ящик?

Конечно же, вы должны и базу пользователями не забыть наполнить. Если у вас postfixadmin, то вероятно будет достаточно лишь создать структуру БД.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы