shibatch's journey

日々考えていることをつらつら書くだけです

fail2banのバージョンアップでの設定の更新

Fail2banというアクセスログ(など)から悪いアクセスをしてくるアクセス元IPをBANするツールがある。CentOSpostfixを使うインスタンスで使っているのだが、新規にインスタンスを作った際にコイツが起動しない事象があった。

ログを見ると 「/etc/fail2ban/filter.dにpostfix-saslというフィルタはないよ」と言われている。

ERROR   Found no accessible config files for 'filter.d/postfix-sasl' under /etc/fail2ban

いろいろ調べてみると去年の11月にバージョン0.9 -> 0.10にバージョンが上がっていて、

$  rpm -q --changelog fail2ban-server
* 火  1月 21 2020 Orion Poplawski <orion@nwra.com> - 0.10.5-2
- Move action.d/mail-whois-common.conf into fail2ban-server

* 火  1月 14 2020 Orion Poplawski <orion@nwra.com> - 0.10.5-1
- Update to 0.10.5

* 土 11月 23 2019 Orion Poplawski <orion@nwra.com> - 0.10.4-1
- Update to 0.10.4
- Define banaction_allports for firewalld, update banaction (bz#1775175)
- Update sendmail-reject with TLSMTA & MSA port IDs (bz#1722625)
- Remove config files for other distros (bz#1533113)
* 水  7月 12 2017 Orion Poplawski <orion@cora.nwra.com> - 0.9.7-1
- Update to 0.9.7

それに伴ってオプションの指定が変わってしまったようだった。 https://github.com/fail2ban/fail2ban/blob/ef1eaf9b37d56d7840a49ed0b74848e84e4e2af8/ChangeLog#L414

* `filter.d/postfix-sasl.conf`: removed (replaced with `postfix[mode=auth]`)

今までは

[mail-sasl]
 filter   = postfix-sasl

のようなフィルタの指定方法をしていたけれども、changelogに書いてあるように以下のようにしたら動作するようになった。

[mail-sasl]
 filter   = postfix[mode=auth]

ちょいちょい細かい挙動も変わっていたので事前の検証はなるべくやったほうが良さそう。