dovecot userdb passwd-file default_fields uid が %variable を拡張しない

dovecot userdb passwd-file default_fields uid が %variable を拡張しない

私は非常にシンプルな共有メール サーバーをセットアップしようとしています。各「ドメイン」はシステム ユーザーです。つまり、「example.com」は /home/example.com/ を持つ実際のユーザーで、uid は 5001、「example.com」の gid は 5001 です。

各ドメイン\ユーザーには、ホーム内に独自の maildir と、そのドメインに関連付けられた仮想メール ユーザーを含む単純な passwd ファイルがあります。

Dovecot のバージョンと設定情報:

# dovecot -n
# 2.2.13: /etc/dovecot/dovecot.conf
# OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.8
auth_mechanisms = plain login
auth_verbose = yes
disable_plaintext_auth = no
mail_location = mbox:~/mail:INBOX=/var/mail/%u
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 = username_format=%n /home/%d/mail_users
  driver = passwd-file
}
protocols = " imap lmtp pop3"
ssl = no
userdb {
  args = username_format=%n /home/%d/mail_users
  default_fields = uid=%d gid=%d home=/home/%d/mail/%n mail=maildir:/home/%d/mail/%n
  driver = passwd-file
}

pop3\imapポートに接続しようとするたびに、サーバーで次のエラーが発生します。

dovecot: auth: Fatal: passwd-file userdb: Invalid uid: %d
dovecot: master: Error: service(auth): command startup failed, throttling for 2 secs
dovecot: imap-login: Disconnected: Auth process broken (disconnected before auth was ready, waited 0 secs): user=<>, rip=192.168.30.10, lip=192.168.20.201, session=<2rgGLBkQ/wDAqB4K>

クライアントには次のものが表示されます:

$ telnet 192.168.20.201 imap
Trying 192.168.20.201...
Connected to 192.168.20.201.
Escape character is '^]'.
* BYE Disconnected: Auth process broken
Connection closed by foreign host.

ウィキを確認する(http://wiki2.dovecot.org/UserDatabase#Userdb_settings) では、default_fields 値が %variables をサポートしていることが明確に述べられているため、これが機能するために必要な他の構成が不足しているかどうかはわかりません。

クライアントが USER\LOGIN コマンドを発行する前に発生するため、%d ドメイン部分を抽出するためのユーザー名がないため、失敗するのだと理解しています。クライアントが認証試行を発行する前に、なぜ Dovecot 認証試行が行われるのか理解できません。

設定を固定uid\gidに変更すると

default_fields = uid=example.com gid=example.com home=/home/%d/mail/%n mail=maildir:/home/%d/mail/%n

接続は許可され、適切な認証コマンドを発行できます。ただし、当然のことながら、example.com ドメイン以外のユーザーのメールボックスへのアクセスは失敗します。

関連情報