Rocky Linux release 9.5 epelインストールで実施。
jail.confをjail.localにまるっとコピーしていた場合は以下のように「action_m」を追加
banaction_allports = iptables-allports
# The simplest action to take: ban only
action_ = %(banaction)s[port="%(port)s", protocol="%(protocol)s", chain="%(chain
)s"]
# ban & send an e-mail to the destemail.
action_m = %(action_)s
%(mta)s[sender="%(sender)s", dest="%(destemail)s", protocol="%(protoc
ol)s", chain="%(chain)s"]
# ban & send an e-mail with whois report to the destemail.
action_mw = %(action_)s
%(mta)s-whois[sender="%(sender)s", dest="%(destemail)s", protocol="%
(protocol)s", chain="%(chain)s"]
action_mを使いたいセクションに記載
[recidive] enabled = true ・ ・ ・ action = %(action_m)s
以下のようなものが送信されるようになります。
Hi, The IP XXX.XXX.XXX.XXX has just been banned by Fail2Ban after 5 attempts against recidive. Regards, Fail2Ban
