Dovecot V1 - Configure

最後更新: 2018-03-15

目錄

 


dovecot Version 1

 

dovecot <-- 本身係 main proccess 來

  • --version
  • --build-options
  • -a Dump configuration
  • -n Dump all non-default configuration items
  • -F Start dovecot as foreground process
  • -p Ask for private SSL key password

reload the configuration file: HUP signal

close and reopen the log files: USR1 signal

 

每次收 IMAP 收 mail  都會執行 script

在 protocol imap {}

mail_executable = /usr/bin/trackLastLogin.sh imap

==========================

mail_location

%u:   Full username.
%n:   User part in user@domain, same as %u if there's no domain.
%d:   Domain part in user@domain, empty if there's no domain.
%h:   home (相當於 ~/)
%%:  '%' character

Typically with Maildir it would be set to:

mail_location = maildir:~/Maildir

i.e.

mail_location = maildir:/var/vmail/%d/%u

Modifiers

%L - lowercase
%T - Trim trailing whitespace

i.e.

mail_location = maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/

詳見: http://wiki2.dovecot.org/Variables

==========================

Index files

Index files are by default stored under the same directory as mails.

設定 index 的位置

mail_location = maildir:~/Maildir:INDEX=/var/indexes/%u

Disable Index

:INDEX=MEMORY

==========================

Debug AND Log:

# Enables all kinds of mail related debug logging

mail_debug = yes

# Enables logging all failed authentication attempts.

auth_verbose=yes

它會 log 以下 daemon 的 info.

auth-worker <-SASL (unknown user, Password mismatch)
imap-login
pop3-login

# Enables all authentication debug logging, 包含 auth_verbose, Passwords are logged as <hidden>

auth_debug=yes

Oct 20 13:54:59 auth: Debug: client in: AUTH    1  PLAIN   service=imap  session=?  lip=??  rip=??   lport=143 rport=62058    resp=<hidden>

# 包含 auth_debug=yes, 而且 PW 不用 <hidden> 來表示

auth_debug_passwords=yes

.....   resp=?????????????

P.S.

base64 encode (NUL<email>NUL<PW>)

Log files and setting
log_timestamp = "%Y-%m-%d %H:%M:%S "
log_path = /var/log/dovecot.log
  • Dovecot log file is /var/log/dovecot.log    <--     log_path = /var/log/dovecot.log
  • Sieve log file is /var/log/sieve.log            <--     log_path = /var/log/sieve.log (在 protocol lda {} 設定)

注意 File 的 Permission:

chown dovecot.vmail dovecot.log

chmod 660 dovecot.log

==========================

Rotating Logs

dovecot:

/var/log/dovecot/dovecot*.log {
  missingok
  notifempty
  delaycompress
  sharedscripts
  postrotate
    /bin/kill -USR1 `cat /var/run/dovecot/master.pid 2>/dev/null` 2> /dev/null || true
  endscript
}

Troubleshoot

File permission 不對時, postfix 會有錯:

mailq

172AA18005A   163932 Mon Dec 29 11:35:06  x@x
(temporary failure. Command output: Can't open log file /var/log/dovecot.log: Permission denied)
                                         y@y

原因是 deliver 都有寫野入去:

/etc/postfix/master.cf

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}