web-dev-qa-db-ja.com

DovecotとPostgreSQLで認証が機能しない

Postfix、Dovecot、LMTP、PostgreSQLデータベースを使用して自分のメールサーバーをVPSに配置したいと思います。 mailコマンドを使用してVPSからメッセージを送信できません。つまり、交換用アカウントでこれらの電子メールを受信せず、バックアップアカウントからの電子メールの送信がエラーで終了します。

Undelivered Mail Returned to Sender

This is the mail system at Host mail.hubot.pl.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

The mail system

<[email protected]> (expanded from <[email protected]>): Host
mail.hubot.pl[private/dovecot-lmtp] said: 550 5.1.1 <[email protected]> User
doesn't exist: [email protected] (in reply to RCPT TO command)

私はすでにdovecotaとpostgresqlの構成ファイルpg_hba.confとpg_ident.confをさまざまな方法で編集し、それらを効果なしにDNSと組み合わせようとしました。

これはhubot.plの私のMXレコードです:

hubot@hubot-vps:~$ Sudo Dig MX hubot.pl +short @dns1.forpsicloud.cz
20 mail.hubot.pl.
hubot@hubot-vps:~$ Sudo Host mail.hubot.pl dns1.forpsicloud.cz
Using domain server:
Name: dns1.forpsicloud.cz
Address: 81.2.232.15#53
Aliases: 

mail.hubot.pl has address 81.2.239.96

ファイル/etc/dovecot/dovecot.conf:

hubot@hubot-vps:~$ Sudo cat /etc/dovecot/dovecot.conf
disable_plaintext_auth = no
mail_privileged_group = mail
mail_location = mbox:~/mail:INBOX=/var/mail/%u
userdb {
  driver = prefetch
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
protocols = imap lmtp
protocol imap {
  mail_plugins = " autocreate"
}
plugin {
  autocreate = Trash
  autocreate2 = Sent
  autosubscribe = Trash
  autosubscribe2 = Sent
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}
service lmtp {
    unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
    }
}
protocol lmtp {
    [email protected]
    hostname=mail.hubot.pl
}
ssl=required
ssl_cert = </etc/ssl/certs/mailcert.pem
ssl_key = </etc/ssl/private/mail.key

ファイル/etc/dovecot/dovecot-sql.conf:

hubot@hubot-vps:~$ Sudo cat /etc/dovecot/dovecot-sql.conf
driver = pgsql
connect = Host=/var/run/postgresql/ dbname=mail user=mailreader
default_pass_scheme = SHA512
password_query = SELECT email as user, password FROM users WHERE email = '%u'
user_query = SELECT email as user, 'maildir:/home/mailboxes/maildir/'||maildir as mail, '/home/mailboxes/home/'||maildir as home, 500 as uid, 500 as gid FROM users WHERE email = '%u'

ファイル/etc/postfix/main.cf:

hubot@hubot-vps:~$ Sudo cat /etc/postfix/main.cf
# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/mailcert.pem
smtpd_tls_key_file=/etc/ssl/private/mail.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

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.hubot.pl
alias_maps = hash:/etc/aliases proxy:pgsql:/etc/postfix/pgsql-aliases.cf

local_recipient_maps = proxy:pgsql:/etc/postfix/pgsql-boxes.cf $alias_maps
alias_database = hash:/etc/aliases
myorigin = hubot.pl
mydestination = hubot.pl, mail.hubot.pl, localhost, localhost.localdomain
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
mailbox_transport = lmtp:unix:private/dovecot-lmtp

ファイル/etc/postfix/pgsql-aliases.cf:

hubot@hubot-vps:~$ Sudo cat /etc/postfix/pgsql-aliases.cf 
user=mailreader
dbname=mail
table=aliases
select_field=alias
where_field=email
hosts=unix:/var/run/postgresql

ファイル/etc/postfix/pgsql-boxes.cf:

hubot@hubot-vps:~$ Sudo cat /etc/postfix/pgsql-boxes.cf 
user=mailreader
dbname=mail
table=users
select_field=email
where_field=email
hosts=unix:/var/run/postgresql/

ファイル/etc/postfix/master.cf:

hubot@hubot-vps:~$ Sudo cat /etc/postfix/master.cf 
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# 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
#smtp      inet  n       -       -       -       1       postscreen
#smtpd     pass  -       -       -       -       -       smtpd
#dnsblog   unix  -       -       -       -       0       dnsblog
#tlsproxy  unix  -       -       -       -       0       tlsproxy
submission inet n       -       -       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_wrappermode=no
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
  -o smtpd_sasl_type=dovecot
  -o smtpd_sasl_path=private/auth
#smtps     inet  n       -       -       -       -       smtpd
#  -o syslog_name=postfix/smtps
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
#  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       -       -       -       qmqpd
pickup    unix  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       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
relay     unix  -       -       -       -       -       smtp
#       -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}

ファイル/etc/postgresql/9.4/main/pg_hba.conf:

hubot@hubot-vps:~$ Sudo cat /etc/postgresql/9.4/main/pg_hba.conf 
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file.  A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access.  Records take one of these forms:
#
# local      DATABASE  USER  METHOD  [OPTIONS]
# Host       DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
# hostssl    DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
# hostnossl  DATABASE  USER  ADDRESS  METHOD  [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type: "local" is a Unix-domain
# socket, "Host" is either a plain or SSL-encrypted TCP/IP socket,
# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
# plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# database name, or a comma-separated list thereof. The "all"
# keyword does not match "replication". Access to replication
# must be enabled in a separate record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", or a
# comma-separated list thereof.  In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names
# from a separate file.
#
# ADDRESS specifies the set of hosts the record matches.  It can be a
# Host name, or it is made up of an IP address and a CIDR mask that is
# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
# specifies the number of significant bits in the mask.  A Host name
# that starts with a dot (.) matches a suffix of the actual Host name.
# Alternatively, you can write an IP address and netmask in separate
# columns to specify the set of hosts.  Instead of a CIDR-address, you
# can write "samehost" to match any of the server's own IP addresses,
# or "samenet" to match any address in any subnet that the server is
# directly connected to.
#
# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
# "ident", "peer", "pam", "ldap", "radius" or "cert".  Note that
# "password" sends passwords in clear text; "md5" is preferred since
# it sends encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME=VALUE.  The available options depend on the different
# authentication methods -- refer to the "Client Authentication"
# section in the documentation for a list of which options are
# available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other
# special characters must be quoted.  Quoting one of the keywords
# "all", "sameuser", "samerole" or "replication" makes the name lose
# its special character, and just match a database or username with
# that name.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal.  If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect.  You can
# use "pg_ctl reload" to do that.

# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "Host" records.  In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.
local               mail    all     peer map=mailmap
#Host pgadmin       mail        127.0.0.1/32        md5


# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
Host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
Host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#Host    replication     postgres        127.0.0.1/32            md5
#Host    replication     postgres        ::1/128                 md5

[/syntax]

ファイル/etc/postgresql/9.4/main/pg_ident.conf:

hubot@hubot-vps:~$ Sudo cat /etc/postgresql/9.4/main/pg_ident.conf 
# PostgreSQL User Name Maps
# =========================
#
# Refer to the PostgreSQL documentation, chapter "Client
# Authentication" for a complete description.  A short synopsis
# follows.
#
# This file controls PostgreSQL user name mapping.  It maps external
# user names to their corresponding PostgreSQL user names.  Records
# are of the form:
#
# MAPNAME  SYSTEM-USERNAME  PG-USERNAME
#
# (The uppercase quantities must be replaced by actual values.)
#
# MAPNAME is the (otherwise freely chosen) map name that was used in
# pg_hba.conf.  SYSTEM-USERNAME is the detected user name of the
# client.  PG-USERNAME is the requested PostgreSQL user name.  The
# existence of a record specifies that SYSTEM-USERNAME may connect as
# PG-USERNAME.
#
# If SYSTEM-USERNAME starts with a slash (/), it will be treated as a
# regular expression.  Optionally this can contain a capture (a
# parenthesized subexpression).  The substring matching the capture
# will be substituted for \1 (backslash-one) if present in
# PG-USERNAME.
#
# Multiple maps may be specified in this file and used by pg_hba.conf.
#
# No map names are defined in the default configuration.  If all
# system user names and PostgreSQL user names are the same, you don't
# need anything in this file.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal.  If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect.  You can
# use "pg_ctl reload" to do that.

# Put your actual configuration here
# ----------------------------------
mailmap         dovecot                 mailreader
mailmap         postfix                 mailreader
mailmap         root                    mailreader
# MAPNAME       SYSTEM-USERNAME         PG-USERNAME

ログ:

hubot@hubot-vps:~$ Sudo tail -n 50 /var/log/syslog
May 20 18:55:07 hubot-vps postfix/qmgr[12183]: 369ED80B84: removed
May 20 18:58:25 hubot-vps postfix/anvil[13737]: statistics: max connection rate 1/60s for (smtp:74.208.4.200) at May 20 18:55:03
May 20 18:58:25 hubot-vps postfix/anvil[13737]: statistics: max connection count 1 for (smtp:74.208.4.200) at May 20 18:55:03
May 20 18:58:25 hubot-vps postfix/anvil[13737]: statistics: max cache size 1 at May 20 18:55:03
May 20 18:58:34 hubot-vps postfix/smtpd[13787]: connect from unknown[103.17.108.72]
May 20 18:58:35 hubot-vps postfix/smtpd[13787]: disconnect from unknown[103.17.108.72]
May 20 18:59:25 hubot-vps postfix/smtpd[13787]: warning: hostname static.vnpt.vn does not resolve to address 123.16.147.49
May 20 18:59:25 hubot-vps postfix/smtpd[13787]: connect from unknown[123.16.147.49]
May 20 18:59:28 hubot-vps postfix/smtpd[13787]: NOQUEUE: reject: RCPT from unknown[123.16.147.49]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<static.vnpt.vn>
May 20 18:59:34 hubot-vps postfix/smtpd[13787]: disconnect from unknown[123.16.147.49]
May 20 19:00:01 hubot-vps CRON[13859]: (root) CMD (znc)
May 20 19:00:01 hubot-vps postfix/pickup[13772]: E7F8C80B83: uid=0 from=<root>
May 20 19:00:01 hubot-vps postfix/cleanup[13863]: E7F8C80B83: message-id=<[email protected]>
May 20 19:00:01 hubot-vps postfix/qmgr[12183]: E7F8C80B83: from=<[email protected]>, size=687, nrcpt=1 (queue active)
May 20 19:00:01 hubot-vps dovecot: lmtp(13867): Connect from local
May 20 19:00:01 hubot-vps dovecot: auth: Warning: sql: Ignoring changed user_query in /etc/dovecot/dovecot-sql.conf, because userdb sql not used. (If this is intentional, set userdb_warning_disable=yes)
May 20 19:00:01 hubot-vps dovecot: auth: Error: prefetch([email protected]): userdb lookup not possible with only userdb prefetch
May 20 19:00:01 hubot-vps postfix/lmtp[13866]: E7F8C80B83: to=<[email protected]>, orig_to=<root>, relay=mail.hubot.pl[private/dovecot-lmtp], delay=0.06, delays=0.01/0.01/0.02/0.02, dsn=5.1.1, status=bounced (Host mail.hubot.pl[private/dovecot-lmtp] said: 550 5.1.1 <[email protected]> User doesn't exist: [email protected] (in reply to RCPT TO command))
May 20 19:00:01 hubot-vps dovecot: lmtp(13867): Disconnect from local: Successful quit
May 20 19:00:02 hubot-vps postfix/cleanup[13863]: F418680B84: message-id=<[email protected]>
May 20 19:00:02 hubot-vps postfix/qmgr[12183]: F418680B84: from=<>, size=2671, nrcpt=1 (queue active)
May 20 19:00:02 hubot-vps dovecot: lmtp(13867): Connect from local
May 20 19:00:02 hubot-vps dovecot: auth: Error: prefetch([email protected]): userdb lookup not possible with only userdb prefetch
May 20 19:00:02 hubot-vps postfix/bounce[13871]: E7F8C80B83: sender non-delivery notification: F418680B84
May 20 19:00:02 hubot-vps postfix/qmgr[12183]: E7F8C80B83: removed
May 20 19:00:02 hubot-vps postfix/lmtp[13866]: F418680B84: to=<[email protected]>, orig_to=<[email protected]>, relay=mail.hubot.pl[private/dovecot-lmtp], delay=0, delays=0/0/0/0, dsn=5.1.1, status=bounced (Host mail.hubot.pl[private/dovecot-lmtp] said: 550 5.1.1 <[email protected]> User doesn't exist: [email protected] (in reply to RCPT TO command))
May 20 19:00:02 hubot-vps dovecot: lmtp(13867): Disconnect from local: Successful quit
May 20 19:00:02 hubot-vps postfix/qmgr[12183]: F418680B84: removed
May 20 19:02:55 hubot-vps postfix/anvil[13789]: statistics: max connection rate 1/60s for (smtp:103.17.108.72) at May 20 18:58:34
May 20 19:02:55 hubot-vps postfix/anvil[13789]: statistics: max connection count 1 for (smtp:103.17.108.72) at May 20 18:58:34
May 20 19:02:55 hubot-vps postfix/anvil[13789]: statistics: max cache size 2 at May 20 18:59:25
May 20 19:09:01 hubot-vps CRON[14055]: (root) CMD (  [ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean)
May 20 19:10:01 hubot-vps CRON[14102]: (root) CMD (znc)
May 20 19:10:01 hubot-vps postfix/pickup[13772]: 1D0C280B83: uid=0 from=<root>
May 20 19:10:01 hubot-vps postfix/cleanup[14106]: 1D0C280B83: message-id=<[email protected]>
May 20 19:10:01 hubot-vps postfix/qmgr[12183]: 1D0C280B83: from=<[email protected]>, size=687, nrcpt=1 (queue active)
May 20 19:10:01 hubot-vps dovecot: lmtp(13873): Connect from local
May 20 19:10:01 hubot-vps dovecot: auth: Warning: sql: Ignoring changed user_query in /etc/dovecot/dovecot-sql.conf, because userdb sql not used. (If this is intentional, set userdb_warning_disable=yes)
May 20 19:10:01 hubot-vps dovecot: auth: Error: prefetch([email protected]): userdb lookup not possible with only userdb prefetch
May 20 19:10:01 hubot-vps postfix/lmtp[14110]: 1D0C280B83: to=<[email protected]>, orig_to=<root>, relay=mail.hubot.pl[private/dovecot-lmtp], delay=0.09, delays=0.02/0.02/0.02/0.03, dsn=5.1.1, status=bounced (Host mail.hubot.pl[private/dovecot-lmtp] said: 550 5.1.1 <[email protected]> User doesn't exist: [email protected] (in reply to RCPT TO command))
May 20 19:10:01 hubot-vps dovecot: lmtp(13873): Disconnect from local: Successful quit
May 20 19:10:01 hubot-vps postfix/cleanup[14106]: 30D9A80B84: message-id=<[email protected]>
May 20 19:10:01 hubot-vps postfix/qmgr[12183]: 30D9A80B84: from=<>, size=2671, nrcpt=1 (queue active)
May 20 19:10:01 hubot-vps dovecot: lmtp(13873): Connect from local
May 20 19:10:01 hubot-vps dovecot: auth: Error: prefetch([email protected]): userdb lookup not possible with only userdb prefetch
May 20 19:10:01 hubot-vps postfix/bounce[14113]: 1D0C280B83: sender non-delivery notification: 30D9A80B84
May 20 19:10:01 hubot-vps postfix/qmgr[12183]: 1D0C280B83: removed
May 20 19:10:01 hubot-vps postfix/lmtp[14110]: 30D9A80B84: to=<[email protected]>, orig_to=<[email protected]>, relay=mail.hubot.pl[private/dovecot-lmtp], delay=0.01, delays=0/0/0/0.01, dsn=5.1.1, status=bounced (Host mail.hubot.pl[private/dovecot-lmtp] said: 550 5.1.1 <[email protected]> User doesn't exist: [email protected] (in reply to RCPT TO command))
May 20 19:10:01 hubot-vps dovecot: lmtp(13873): Disconnect from local: Successful quit
May 20 19:10:01 hubot-vps postfix/qmgr[12183]: 30D9A80B84: removed
5
user227030

ser database prefetch を使用しています。これは、認証中にユーザーに関する情報を既に読み取っているため、パスワードデータベースへのクエリの数を減らすために使用できますが、これはユーザーが実際に認証された場合にのみ機能します。

メール配信の場合、LDAは明らかに認証されないため、SQLデータベースから読み取る2番目のユーザーデータベース構成が必要です。 /etc/dovecot/dovecot-sql.confでSQLクエリを既に構成しましたが、dovecot.confで2番目のユーザーデータベース構成がありません(上記のリンク先のwikiページからですが、構成に合わせてパスが調整されています)。

passdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf
}
userdb {
  driver = prefetch
}
# The userdb below is used only by lda.
userdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf
}
4
Jens Erat