外部ホストへのPostfix SMTPメールは不可能

外部ホストへのPostfix SMTPメールは不可能

私は、Web サーバーとメール サーバーを実行しているサーバー (Ubuntu 12.04 LTS) を管理しています。Web サーバーは正常に動作していますが、メール サーバーに問題があります。Dovecot はインストールされ、正しく構成されています。Thunderbird で接続でき (クライアントは別のネットワークにあるため、内部ネットワークではありません)、すべてのフォルダーなどを表示できます。外部からのメールも受信されます。

Postfix SMTP 認証は機能しているようです (STARTTLS を使用)。外部ネットワークの Thunderbird からローカルホストとサーバーのドメインに電子メールを書き込むことができます。ただし、別のアドレス (たとえば Gmail) に電子メールを送信しようとすると、次のエラーが発生します。

An error occurred while sending mail. The mail server responded:  5.7.1 <***@gmail.com>:
Relay access denied. Please check the message recipient ***@gmail.com and try again.

私は postfix 自体で SMTP リレーを使用しており、SSH でログインすると電子メールを書き込むことができます。問題はここのどこかにあると思います - postfix への SMTP 接続もこの構成されたリレーを使用しているのでしょうか?

これが私の 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 (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

# 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.

myhostname = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mydomain.com, localhost, myhostname
relayhost = smtp.myrelayhoster.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all



smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noplaintext noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password

sender_canonical_maps = hash:/etc/postfix/sender_canonical

前述のとおり、基本的な SMTP 認証は機能しているようですが、リレーを SMTP 用に個別に構成する必要がありますか?

これらは /var/log/mail.log の重要な行です:

Sep  5 09:19:21 myhostname postfix/smtpd[9086]: connect from isp-ip.net[123.456.789.123]
Sep  5 09:19:22 myhostname postfix/smtpd[9086]: NOQUEUE: reject: RCPT from isp-ip.net[123.456.789.123]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<thunderbird>
Sep  5 09:19:22 myhostname postfix/smtpd[9086]: disconnect from isp-ip.net[123.456.789.123]

答え1

Sep  5 09:19:22 myhostname postfix/smtpd[9086]: NOQUEUE: reject: RCPT from isp-ip.net[123.456.789.123]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<thunderbird>

Telnet経由でSMTPセッションをエミュレートし、その出力を質問に追加してください。また、swaksを使用することもできます。これは単なるPerlスクリプトです。

# swaks -s isp-ip.net --helo thunderbird --to [email protected] --from [email protected] --auth PLAIN --auth-user [email protected] --auth-password 7654321 --auth-hide-password

ホストは認証をアドバタイズしませんでした

リレーホストは認証をサポートしていないようです。サポートしているかもしれませんが、暗号化されたチャネル経由のみです。代わりに465/587ポートを使用してください。例:

# swaks -s isp-ip.net -tlsc -p 465 --helo thunderbird --to [email protected] --from [email protected] --auth PLAIN --auth-user [email protected] --auth-password 7654321 --auth-hide-password

# swaks -s isp-ip.net -tls -p 587 --helo thunderbird --to [email protected] --from [email protected] --auth PLAIN --auth-user [email protected] --auth-password 7654321 --auth-hide-password

関連情報