dovecotのerror.logのこのようなログが残る。
これは以前からずっとである。
|
1 2 3 |
2026-07-07 22:54:41 auth: Error: auth client 0 disconnected with 1 pending requests: EOF 2026-07-08 08:03:47 auth: Error: auth client 0 disconnected with 1 pending requests: EOF 2026-07-08 11:36:01 auth: Error: auth client 0 disconnected with 1 pending requests: EOF |
これ何とかならないかと悩んでいた。
postfix側で行われている、こいつらが原因だろうからだ。
|
1 2 3 |
Jul 10 05:37:05 mail postfix/smtpd[92068]: connect from unknown[107.155.15.206] Jul 10 05:37:05 mail postfix/smtpd[92068]: NOQUEUE: lost connection after EHLO from unknown[107.155.15.206] Jul 10 05:37:05 mail postfix/smtpd[92068]: disconnect from unknown[107.155.15.206] ehlo=1 auth=0/1 commands=1/2 |
そう、submissionに対するピンポンダッシュである。
そこでGeminiさんに聞いた「直接submissionを叩いているので、『unknownには認証まで通させない』ってpostfix側で定義できると良いのだけれどね」と。
知恵ミニさんの答えとして二つ提示されたんだ。
1. smtpd_client_restrictions の順序と reject_unknown_client_hostname
もし未設定であれば、main.cf の smtpd_client_restrictions の一番最初の方に、厳しめのフィルタを置くのが定石です。
2.smtpd_helo_required = yes
これも基本ですが、重要です。
Geminiさんの提案と、こちらは要望や疑問点と応答していくと結構理解も進む。
結果。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
postfix/main.cfの該当箇所に多少の調整と追加。 smtpd_client_restrictions = permit_mynetworks, hash:/opt/local/etc/postfix/access, cidr:/opt/local/etc/postfix/access_cidr, cidr:/opt/local/etc/postfix/reject_cidr, reject_unknown_client_hostname, permit_sasl_authenticated, permit smtpd_helo_restrictions = permit_mynetworks, check_client_access hash:/opt/local/etc/postfix/access, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname, permit_sasl_authenticated, permit |
まずは順番。
最初にsmtpd_client_restrictionsが動く。ここでアクセスしてきた相手のip絡みの確認がされる。
次にsmtpd_helo_restrictionsが動く。ここで更に先の相手の情報を確かめてゆき、最後に認証となる。
smtpd_client_restrictionsは、先に確定者(OK or reject)を選別する。
permit_mynetworks, #自分のネットワークはOK
hash:/opt/local/etc/postfix/access, #ここにはOKとREJECTのドメインが書かれている
cidr:/opt/local/etc/postfix/access_cidr, #ここには通すべきip & ip rangeが書かれている
cidr:/opt/local/etc/postfix/reject_cidr, #ここには排除するべきip & ip rangeが書かれている
それから、これを追加。
reject_unknown_helo_hostname, #ホスト名が不明なものは排除(今回の目玉)
unknown[107.155.15.206]みたいのが認証動作前に落とされる。
最後に漸く認証確認(permit_sasl_authenticated)に入るので、unknownがdovecot認証することはできない。
これでdovecotのerror.logはだいぶ静かになるだろう。

