Не идеальный вариант, да и других способов отражения подобной атаки много, но иногда бывают обстоятельства, когда необходимо выполнить задачу в жестко установленных рамках. Поэтому потребовалось произвести настройку fail2ban для отражения pingback-атаки с помощью fail2ban на CentOS 7
В файле /etc/fail2ban/jail.local указываем следующее:
[apache-wordpress]
enabled = true
filter = apache-wordpress
port = http,https
logpath = /var/log/httpd/domains/*.log # Указываем лог-файл виртуального хоста (Specify the virtual host's log file)
maxretry = 1
bantime = 86400
Создаем файл фильтрующий запросы /etc/fail2ban/filter.d/apache-wordpress.conf и в нем указываем правило
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
before = apache-common.conf
[Definition]
# Option: failregex
# Notes.: regex to match the w00tw00t scan messages in the logfile. The
# host must be matched by a group named "host". The tag "" can
# be used for standard IP/hostname matching.
# Values: TEXT
#failregex = ^ -.*WordPress.*
failregex = ^<HOST> .*GET|POST .*WordPress.*
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
ignoreregex =
После перезапускам fail2ban
systemctl restart fail2ban
Смотрим лог
tail -f /var/log/fail2ban.log
В моем случае он содержал следующее
2018-04-15 13:33:18,749 fail2ban.actions [10383]: NOTICE [apache-wordpress] 207.244.76.51 already banned
2018-04-15 13:33:19,751 fail2ban.actions [10383]: NOTICE [apache-wordpress] 54.84.86.151 already banned
2018-04-15 13:33:20,753 fail2ban.actions [10383]: NOTICE [apache-wordpress] 104.131.102.198 already banned
2018-04-15 13:33:21,754 fail2ban.actions [10383]: NOTICE [apache-wordpress] 212.114.133.93 already banned
2018-04-15 13:33:22,756 fail2ban.actions [10383]: NOTICE [apache-wordpress] 148.251.111.101 already banned
2018-04-15 13:33:23,757 fail2ban.actions [10383]: NOTICE [apache-wordpress] 188.65.119.119 already banned
2018-04-15 13:33:24,759 fail2ban.actions [10383]: NOTICE [apache-wordpress] 198.154.197.9 already banned
2018-04-15 13:33:25,761 fail2ban.actions [10383]: NOTICE [apache-wordpress] 87.229.73.142 already banned
По сути все.
Будь першим хто прокоментує