fail2banのメール通知で action = %(action_m)s って無くないですか?(Rocky Linux release 9.5 epelインストール)
Rocky Linux release 9.5 epelインストールで実施。
fail2banでメール通知を設定したいと思い、webで調べると以下のようなものが選べるとのことだったので、
action = %(action_)s ⇒BANのみ action = %(action_m)s ⇒+メール通知 action = %(action_mw)s ⇒+メール通知+whois情報
whoisまではいらないかと、recidiveセクションにaction = %(action_m)sを設定したところ以下のようなエラーが出てfail2banの起動に失敗
ERROR Failed during configuration: Bad value substitution: option 'action' in section 'recidive' contains an interpolation
jail.confを見たところ、そういうオプションはないような。。。
# The simplest action to take: ban only action_ = %(banaction)s[port="%(port)s", protocol="%(protocol)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"] # ban & send an e-mail with whois report and relevant log lines # to the destemail. action_mwl = %(action_)s %(mta)s-whois-lines[sender="%(sender)s", dest="%(destemail)s", logpath="%(logpath)s", chain="%(chain)s"] # See the IMPORTANT note in action.d/xarf-login-attack for when to use this action # # ban & send a xarf e-mail to abuse contact of IP address and include relevant log lines # to the destemail. action_xarf = %(action_)s xarf-login-attack[service=%(__name__)s, sender="%(sender)s", logpath="%(logpath)s", port="%(port)s"] # ban & send a notification to one or more of the 50+ services supported by Apprise. # See https://github.com/caronc/apprise/wiki for details on what is supported. # # You may optionally over-ride the default configuration line (containing the Apprise URLs) # by using 'apprise[config="/alternate/path/to/apprise.cfg"]' otherwise # /etc/fail2ban/apprise.conf is sourced for your supported notification configuration. # action = %(action_)s # apprise # ban IP on CloudFlare & send an e-mail with whois report and relevant log lines # to the destemail. action_cf_mwl = cloudflare[cfuser="%(cfemail)s", cftoken="%(cfapikey)s"] %(mta)s-whois-lines[sender="%(sender)s", dest="%(destemail)s", logpath="%(logpath)s", chain="%(chain)s"]た
試しにaction_mwとやると起動。はて。今は無くなってしまった?
以下のような情報あり。
Why isn’t there an “action_m" in the config? · fail2ban/fail2ban · Discussion #3757 · GitHub
↓無いから自分で作ってる?
ちなみにpostfixにしていても
mta = sendmail
のままでOKでした。設定変更後にfail2banを再起動すると以下のようなメールが来ました。
Hi, The jail recidive has been started successfully. Regards, Fail2Ban