前提・実現したいこと
CentOS7+Samba4で構築したファイルサーバーでの各種対策ソフト(chkrootkit、Tripwire、clamdscan)のroot宛結果メールを
自分の所有するISPメールアドレスに転送して、普段使用するメインPCでトラブル検知をしたい。
発生している問題・エラーメッセージ
Postfixで上記機能を達成する為に、
各実行sh内(chkrootkit、Tripwire、clamdscan)で直接送信先ISPアドレスを指定すると問題無く届きます。
但し、下記問題が発生したので、root宛メールを正しく送信先ISPアドレスに届ける方法をとるのが目標です。
1.Tripwire自体がshでのメール送信以外にrootにメールを転送するので、これが正しく送信出来ない
2.apcupsdのエラーメールもroot宛に届くので、これを正しく送信出来ない
3.ファイルサーバーの構築と検証開始から日が浅い為、他にもroot宛メールを送信するソフトがある可能性がある
rootメールの転送設定に問題がある為、
発送元として指定したzzzz@xx.yyyy.co.jpにメール送信エラーとして戻ってしまいます。
ローカル内に設置したファイルサーバーの為、ドメイン登録はしていません。
例え、ドメイン登録をしても外部発呼の接続をルータで許容していないので、DNSの問い合わせに返信出来ません。
※内部発呼の外部接続は認めているので、ウイルス対策ソフト等のデータベース更新は出来ております。
----- The following addresses had permanent fatal errors ----- <root@xx.yyyy.or.jp> (reason: 550 5.1.1 <root@xx.yyyy.or.jp>... User Unknown) ----- Transcript of session follows ----- ... while talking to mx.yyyy.or.jp.: >>> DATA <<< 550 5.1.1 <root@xx.yyyy.or.jp>... User Unknown 550 5.1.1 <root@xx.yyyy.or.jp>... User unknown <<< 503 5.0.0 Need RCPT (recipient) 加えて、エラーメールで戻ってきたメールヘッダーは、Return-Path: <>と空欄になっています。 正しく届いたメールのReturn-Path: <Return-Path: <zzzz.xx.yyyy.or.jp>と送信元アドレスとして指定したメアドが正しく入っています。 それ以外にヘッダー部分に違いは見つけられませんでした。 登録しているISPでroot@のメールが取れれば良いのですが、既に全て取得されており入手出来ません。
試したこと
###/etc/postfix/main.cfに下記を追加
mydomain = xx.yyyy.or.jp
myorigin = $mydomain ここ迄でroot@hosts.localdomain→root@xx.yyyy.or.jp迄変更は出来てます
mydestination =
relayhost = [mbox.yyyyy.or.jp]:587
SMTP認証を行うための設定
smtp_use_tls = no
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay_password
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_mechanism_filter = PLAIN LOGIN CRAM-MD5
送信されるメールアドレスを変更するための設定
local_header_rewrite_clients = permit_mynetworks
sender_canonical_classes = envelope_sender
sender_canonical_maps = regexp:/etc/postfix/sender_maps
###/etc/postfix/relay_passwordに下記を追加
[mbox.yyyy.or.jp]:587 zzzz.xx.yyyy.or.jp:ABCDEF
###/etc/postfix/sender_mapsに下記を追加
/^.*$/ zzzz@xx.yyyy.or.jp
###/etc/aliasesの一番下の部分を修正
root:marc→root:宛先ISPメール
上記設定で、chkrootkit、Tripwire、clamdscanの各shに直接宛先ISPアドレスを記載すると正しく届く
chkrootkit、Tripwire、clamdscanの宛先をrootにして動作させると、送信元ISPアドレスにエラーメールとして戻ってきます。
ソフト独自でroot宛メールを発信されると同様に、送信元ISPアドレスにエラーメールとして戻ってきます。
エラーメールを確認するとroot@xx.yyyy.co.jp
補足情報(FW/ツールのバージョンなど)
CentOS Linux release 7.4.1708 (Core)
Postfix 2.10.1
※※※/var/log/mailinの本日分を記載致します。
Jun 27 00:12:57 hosts postfix/pickup[16035]: 514A6607063F: uid=0 from=<root>
Jun 27 00:12:57 hosts postfix/cleanup[16492]: 514A6607063F: message-id=20180626151257.514A6607063F@hosts.xx.yyyy.or.jp
Jun 27 00:12:57 hosts postfix/qmgr[14814]: 514A6607063F: from=zzzz@xx.yyyy.or.jp, size=473, nrcpt=1 (queue active)
Jun 27 00:12:57 hosts postfix/smtp[16497]: 514A6607063F: to=<送信先IPアドレス>, relay=mbox.yyyy.or.jp[210.130.0.166]:587, delay=0.24, delays=0.01/0.01/0.1/0.12, dsn=2.0.0, status=sent (250 2.0.0 w5QFCvdC015643 Message accepted for delivery)
Jun 27 00:12:57 hosts postfix/qmgr[14814]: 514A6607063F: removed
Jun 27 01:28:46 hosts postfix/pickup[16606]: 130D4607063F: uid=0 from=<root>
Jun 27 01:28:46 hosts postfix/cleanup[16842]: 130D4607063F: message-id=20180626162846.130D4607063F@hosts.xx.yyyy.or.jp
Jun 27 01:28:46 hosts postfix/qmgr[14814]: 130D4607063F: from=zzzz@xx.yyyy.or.jp, size=1285, nrcpt=1 (queue active)
Jun 27 01:28:46 hosts postfix/smtp[16844]: 130D4607063F: to=root@xx.yyyy.or.jp, orig_to=<root>, relay=mbox.yyyy.or.jp[210.130.0.166]:587, delay=0.35, delays=0.01/0.01/0.21/0.12, dsn=2.0.0, status=sent (250 2.0.0 w5QGSkCn029783 Message accepted for delivery)
Jun 27 01:28:46 hosts postfix/qmgr[14814]: 130D4607063F: removed
Jun 27 01:28:49 hosts postfix/pickup[16606]: 7F2CD607063F: uid=0 from=<root>
Jun 27 01:28:49 hosts postfix/cleanup[16842]: 7F2CD607063F: message-id=20180626162849.7F2CD607063F@hosts.xx.yyyy.or.jp
Jun 27 01:28:49 hosts postfix/qmgr[14814]: 7F2CD607063F: from=zzzz@xx.yyyy.or.jp, size=1311, nrcpt=1 (queue active)
Jun 27 01:28:49 hosts postfix/smtp[16844]: 7F2CD607063F: to=root@xx.yyyy.or.jp, orig_to=<root>, relay=mbox.yyyy.or.jp[210.130.0.167]:587, delay=0.22, delays=0/0/0.09/0.14, dsn=2.0.0, status=sent (250 2.0.0 w5QGSnjd029808 Message accepted for delivery)
Jun 27 01:28:49 hosts postfix/qmgr[14814]: 7F2CD607063F: removed
Jun 27 03:00:07 hosts postfix/pickup[17010]: 26CD6607063F: uid=0 from=<root>
Jun 27 03:00:07 hosts postfix/cleanup[17227]: 26CD6607063F: message-id=20180626180007.26CD6607063F@hosts.xx.yyyy.or.jp
Jun 27 03:00:07 hosts postfix/qmgr[14814]: 26CD6607063F: from=zzzz@xx.yyyy.or.jp, size=6269, nrcpt=1 (queue active)
Jun 27 03:00:07 hosts postfix/smtp[17229]: 26CD6607063F: to=<送信先IPアドレス>, relay=mbox.yyyy.or.jp[210.130.0.166]:587, delay=0.39, delays=0.02/0/0.24/0.14, dsn=2.0.0, status=sent (250 2.0.0 w5QI07Jg017759 Message accepted for delivery)
Jun 27 03:00:07 hosts postfix/qmgr[14814]: 26CD6607063F: removed
Jun 27 03:16:10 hosts postfix/pickup[17010]: 26Dxx607063F: uid=0 from=<root>
Jun 27 03:16:10 hosts postfix/cleanup[17326]: 26Dxx607063F: message-id=20180626181610.26Dxx607063F@hosts.xx.yyyy.or.jp
Jun 27 03:16:10 hosts postfix/qmgr[14814]: 26Dxx607063F: from=zzzz@xx.yyyy.or.jp, size=5318, nrcpt=1 (queue active)
Jun 27 03:16:10 hosts postfix/smtp[17331]: 26Dxx607063F: to=root@xx.yyyy.or.jp, orig_to=<root>, relay=mbox.yyyy.or.jp[210.130.0.167]:587, delay=0.27, delays=0.01/0.01/0.1/0.15, dsn=2.0.0, status=sent (250 2.0.0 w5QIGAK0026696 Message accepted for delivery)
Jun 27 03:16:10 hosts postfix/qmgr[14814]: 26Dxx607063F: removed
Jun 27 04:00:02 hosts postfix/pickup[17491]: 95DF6607063F: uid=0 from=<root>
Jun 27 04:00:02 hosts postfix/cleanup[18570]: 95DF6607063F: message-id=20180626190002.95DF6607063F@hosts.xx.yyyy.or.jp
Jun 27 04:00:02 hosts postfix/qmgr[14814]: 95DF6607063F: from=zzzz@xx.yyyy.or.jp, size=515, nrcpt=1 (queue active)
Jun 27 04:00:02 hosts postfix/smtp[18575]: 95DF6607063F: to=<送信先IPアドレス>, relay=mbox.yyyy.or.jp[210.130.0.166]:587, delay=0.34, delays=0.01/0/0.2/0.12, dsn=2.0.0, status=sent (250 2.0.0 w5QJ02ih018612 Message accepted for delivery)
Jun 27 04:00:02 hosts postfix/qmgr[14814]: 95DF6607063F: removed
Jun 27 05:06:16 hosts postfix/postfix-script[18932]: stopping the Postfix mail system
Jun 27 05:06:16 hosts postfix/master[14812]: terminating on signal 15
Jun 27 05:06:16 hosts postfix/postfix-script[19016]: starting the Postfix mail system
Jun 27 05:06:16 hosts postfix/master[19018]: daemon started -- version 2.10.1, configuration /etc/postfix
Jun 27 05:06:33 hosts postfix/pickup[19019]: 7A885607063F: uid=0 from=<root>
Jun 27 05:06:33 hosts postfix/cleanup[19025]: 7A885607063F: message-id=20180626200633.7A885607063F@hosts.xx.yyyy.or.jp
Jun 27 05:06:33 hosts postfix/qmgr[19020]: 7A885607063F: from=zzzz@xx.yyyy.or.jp, size=454, nrcpt=1 (queue active)
Jun 27 05:06:33 hosts postfix/smtp[19027]: 7A885607063F: to=<送信先IPアドレス>, relay=mbox.yyyy.or.jp[210.130.0.166]:587, delay=0.24, delays=0.02/0.01/0.1/0.12, dsn=2.0.0, status=sent (250 2.0.0 w5QK6XNG001060 Message accepted for delivery)
Jun 27 05:06:33 hosts postfix/qmgr[19020]: 7A885607063F: removed
Jun 27 05:06:48 hosts postfix/pickup[19019]: 5EF50607063F: uid=0 from=<root>
Jun 27 05:06:48 hosts postfix/cleanup[19025]: 5EF50607063F: message-id=20180626200648.5EF50607063F@hosts.xx.yyyy.or.jp
Jun 27 05:06:48 hosts postfix/qmgr[19020]: 5EF50607063F: from=zzzz@xx.yyyy.or.jp, size=455, nrcpt=1 (queue active)
Jun 27 05:06:48 hosts postfix/smtp[19027]: 5EF50607063F: to=root@xx.yyyy.or.jp, orig_to=<root>, relay=mbox.yyyy.or.jp[210.130.0.166]:587, delay=0.22, delays=0/0/0.09/0.13, dsn=2.0.0, status=sent (250 2.0.0 w5QK6m3m001185 Message accepted for delivery)
回答2件
あなたの回答
tips
プレビュー