web-dev-qa-db-ja.com

メールサーバーはメールを受信できませんが、メールを送信できます-Postfix、Dovecot、MySQL

ドメインからメールを送受信できるようにメールサーバーを設定するサーバーがあります。現在、サーバーからメールを送信する権限があるが、ログによると、自分のネットワーク以外のプロバイダーからメールを受信する権限がないという問題があります。

このチュートリアルでは、Postfix、Dovecot、およびMySQLをバックエンドとして使用してメールサーバーを構成する方法を示します( here )。

適切なログ:

Jan  6 13:55:49 mail postfix/smtpd[26857]: permit_mynetworks: mail-la0-f50.google.com 209.85.215.50
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostname: mail-la0-f50.google.com ~? 127.0.0.0/8
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostaddr: 209.85.215.50 ~? 127.0.0.0/8
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostname: mail-la0-f50.google.com ~? 127.0.0.2/32
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostaddr: 209.85.215.50 ~? 127.0.0.2/32
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostname: mail-la0-f50.google.com ~? 192.99.104.50/32
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostaddr: 209.85.215.50 ~? 192.99.104.50/32
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostname: mail-la0-f50.google.com ~? [::1]/128
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_hostaddr: 209.85.215.50 ~? [::1]/128
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_list_match: mail-la0-f50.google.com: no match
Jan  6 13:55:49 mail postfix/smtpd[26857]: match_list_match: 209.85.215.50: no match
Jan  6 13:55:49 mail postfix/smtpd[26857]: generic_checks: name=permit_mynetworks status=0
Jan  6 13:55:49 mail postfix/smtpd[26857]: generic_checks: name=reject_unauth_destination
Jan  6 13:55:49 mail postfix/smtpd[26857]: reject_unauth_destination: [email protected]
Jan  6 13:55:49 mail postfix/smtpd[26857]: permit_auth_destination: [email protected]`
Jan  6 13:55:49 mail postfix/smtpd[26857]: ctable_locate: leave existing entry key [email protected]`
Jan  6 13:55:49 mail postfix/smtpd[26857]: NOQUEUE: reject: RCPT from mail-la0-f50.google.com[209.85.215.50]: 554 5.7.1 <me@d$`
Jan  6 13:55:49 mail postfix/smtpd[26857]: generic_checks: name=reject_unauth_destination status=2`
Jan  6 13:55:49 mail postfix/smtpd[26857]: > mail-la0-f50.google.com[209.85.215.50]: 554 5.7.1 <[email protected]>: Relay access denied`
Jan  6 13:55:49 mail postfix/smtpd[26857]: < mail-la0-f50.google.com[209.85.215.50]: DATA`
Jan  6 13:55:49 mail postfix/smtpd[26857]: > mail-la0-f50.google.com[209.85.215.50]: 554 5.5.1 Error: no valid recipients`
Jan  6 13:55:49 mail postfix/smtpd[26857]: < mail-la0-f50.google.com[209.85.215.50]: QUIT`
Jan  6 13:55:49 mail postfix/smtpd[26857]: > mail-la0-f50.google.com[209.85.215.50]: 221 2.0.0`

私のmain.cf

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
smtpd_tls_cert_file=/etc/ssl/certs/dovecot.pem
smtpd_tls_key_file=/etc/ssl/private/dovecot.pem
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
smtpd_recipient_restrictions =
      permit_sasl_authenticated,
      permit_mynetworks,
      reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = duper51.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
#mydestination = duper51.com, mail.duper51.com, localhost
mydestination = 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 = ipv4
3
duper51

投稿した設定から、「mydestination」の権利がありましたが、コメントアウトして「localhost」に設定しました。これは間違いなくあなたが外の世界からメールを受信することを防ぎます。

1
Dale Anderson

住宅接続を使用している場合、ISPはおそらくポート25での受信SMTP接続をブロックしています。通常、サーバーの実行は住宅インターネットアカウントの利用規約で禁止されています。

1
Daniel Sloan