raspbian Linux [ホスト名] 4.9.36+ #1015 木曜日 7月 6日 16:07:57 BST 2017 armv6l GNU/Linux
fall2banはdropbear認証の失敗を検出できませんでした。これは問題なくopensshで動作します。メモリ使用量を減らすためにdropbearに移動しました。
これは、ロギングが動作していることを示す私のauth.logです。
dropbear[2640]: Bad password attempt for 'username' from 192.168.1.151:50780
私の地域の刑務所
#dropbear shh config password
[dropbear]
enabled = true
port = ssh
filter = dropbear
logpath = /var/log/auth.log
bantime = 900
banaction = iptables-allports
findtime = 900
maxretry = 3
私のdropbear.conf failure2banフィルタ
[Definition]
_daemon = dropbear
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
# host must be matched by a group named "host". The tag "<HOST>" can
# be used for standard IP/hostname matching and is only an alias for
# (?:::f{4,6}:)?(?P<host>\S+)
# Values: TEXT
# These match the unmodified dropbear messages. It isn't possible to
# match the source of the 'exit before auth' messages from dropbear.
#
failregex = ^%(__prefix_line)slogin attempt for nonexistent user ('.*' )?from <HOST>:.*\s*$
^%(__prefix_line)sbad password attempt for .+ from <HOST>:.*\s*$
# The only line we need to match with the modified dropbear.
# NOTE: The failregex below is ONLY intended to work with a patched
# version of Dropbear as described here:
# http://www.unchartedbackwaters.co.uk/pyblosxom/static/patches
と標準のJail設定(このオプションは.local Jailで上書きする必要があります)
# in /etc/fail2ban/jail.local.
#
# Optionally you may override any other parameter (e.g. banaction,
# action, port, logpath, etc) in that section within jail.local
[ssh]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 6
[dropbear]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/dropbear
maxretry = 6
答え1
正規表現dropbear.conf
は次の項目と一致しませんauth.log
。
Bad password attempt for... /* auth.log */
bad password attempt for... /* dropbear.conf */
大文字と小文字を考慮して編集する場合dropbear.conf
、fall2banは記録された認証失敗をキャプチャする必要があります。