質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

SMTP

SMTP(Simple Mail Transfer Protocol)はIPネットワークでemailを伝送する為のプロトコルです。

Postfix

Postfixは、電子メールサーバソフトウェアで、 メールを配送するシステムMTAの一種です。

Q&A

0回答

1848閲覧

postfixのNOQUEUE: reject: RCPT from hostname

osamuya

総合スコア241

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

SMTP

SMTP(Simple Mail Transfer Protocol)はIPネットワークでemailを伝送する為のプロトコルです。

Postfix

Postfixは、電子メールサーバソフトウェアで、 メールを配送するシステムMTAの一種です。

0グッド

1クリップ

投稿2020/03/15 06:05

編集2022/01/12 10:55

GCEでメールサーバーを立てております。ローカルホストからのメール送信は成功するのですが同じネットワークセグメント内のリモートホストからこのメールサーバーを使ってメール送信すると、

Mar 15 03:52:29 postfix-server postfix/smtpd[29964]: disconnect from remote.c.projectname.internal[192.168.0.3] Mar 15 03:56:25 postfix-server postfix/smtpd[30009]: connect from remote.c.projectname.internal[192.168.0.3] Mar 15 03:56:25 postfix-server postfix/smtpd[30009]: NOQUEUE: reject: RCPT from remote.c.projectname.internal[192.168.0.3]: 554 5.7.1 <remote.c.projectname.internal[192.168.0.3]>: Client host rejected: Access denied; from=<foobar@remote.localdomain> to=<foobar@example.com> proto=ESMTP helo=<remote.localdomain> Mar 15 03:56:25 postfix-server postfix/smtpd[30009]: disconnect from remote.c.projectname.internal[192.168.0.3]

という感じで拒否されてしまいます。
mynetworksの設定では上記のネットワークセグメントの192.168.0.0/24が設定されおり、関連する設定も以下のようになっています。

# /etc/postfix/main.cf alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases canonical_classes = envelope_recipient, header_recipient canonical_maps = regexp:/etc/postfix/allmails_to_admin.txt command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 home_mailbox = Maildir/ html_directory = no inet_interfaces = all inet_protocols = all local_header_rewrite_clients = static:all mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost mydomain = example.com myhostname = post.example.com mynetworks = 127.0.0.0/8,192.168.0.0/24 myorigin = $myhostname newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES relayhost = [smtp.sendgrid.net]:587 sample_directory = /usr/share/doc/postfix-2.10.1/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtp_sasl_auth_enable = yes smtp_sasl_mechanism_filter = plain smtp_sasl_password_maps = hash:/etc/postfix/sasl_password smtp_sasl_tls_security_options = noanonymous smtp_tls_CApath = /etc/pki/tls/certs/ca-bundle.crt smtp_use_tls = yes smtpd_banner = $myhostname ESMTP unknown smtpd_client_restrictions = permit_mynetworks check_sender_access regexp:/etc/postfix/white-list, unknown_local_recipient_reject_code = 550

ポートも空いています。
こちらに紹介されているようなホワイトリストにも登録してみましたが、効果はありませんでした。
https://brookbach.com/tech/2017/10/13/mail-rejected-on-postfix.html
名前解決関連の問題なのか、postfix上の問題なのかまだ切り分けができていなくて、
困っているところです。GCE内では自動的に「remote.c.projectname.internal」といった内部DNSで名前解決をしてしまうため、postfixで設定している「example.com」と不整合が起きているのかもとも考えています。
ローカルホストからの送信は問題なくできております。
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

doda

2020/03/15 07:08

smtpd_recipient_restrictionsやsmtpd_client_restrictionsの中身はこれだけではないですよね? 略さずにすべて書けますか? 可能ならば postconf -n の結果を出してください。
osamuya

2020/03/15 07:34 編集

ありがとうございます。postconf -nの結果を上記のmain.cfの設定部分で修正しました。 同じネットワークセグメント内はSMTPは認証なしで利用しようとしているのですが、認証がかかっているか、そもそも拒否されているかデバック中ですが、telnetで見てみるとホストには接続できているので、認証で拒否されているような気がします。 mynetworkで指定した範囲はSMTPの認証なしで送信できるかと思っているのですが、駄目なんでしょうか。。
osamuya

2020/03/15 10:25 編集

master.cfの「-o smtpd_client_restrictions」に「permit_mynetworks」を追加すると認証自体は通った感じになりました。 しかし、「status=bounced (unknown user: "system+postfix_dev"」でユーザーがいないと言ってリレされていない状態になっています。 ちなみにこのsystem+postfix_devユーザーはクライアント側で指定しているユーザー名ではなくて、どこかで自動的に設定されるユーザー名のようです。 Mar 15 10:03:24 postfix-server postfix/smtpd[7748]: connect from remote.c.projectname.internal[192.168.0.3] Mar 15 10:03:24 postfix-server postfix/smtpd[7748]: C0E6913CB675: client=remote.c.projectname.internal[192.168.0.3] Mar 15 10:03:24 postfix-server postfix/cleanup[7749]: C0E6913CB675: message-id=<20200315100324.B9145106E9DF@remote.localdomain> Mar 15 10:03:24 postfix-server postfix/qmgr[7551]: C0E6913CB675: from=<foobar@remote.localdomain>, size=729, nrcpt=1 (queue active) Mar 15 10:03:24 postfix-server postfix/smtpd[7748]: disconnect from remote.c.projectname.internal[192.168.0.3] Mar 15 10:03:24 postfix-server postfix/local[7700]: C0E6913CB675: to=<system+postfix_dev@example.com>, orig_to=<foobar@post.example.com>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=5.1.1, status=bounced (unknown user: "system+postfix_dev") Mar 15 10:03:24 postfix-server postfix/cleanup[7699]: C2D8913CB678: message-id=<20200315100324.C2D8913CB678@post.example.com> Mar 15 10:03:24 postfix-server postfix/bounce[7702]: C0E6913CB675: sender non-delivery notification: C2D8913CB678 Mar 15 10:03:24 postfix-server postfix/qmgr[7551]: C0E6913CB675: removed Mar 15 10:03:24 postfix-server postfix/qmgr[7551]: C2D8913CB678: from=<>, size=2715, nrcpt=1 (queue active) Mar 15 10:03:24 postfix-server postfix/local[7751]: C2D8913CB678: to=<system+postfix_dev@example.com>, orig_to=<foobar@remote.localdomain>, relay=local, delay=0.01, delays=0/0/0/0, dsn=5.1.1, status=bounced (unknown user: "system+postfix_dev") Mar 15 10:03:24 postfix-server postfix/qmgr[7551]: C2D8913CB678: removed
TaichiYanagiya

2020/03/15 11:53

「to=<system+postfix_dev@example.com>, orig_to=<foobar@post.example.com>」ですので、alias_maps, canonical_maps のどちらかに転送設定があるのでしょう。
osamuya

2020/03/16 00:50

canonical_mapsにありました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問