2 идентичных VPS (Ubuntu 18.04): Postfix - Оповещения из Monit в почту Google не работают

Начнем с начала. У меня есть два идентичных сервера VPS с ОС Ubuntu 18.04 и установленным на обоих Monit. Я настроил почтовый сервер в конфигурации монитора (для отправки предупреждений) в качестве локального хоста на обоих. Проблема в том, что на одном сервере все работает нормально, а на другом я получаю сообщение об ошибке: NOQUEUE: reject: RCPT from localhost [127.0.0.1]: 550 5.1.1: Адрес получателя отклонен: пользователь неизвестен в таблице виртуальных псевдонимов

Я не настраивал Dovecot и Postfix специально, поэтому они должны работать в обеих конфигурациях по умолчанию. Я сравнил конфигурацию рабочего постфиксного сервера и неработающую конфигурацию постфиксного сервера, и мне кажется, что они более или менее одинаковы. Вот они:

Рабочий сервер:

    # 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 (Ubuntu)
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

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# 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

# 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 = sub.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, sub.domain.com, localhost.domain.com, , localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtp_tls_security_level = may
allow_percent_hack = no

и на этом сервере все работает нормально без дополнительной настройки, просто помещая localhost в качестве почтового сервера в конфигурацию монитора.

Не рабочий сервер:

# 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 (Ubuntu)
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

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/postfix.cert.pem
smtpd_tls_key_file = /etc/postfix/postfix.key.pem
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 = sub2.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, sub2.domain.com, localhost.domain.com, ,localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtp_tls_security_level = dane
allow_percent_hack = no
smtpd_tls_CAfile = /etc/postfix/postfix.ca.pem
smtpd_tls_security_level = may
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1

Этот сервер генерирует вышеупомянутая ошибка.

Адрес получателя почты имеет другой домен, чем эти серверы, а почтовый ящик находится в Google. После проверки nslookup NX кажется, что он решен правильно:

Non-authoritative answer:
maildomain.com  mail exchanger = 5 alt2.aspmx.l.google.com.
maildomain.com  mail exchanger = 10 alt4.aspmx.l.google.com.
maildomain.com  mail exchanger = 10 alt3.aspmx.l.google.com.
maildomain.com  mail exchanger = 5 alt1.aspmx.l.google.com.
maildomain.com  mail exchanger = 1 aspmx.l.google.com.

Еще одна вещь: на неработающем сервере есть apache с настроенным веб-сайтом maildomain.com, и я думаю, что, возможно, это мешает серверу отправлять электронную почту. Возможно, он ищет только адрес электронной почты локально, а затем получает эту ошибку: RCPT from localhost [127.0.0.1]: 550 5.1.1: Адрес получателя отклонен: Пользователь неизвестен в таблице виртуальных псевдонимов

Любые идеи, как заставить его работать и то, что здесь могло быть плохим, было бы идеально. Заранее благодарю!

1
задан 18 November 2019 в 11:02
1 ответ

Я боюсь, что еще не могу прокомментировать, таким образом, это должно быть ответом...

кажется, что постфикс не может найти пользователя в своей локальной базе данных, таким образом, пользователь, кажется, не локальный пользователь, и пользователь, кажется, не находится в/etc/aliases файле. Или, и необходимо попробовать это. Вы не выполнили команду newaliases.

Для дальнейшей справки было бы полезно обеспечить немного больше информации:

  • Получатель электронной почты

  • Содержание соответствующих/etc/aliases файлов

0
ответ дан 4 December 2019 в 02:33

Теги

Похожие вопросы