Linux Install Memo

サーバー管理者によるLinux関連ソフトのインストールメモ

Home » □PowerDNS用のfail2banフィルター

□PowerDNS用のfail2banフィルター

PowerDNSを使っていて、しつこくゾーン転送(AXFRとかIXFRとか)をリクエストしてくるのが要るときに、ログがもったいないのでfail2banすることにした。

cat > /etc/fail2ban/filter.d/pdns.conf

----------
# Fail2Ban configuration file
#
# Author: T.Kabu
#
# $Revision: 001 $
#

[Definition]

# 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>[\w\-.^_]+)
# Values: TEXT
#
failregex = denied: client IP <HOST> has no permission

# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
----------

emacs /etc/fail2ban/jail.conf

----------
[pdns-iptables]

enabled = true
filter = pdns
action = iptables[name=PDNS, port=53, protocol=udp]
sendmail-whois[name=PDNS, dest=disco-v8@4×4.jp, sender=fail2ban@mydns.jp, sendername=”Fail2Ban”]
logpath = /var/log/messages
maxretry = 5
bantime = 86400

----------

/usr/bin/fail2ban-client stop
/usr/bin/fail2ban-client -x start

あ、これはパッケージでなくてtar.gzからfail2banを入れた場合です。

ほかにも気になるアクセスがあったらバンバンする予定。 🙂

 

 

Name of author

Name: admin

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA