Memo

メモ > サーバ > 各論: トラブル対応例 > 管理しているサーバを送信元として迷惑メールが送られてきた

■管理しているサーバを送信元として迷惑メールが送られてきた
ここでは「管理しているサーバ = refirio.net」であるとする メール受信のための設定をしていない、さらにPostfix自体も稼働させていないサーバから送信元 info@refirio.net として server@refirio.org に迷惑メールが送られてきた メールヘッダを確認すると、送信元サーバは batch1.refirio.net のように見える 以下は 「refirio.net ではメールの受信は行っていないので外部からメールは受け取らないはず、迷惑メール送信の不正プログラムでも設置されたのか」 と思って調査したメモ 確認に使用したメールの送信元は、ここでは example@example.com とする ■確認 example@example.com を送信元として info@refirio.net にメールを送ると、batch1サーバの /var/log/maillog に以下が記録された。
Feb 24 18:12:02 batch1 sendmail[8479]: 31O9C2Kp008479: Authentication-Warning: batch1.refirio.net: apache set sender to auto@refirio.net using -f Feb 24 18:12:02 batch1 sendmail[8479]: 31O9C2Kp008479: from=auto@refirio.net, size=2037, class=0, nrcpts=0, msgid=<202302240912.31O9C2Kp008479@batch1.refirio.net>, bodytype=8BITMIME, relay=apache@localhost Feb 24 18:12:19 batch1 sendmail[8499]: 31O9CJLw008499: from=<example@example.com>, size=2431, class=0, nrcpts=1, msgid=<CAOwUPtZZ7TR0=XmUKL4F1p3TtzXrOhHQrsO9ZN4DcLwsg5vmaw@mail.gmail.com>, proto=ESMTP, daemon=MTA, relay=mail-proxy111.phy.lolipop.jp [157.7.104.15] Feb 24 18:12:19 batch1 sendmail[8500]: STARTTLS=client, relay=mx01.lolipop.jp., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES256-GCM-SHA384, bits=256/256 Feb 24 18:12:19 batch1 sendmail[8500]: 31O9CJLw008499: to=server@refirio.org, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=32643, relay=mx01.lolipop.jp. [157.7.107.233], dsn=2.0.0, stat=Sent (Ok: queued as 5BC9D1404F083) Feb 24 18:12:50 batch1 sendmail[8539]: 31O9Cooa008539: localhost [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA Feb 24 18:13:51 batch1 sendmail[8643]: 31O9DpJk008643: localhost [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA Feb 24 18:14:01 batch1 sendmail[8691]: 31O9E1Dq008691: Authentication-Warning: batch1.refirio.net: apache set sender to auto@refirio.net using -f Feb 24 18:14:01 batch1 sendmail[8691]: 31O9E1Dq008691: from=auto@refirio.net, size=2727, class=0, nrcpts=0, msgid=<202302240914.31O9E1Dq008691@batch1.refirio.net>, bodytype=8BITMIME, relay=apache@localhost
これは 送信日時: 02/24 18:12:19 送信元: example@example.com 送信先: server@refirio.org 送信元サーバ: mail-proxy111.phy.lolipop.jp 送信先サーバ: mx01.lolipop.jp 追加情報: - サイズ: 2KB 結果: 成功 ということなので、迷惑メールのときと状況は一致する つまり現象を再現できた ■調査 refirio.net のMXレコードは以下のようになっている
# dig refirio.net mx refirio.net. 300 IN MX 10 batch1.refirio.net.
上記設定により、メールは batch1.refirio.net サーバが受け取るように指定されている batch1.refirio.net サーバでPostfixは稼働させていないが、古いサーバなのでsendmailが稼働していた
# ll /etc/alternatives/ | grep mta-sendmai lrwxrwxrwx 1 root root 26 11月 15 2016 mta-sendmail -> /usr/lib/sendmail.sendmail lrwxrwxrwx 1 root root 42 11月 15 2016 mta-sendmailman -> /usr/share/man/man8/sendmail.sendmail.8.gz
参考までに、Postfixを稼働させている場合は以下のようになる
# ll /etc/alternatives/ | grep mta-sendmai lrwxrwxrwx 1 root root 25 1月 25 08:05 mta-sendmail -> /usr/lib/sendmail.postfix lrwxrwxrwx 1 root root 41 1月 25 08:05 mta-sendmailman -> /usr/share/man/man1/sendmail.postfix.1.gz
batch1.refirio.net サーバの /etc/aliases を確認すると、以下の記述がある。
mailer-daemon: postmaster postmaster: root 〜略〜 root: server@refirio.org
メールエイリアスの設定 | 技術ノート http://www.gabacho-net.jp/tech-note/aliases.html 上記ページによると > これらは、MAILER-DAEMON(メール配送デーモン:sendmailデーモンのこと)宛に通知されたメールはpostmaster(郵便局長の意味)が受け取るべきこと、 > さらにpostmaster宛のメールはroot(システム管理者)が受け取るべきことを定義しています。 とのこと よって 1. example@example.com(外部)から info@refirio.net へメールを送信 2. DNSのMXレコードにより、batch1.refirio.net へ転送 3. batch1.refirio.netのAliasにより、postmaster → root → server@refirio.org の順で転送 となる つまり、迷惑メール送信リストの中に info@refirio.net があり、その内容が server@refirio.org に転送されてきた …というもの ■参考 MXレコードとは?役割と確認方法についてわかりやすく解説! - Value Note - わかる、なるほどなIT知識。 https://www.value-domain.com/media/mx_record/ オープンソースのPostfixとsendmailを比較 https://www.ossnews.jp/compare/postfix/sendmail reCatnap: linux MTAの確認(sendmail、postfixの確認) https://tips.recatnap.info/laboratory/detail/id/345 postfixのメール再送信と、再送メールキューの動作 | りんか ネット https://rin-ka.net/postfix-postqueue/ Postfixのキューの再送間隔がわかりにくいため、やさしく解説してみた | KITA-SAN.BLOG https://kita-san.blog/computer-related/postfix-retry/ Postfixでの具体的な設定箇所が説明されている メールエイリアスの設定 | 技術ノート http://www.gabacho-net.jp/tech-note/aliases.html

Advertisement