Лёгкая настройка Asterisk 10 + Fail2Ban
До момента появления лога security в Asterisk 10-й версии fail2ban не мог корректно защищать asterisk от популярного вида атак — подбора sip пароля к экстеншенам, т.к. в обычных логах asterisk ip-адрес атакующего не отображался.
С появлением лога security эта проблема решена.
Если у вас Asterisk 10 и новее, его успешно можно использовать на пару с fail2ban. Настройка довольно простая.
1. Добавьте к /etc/asterisk/logger.conf
[general]
dateformat=%F %T[/code][/code]
и к секции [logfiles]
security => security[/code][/code]
2. Добавьте в конец /etc/fail2ban/jail.conf
[asterisk-iptables]
enabled = true
filter = asterisk
action = iptables-allports[name=ASTERISK, protocol=all]
sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]
logpath = /var/log/asterisk/security
maxretry = 5
bantime = 259200[/code][/code]
3. Создайте файл /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="FailedACL".*RemoteAddress=".+?/.+?//.+?".*
SECURITY.* SecurityEvent="InvalidAccountID".*RemoteAddress=".+?/.+?//.+?".*
SECURITY.* SecurityEvent="ChallengeResponseFailed".*RemoteAddress=".+?/.+?//.+?".*
SECURITY.* SecurityEvent="InvalidPassword".*RemoteAddress=".+?/.+?//.+?".*
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#ignoreregex =[/code][/code]
4. Перезапустите fail2ban чтобы он пересчитал конфигурацию.
Готово! fail2ban будет обнаруживать и предотвращать атаки по подбору SIP паролей.
Похожие новости:
Комментариев пока еще нет. Вы можете стать первым!
Информация
Комментировать статьи на нашем сайте возможно только в течении 10 дней со дня публикации.
Popular
Login
Last
More
Авторизация
Добавить комментарий!