RSS ITサイト動画新着

fail2banのメール通知で action = %(action_m)s って無くないですか?(Rocky Linux release 9.5 epelインストール)

※IT系の記事は当方環境での実施内容となるため実施する場合は自己責任でお願いいたします。

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

↓無いから自分で作ってる?

fail2ban/sendmail-only-ban.local at c7d0d8d2ee8abd59b766b8ed8f96f713aa6dbd1c – fail2ban – Gitea: Git with a cup of tea

fail2ban/jail.local at c7d0d8d2ee8abd59b766b8ed8f96f713aa6dbd1c – fail2ban – Gitea: Git with a cup of tea

ちなみにpostfixにしていても

mta = sendmail

のままでOKでした。設定変更後にfail2banを再起動すると以下のようなメールが来ました。

Hi,

The jail recidive has been started successfully.

Regards,

Fail2Ban

 

【PR】最近楽天で購入した商品

お手頃な値段で楽しめるが、なかなか真っすぐ飛ばせるようにならない。。。【レビュー投稿で1年保証】 X-COM スポーツディスク アルティメット フライング スタンダード ディスク 競技用 正規品 17 [...]

ipv6(クロスパス対応)だと接続するだけで使えるのは超絶便利。うちの場合は工事をしている間にipv6で繋がるようになりました。NEC PA-WX1500HP 無線LANルータ Aterm ブラック価 [...]

子供が児童館に置いてあったおもちゃでみて気に入って、欲しいとのことで購入。大人もぼーと見てられて、なかなか良い。【期間限定ポイントUP】日本製 【 オフィス弥生 】 プレイタイマー 1個 【 水車 タ [...]

Tips

Posted by admin