2022年8月、ホームページを全面リニューアルしました! 情報を分かりやすくお伝えできるサイト作りを目指してまいります。

Rejecting Relaymail!

Postfixで悪質(非常にひつこい!)な不正中継を阻止する(爆爆)!Postfixによる不正中継を阻止する設定。「中継させてねーよ!」と言うのに懲りずに、何回も何回も中継を仕掛けてくる愚か者に捧ぐ!!


# vi main.cf

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
mail_owner = postfix
inet_interfaces = all
mynetworks = 127.0.0.0/8
$mydomain
local_destination_concurrency_limit = 2
default_destination_concurrency_limit = 10
debug_peer_level = 2
debugger_command =
PATH=/usr/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
myhostname = hoge.hogehoge.com
myorigin = $myhostname
smtpd_client_restrictions = permit_mynetworks,
                  check_client_access hash:/etc/postfix/bad_clients,
                  permit
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
program_directory = /usr/lib/postfix

上記のように、smtpd_client_restrictionsのセクションで設定する。ここでbad_clientsに悪者のホスト名もしくはIPアドレスもしくはドメイン名を明記。

# vi bad_clients
hanmail.net      REJECT
yahoo.com       REJECT

222.101         REJECT

# postmap bad_clients

設定後、Postfixをリスタートして、この網に引っかかると以下のようなmailログが現れる。

Sep 4 12:06:47 gw2 postfix/smtpd[2787]: reject: RCPT from unknown[222.101.164.245]: 554 : Client host rejected: Access denied; from=<rge4g4jvta@yahoo.com> to=<talent311@hanmail.net>

憎きかな、不正中継野郎!!このhanmailとyahooはしょっちゅうリレーしてきやがる(;-_-;)非常にむかつく!

以上

コメント