2013-10-30 13:02:59 +00:00
|
|
|
# Fail2Ban filter file for named (bind9).
|
2007-08-08 22:21:15 +00:00
|
|
|
#
|
2013-10-30 13:02:59 +00:00
|
|
|
|
|
|
|
# This filter blocks attacks against named (bind9) however it requires special
|
|
|
|
# configuration on bind.
|
2007-08-08 22:21:15 +00:00
|
|
|
#
|
2013-10-30 13:02:59 +00:00
|
|
|
# By default, logging is off with bind9 installation.
|
2007-08-08 22:21:15 +00:00
|
|
|
#
|
2013-10-30 13:02:59 +00:00
|
|
|
# You will need something like this in your named.conf to provide proper logging.
|
2013-10-30 10:12:16 +00:00
|
|
|
#
|
|
|
|
# logging {
|
|
|
|
# channel security_file {
|
|
|
|
# file "/var/log/named/security.log" versions 3 size 30m;
|
|
|
|
# severity dynamic;
|
|
|
|
# print-time yes;
|
|
|
|
# };
|
|
|
|
# category security {
|
|
|
|
# security_file;
|
|
|
|
# };
|
|
|
|
# };
|
2007-08-08 22:21:15 +00:00
|
|
|
|
|
|
|
[Definition]
|
|
|
|
|
2007-08-27 21:03:33 +00:00
|
|
|
# Daemon name
|
2007-08-08 22:21:15 +00:00
|
|
|
_daemon=named
|
|
|
|
|
|
|
|
# Shortcuts for easier comprehension of the failregex
|
2013-10-30 13:02:59 +00:00
|
|
|
|
2007-08-08 22:21:15 +00:00
|
|
|
__pid_re=(?:\[\d+\])
|
|
|
|
__daemon_re=\(?%(_daemon)s(?:\(\S+\))?\)?:?
|
|
|
|
__daemon_combs_re=(?:%(__pid_re)s?:\s+%(__daemon_re)s|%(__daemon_re)s%(__pid_re)s?:)
|
2013-10-30 13:02:59 +00:00
|
|
|
|
2007-08-08 22:21:15 +00:00
|
|
|
# hostname daemon_id spaces
|
|
|
|
# this can be optional (for instance if we match named native log files)
|
|
|
|
__line_prefix=(?:\s\S+ %(__daemon_combs_re)s\s+)?
|
|
|
|
|
2013-08-28 02:32:40 +00:00
|
|
|
failregex = ^%(__line_prefix)s(\.\d+)?( error:)?\s*client <HOST>#\S+( \([\S.]+\))?: (view (internal|external): )?query(?: \(cache\))? '.*' denied\s*$
|
|
|
|
^%(__line_prefix)s(\.\d+)?( error:)?\s*client <HOST>#\S+( \([\S.]+\))?: zone transfer '\S+/AXFR/\w+' denied\s*$
|
|
|
|
^%(__line_prefix)s(\.\d+)?( error:)?\s*client <HOST>#\S+( \([\S.]+\))?: bad zone transfer request: '\S+/IN': non-authoritative zone \(NOTAUTH\)\s*$
|
|
|
|
|
2013-10-30 13:02:59 +00:00
|
|
|
# DEV Notes:
|
|
|
|
# Trying to generalize the
|
|
|
|
# structure which is general to capture general patterns in log
|
|
|
|
# lines to cover different configurations/distributions
|
|
|
|
#
|
|
|
|
# (\.\d+)? is a really ugly catch of the microseconds not captured in the date detector
|
|
|
|
#
|
|
|
|
# Author: Yaroslav Halchenko
|