Asterisk 11 + fail2ban NEW
Рабочий вариант fail2ban без правки исходников для Asterisk10+:
1. Включаем лог security
Добавить в logger_logfiles_custom.conf
security_log => security
jail.conf
добавить в конец:
[asterisk-iptables]
enabled = true
filter = asterisk
action = iptables-allports[name=ASTERISK, protocol=all]
sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@yourdomain.ru]
logpath = /var/log/asterisk/security_log
maxretry = 3
findtime = 60000
bantime = 259200
/etc/fail2ban/filter.d/asterisk.conf
# Fail2Ban configuration file
#
#
# $Revision: 250 $
#
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
#before = common.conf
[Definition]
#_daemon = asterisk
# 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 "" can
# be used for standard IP/hostname matching and is only an alias for
# (?:::f{4,6}:)?(?P\S+)
# Values: TEXT
#
failregex = SECURITY.* SecurityEvent=\"InvalidPassword\".*RemoteAddress=\"IPV4/UDP/<HOST>/
SECURITY.* SecurityEvent=\"FailedACL\".*RemoteAddress=\"IPV4/UDP/<HOST>/
SECURITY.* SecurityEvent=\"InvalidAccountID\".*RemoteAddress=\"IPV4/UDP/<HOST>/
SECURITY.* SecurityEvent=\"ChallengeResponseFailed\".*RemoteAddress=\"IPV4/UDP/<HOST>/
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
И смотрим
iptables -L -v -n
Добавить комментарий!