LinuxForum.Fans
Тема

Не приходит почта postfix + dovecot + sasl + mysql

Автор: kom-pik 9 сообщений 3246 просмотров
#252467

Перенастраивал Postfix и столкнулся с проблемой что почта на приходит на почтовый клиент.
/etc/postfix/main.cf

text
smtpd_banner = $myhostname Welcome to the Sendmail server 
biff = no
smtpd_tls_auth_only = no
append_dot_mydomain = no
readme_directory = no
# TLS parameters
#smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
#smtpd_use_tls=yes
#smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
mydomain = ins-c.ru
myhostname = mailer.ins-c.ru
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = maildir/
virtual_mailbox_base = /home/vmail 
myorigin = $myhostname 
mydestination = $myhostname, localhost.$myhostname, localhost
relay_domains = no 
mynetworks = 127.0.0.0/8 192.168.100.0 85.30.252.213  95.84.240.35
mailbox_command = procmail -a "$EXTENSION"
recipient_delimiter = +
inet_interfaces = all
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
mailbox_size_limit = 10000000
message_size_limit = 20000000 
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_application_name = smtpd 
smtpd_recipient_restrictions = permit_mynetworks,
    permit_sasl_authenticated,
    reject_unauth_destination

/etc/postfix/master.cf

text
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd
#submission inet n       -       -       -       -       smtpd
#  -o smtpd_tls_security_level=encrypt
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       -       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#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
proxywrite unix -       -       n       -       1       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}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# 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}
#submission inet n       -       n       -       -       smtpd
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o cleanup_service_name=sasl_cleanup
#sasl_cleanup   unix  n       -       n       -       0       cleanup
#  -o header_checks=regexp:/etc/postfix/sub_header
dovecot unix    -    n    n    -    -    pipe
    flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}

/etc/dovecot/dovecot.conf

text
#base_dir = /var/run/dovecot 
protocols = imap imaps pop3 pop3s 
disable_plaintext_auth = no 
shutdown_clients = yes 
log_path = /var/log/dovecot 
info_log_path = /var/log/dovecot.info 
log_timestamp = "%Y-%m-%d %H:%M:%S " 
#ssl_disable = yes 
login_dir = /var/run/dovecot/login 
login_chroot = yes 
login_user = dovecot 
login_greeting = Dovecot ready. 
mail_location = maildir:/home/vmail/%d/%n 
mmap_disable = no 
valid_chroot_dirs = /var/spool/vmail 

protocol imap { login_executable = /usr/lib/dovecot/imap-login mail_executable = /usr/lib/dovecot/imap }

protocol pop3 { login_executable = /usr/lib/dovecot/pop3-login mail_executable = /usr/lib/dovecot/pop3 pop3_uidl_format = %08Xu%08Xv } auth_executable = /usr/lib/dovecot/dovecot-auth auth_verbose = yes

namespace private { separator = . prefix = INBOX. inbox = yes }

auth default { mechanisms = plain login

passdb sql { args = /etc/dovecot/dovecot-sql.conf }

#passdb passwd-file { #args = /etc/dovecot/passwd #}

userdb static { args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes } #userdb passwd-file { #args = /etc/dovecot/users #} user = root

socket listen {

master { path = /var/run/dovecot/auth-master mode = 0660 user = vmail }

client { path = /var/spool/postfix/private/auth mode = 0660 user = postfix group = postfix } } }

В логах

text
May 18 10:55:03 mail postfix/smtpd[12321]: connect from unknown[111.118.57.32]
May 18 10:55:28 mail postfix/smtpd[12321]: D62362B40AFA: client=unknown[111.118.57.32]
May 18 10:55:31 mail postfix/cleanup[12326]: D62362B40AFA: message-id=<3695778588.FVK873F1727603@ruldhlx.wdamaditebc.com>
May 18 10:55:31 mail postfix/qmgr[10714]: D62362B40AFA: from=<comfortsa8@gmail.com>, size=2008, nrcpt=1 (queue active)
May 18 10:55:32 mail postfix/pipe[12327]: D62362B40AFA: to=<hr@ins-c.ru>, relay=dovecot, delay=3.2, delays=3.1/0/0/0.12, dsn=4.3.0, status=deferred (temporary failure. Command output: Can't open log file /var/log/dovecot: Permission denied )
May 18 10:55:34 mail postfix/smtpd[12321]: disconnect from unknown[111.118.57.32]
May 18 10:58:02 mail postfix/qmgr[10714]: 5617A2B40AD1: from=<03GII@yandex.ru>, size=698, nrcpt=1 (queue active)
May 18 10:58:02 mail postfix/pipe[12486]: 5617A2B40AD1: to=<hr@ins-c.ru>, relay=dovecot, delay=21420, delays=21419/0.01/0/0.55, dsn=4.3.0, status=deferred (temporary failure. Command output: Can't open log file /var/log/dovecot: Permission denied )
May 18 10:58:54 mail postfix/anvil[12323]: statistics: max connection rate 1/60s for (smtp:111.118.57.32) at May 18 10:55:03
May 18 10:58:54 mail postfix/anvil[12323]: statistics: max connection count 1 for (smtp:111.118.57.32) at May 18 10:55:03
May 18 10:58:54 mail postfix/anvil[12323]: statistics: max cache size 1 at May 18 10:55:03
May 18 10:59:48 mail postfix/smtpd[12489]: connect from unknown[2.186.71.147]
May 18 10:59:48 mail postfix/smtpd[12489]: 7E4CE2B40AFC: client=unknown[2.186.71.147]
May 18 10:59:48 mail postfix/cleanup[12493]: 7E4CE2B40AFC: message-id=<20120518113009.LjNPzTdGCuoY@br6.mail.ru>
May 18 10:59:49 mail postfix/qmgr[10714]: 7E4CE2B40AFC: from=<gizyD@mail.ru>, size=560, nrcpt=1 (queue active)
May 18 10:59:49 mail postfix/pipe[12494]: 7E4CE2B40AFC: to=<hr@ins-c.ru>, relay=dovecot, delay=1.3, delays=1.2/0/0/0.1, dsn=4.3.0, status=deferred (temporary failure. Command output: Can't open log file /var/log/dovecot: Permission denied )
May 18 10:59:49 mail postfix/smtpd[12489]: disconnect from unknown[2.186.71.147]
text
2012-05-18 10:43:54 pop3-login: Info: Login: user=<test@ins-c.ru>, method=PLAIN, rip=188.32.123.28, lip=85.30.252.213
2012-05-18 10:43:54 POP3(test@ins-c.ru): Info: Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
2012-05-18 10:50:28 imap-login: Info: Login: user=<test@ins-c.ru>, method=PLAIN, rip=188.32.123.28, lip=85.30.252.213
2012-05-18 10:54:08 pop3-login: Info: Login: user=<test@ins-c.ru>, method=PLAIN, rip=188.32.123.28, lip=85.30.252.213
2012-05-18 10:54:08 POP3(test@ins-c.ru): Info: Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0

В чем может быть проблема?

#252753

Вот твоя ошибка:

text
Command output: Can't open log file /var/log/dovecot: Permission denied 

Попробуй сделать так:
chown -R dovecot:dovecot /var/log/dovecot

#252760

ошибка

text
status=deferred (temporary failure. Command output: Can't open log file /var/log/dovecot: Permission denied )

выставил права 777, пологаю что это не айс, что лучше выставить или так оставить?
в dovecot.conf добавил protocol lda и заменил параметр

text
mail_plugins = cmusieve на mail_plugins = sieve

и все заработало

#252761
text
chown -R dovecot:dovecot /var/log/dovecot

эта команда поможет?

#252764

Должна помочь.

#252765

kom-pik
Не ужели не нашли нормального мануала по этой теме.

#252766

там не не написано до таких мелочей, может плохо искал.
в общем из четырех манов собрал

#252767

Ka3aH6ac
Должна помочь.

спасибо, работает

Войдите или зарегистрируйтесь, чтобы ответить.